diff --git a/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch b/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch new file mode 100644 index 0000000..0a927d1 --- /dev/null +++ b/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch @@ -0,0 +1,35 @@ +From 6560fb26a62ef135a804357ef4f15a47de3e49b3 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 10 Jan 2023 23:20:41 +0100 +Subject: [PATCH 8/8] debuginfod-client: Use CURLOPT_PROTOCOLS_STR for libcurl + >= 7.85.0 + +https://sourceware.org/bugzilla/show_bug.cgi?id=29926 + +Signed-off-by: Mark Wielaard +--- + debuginfod/ChangeLog | 5 +++++ + debuginfod/debuginfod-client.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index a16165bd..1ce45632 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -1336,8 +1336,13 @@ debuginfod_query_server (debuginfod_client *c, + + /* Only allow http:// + https:// + file:// so we aren't being + redirected to some unsupported protocol. */ ++#if CURL_AT_LEAST_VERSION(7, 85, 0) ++ curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR, ++ "http,https,file"); ++#else + curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS, + (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE)); ++#endif + curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url); + if (vfd >= 0) + curl_easy_setopt_ck(data[i].handle, CURLOPT_ERRORBUFFER, +-- +2.39.1 + diff --git a/elfutils-0.188-CURL_AT_LEAST_VERSION.patch b/elfutils-0.188-CURL_AT_LEAST_VERSION.patch new file mode 100644 index 0000000..192d643 --- /dev/null +++ b/elfutils-0.188-CURL_AT_LEAST_VERSION.patch @@ -0,0 +1,36 @@ +From 304741e11018c29e7ff17751e05dcc5c786a3fd9 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 21 Dec 2022 18:21:08 +0100 +Subject: [PATCH 2/8] debuginfod: Define CURL_AT_LEAST_VERSION if necessary + +Older curl.h don't define CURL_AT_LEAST_VERSION, so define it +ourselves because it is nicer than doing hex encoded version +comparisons. + +Signed-off-by: Mark Wielaard +--- + debuginfod/ChangeLog | 4 ++++ + debuginfod/debuginfod-client.c | 7 +++++++ + 2 files changed, 11 insertions(+) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index 692aecce..a16165bd 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -105,6 +105,13 @@ void debuginfod_end (debuginfod_client *c) { } + #include + #endif + ++/* Older curl.h don't define CURL_AT_LEAST_VERSION. */ ++#ifndef CURL_AT_LEAST_VERSION ++ #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) ++ #define CURL_AT_LEAST_VERSION(x,y,z) \ ++ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) ++#endif ++ + #include + + static pthread_once_t init_control = PTHREAD_ONCE_INIT; +-- +2.39.1 + diff --git a/elfutils-0.188-deprecated-CURLINFO.patch b/elfutils-0.188-deprecated-CURLINFO.patch new file mode 100644 index 0000000..18a459c --- /dev/null +++ b/elfutils-0.188-deprecated-CURLINFO.patch @@ -0,0 +1,49 @@ +From d2bf497b12fbd49b4996ccf0744303ffd67735b1 Mon Sep 17 00:00:00 2001 +From: Andrew Paprocki +Date: Wed, 21 Dec 2022 11:15:00 -0500 +Subject: [PATCH 1/8] PR29926: debuginfod: Fix usage of deprecated CURLINFO_* + +The `CURLINFO_SIZE_DOWNLOAD_T` and `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T` +identifiers are `enum`s, not pre-processor definitions, so the current +`#ifdef` logic is not selecting the newer API. This results in the +older identifiers being used and they now generate errors when compiled +against Curl 7.87, which has silently deprecated them, causing GCC to +emit `-Werror=deprecated-declarations`. + +Instead, the newer identifiers were added in Curl 7.55, so explicitly +check for `CURL_AT_LEAST_VERSION(7, 55, 0)` instead of the current +logic. This eliminates the error when compiling against Curl 7.87. + +Ref: https://github.com/curl/curl/pull/1511 + +Signed-off-by: Andrew Paprocki +--- + debuginfod/ChangeLog | 4 ++++ + debuginfod/debuginfod-client.c | 4 ++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index 8873fcc8..692aecce 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -1456,7 +1456,7 @@ debuginfod_query_server (debuginfod_client *c, + deflate-compressing proxies, this number is likely to be + unavailable, so -1 may show. */ + CURLcode curl_res; +-#ifdef CURLINFO_CONTENT_LENGTH_DOWNLOAD_T ++#if CURL_AT_LEAST_VERSION(7, 55, 0) + curl_off_t cl; + curl_res = curl_easy_getinfo(target_handle, + CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, +@@ -1491,7 +1491,7 @@ debuginfod_query_server (debuginfod_client *c, + if (target_handle) /* we've committed to a server; report its download progress */ + { + CURLcode curl_res; +-#ifdef CURLINFO_SIZE_DOWNLOAD_T ++#if CURL_AT_LEAST_VERSION(7, 55, 0) + curl_off_t dl; + curl_res = curl_easy_getinfo(target_handle, + CURLINFO_SIZE_DOWNLOAD_T, +-- +2.39.1 + diff --git a/elfutils-debuginfod.changes b/elfutils-debuginfod.changes index 75e881f..74f5909 100644 --- a/elfutils-debuginfod.changes +++ b/elfutils-debuginfod.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Feb 16 13:00:33 UTC 2023 - Pedro Monreal + +- Fix build with libcurl version 7.88.0 for various deprecated + constants. Add patches: + * elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch + * elfutils-0.188-CURL_AT_LEAST_VERSION.patch + * elfutils-0.188-deprecated-CURLINFO.patch + +------------------------------------------------------------------- +Tue Feb 14 09:46:19 UTC 2023 - Martin Liška + +- Add support-DW_TAG_unspecified_type.patch that fixes PR30047. + ------------------------------------------------------------------- Fri Dec 9 08:34:19 UTC 2022 - Thorsten Kukuk diff --git a/elfutils-debuginfod.spec b/elfutils-debuginfod.spec index 1d463c1..1fd8bb8 100644 --- a/elfutils-debuginfod.spec +++ b/elfutils-debuginfod.spec @@ -1,7 +1,7 @@ # # spec file for package elfutils-debuginfod # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -30,6 +30,11 @@ Source3: elfutils.keyring Source4: %{name}.sysusers Patch1: harden_debuginfod.service.patch Patch2: 0005-backends-Add-RISC-V-object-attribute-printing.patch +Patch3: support-DW_TAG_unspecified_type.patch +#PATCH-FIX-UPSTREAM Patches to fix deprecated curl options +Patch4: elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch +Patch5: elfutils-0.188-CURL_AT_LEAST_VERSION.patch +Patch6: elfutils-0.188-deprecated-CURLINFO.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bison diff --git a/elfutils.changes b/elfutils.changes index 52c2276..ca7c287 100644 --- a/elfutils.changes +++ b/elfutils.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Feb 16 13:00:33 UTC 2023 - Pedro Monreal + +- Fix build with libcurl version 7.88.0 for various deprecated + constants. Add patches: + * elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch + * elfutils-0.188-CURL_AT_LEAST_VERSION.patch + * elfutils-0.188-deprecated-CURLINFO.patch + +------------------------------------------------------------------- +Tue Feb 14 09:46:19 UTC 2023 - Martin Liška + +- Add support-DW_TAG_unspecified_type.patch that fixes PR30047. + ------------------------------------------------------------------- Wed Nov 9 15:31:15 UTC 2022 - Dirk Müller diff --git a/elfutils.spec b/elfutils.spec index 460edf3..1e136cc 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,7 +1,7 @@ # # spec file for package elfutils # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -32,6 +32,11 @@ Source5: %{name}.keyring Source6: elfutils-rpmlintrc Patch1: harden_debuginfod.service.patch Patch2: 0005-backends-Add-RISC-V-object-attribute-printing.patch +Patch3: support-DW_TAG_unspecified_type.patch +#PATCH-FIX-UPSTREAM Patches to fix deprecated curl options +Patch4: elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch +Patch5: elfutils-0.188-CURL_AT_LEAST_VERSION.patch +Patch6: elfutils-0.188-deprecated-CURLINFO.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bison diff --git a/support-DW_TAG_unspecified_type.patch b/support-DW_TAG_unspecified_type.patch new file mode 100644 index 0000000..7760537 --- /dev/null +++ b/support-DW_TAG_unspecified_type.patch @@ -0,0 +1,99 @@ +From f638ab839a5c0a6fdfa666acdf6839ed827f0897 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 26 Jan 2023 18:19:15 +0100 +Subject: [PATCH] backends: Handle DW_TAG_unspecified_type in + dwarf_peeled_die_type + +binutils 2.40 introduces DW_TAG_unspecified_type for assembly +functions with an unknown return type. This breaks the +run-funcretval.sh testcase because dwfl_module_return_value_location +returns an error for such functions because it cannot determine the +return value location. Fix that by treating DW_TAG_unspecified_type +as if the DIE doesn't have a DW_AT_type. + +Also update the testcase to explicitly checking for +DW_TAG_unspecified_type and printing "returns unspecified type". + +https://sourceware.org/bugzilla/show_bug.cgi?id=30047 + +Signed-off-by: Mark Wielaard +--- + NEWS | 5 +++++ + backends/ChangeLog | 5 +++++ + backends/libebl_CPU.h | 14 ++++++++++++-- + tests/ChangeLog | 4 ++++ + tests/funcretval.c | 14 +++++++++++++- + 5 files changed, 39 insertions(+), 3 deletions(-) + +diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h +index 0e507bd3..a2898a1f 100644 +--- a/backends/libebl_CPU.h ++++ b/backends/libebl_CPU.h +@@ -1,5 +1,6 @@ + /* Common interface for libebl modules. + Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc. ++ Copyright (C) 2023 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -53,7 +54,9 @@ extern bool (*generic_debugscn_p) (const char *) attribute_hidden; + dwarf_tag (_die); }) + + /* Get a type die corresponding to DIE. Peel CV qualifiers off +- it. */ ++ it. Returns zero if the DIE doesn't have a type, or the type ++ is DW_TAG_unspecified_type. Returns -1 on error. Otherwise ++ returns the result tag DW_AT value. */ + static inline int + dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result) + { +@@ -69,7 +72,14 @@ dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result) + if (dwarf_peel_type (result, result) != 0) + return -1; + +- return DWARF_TAG_OR_RETURN (result); ++ if (result == NULL) ++ return -1; ++ ++ int tag = dwarf_tag (result); ++ if (tag == DW_TAG_unspecified_type) ++ return 0; /* Treat an unspecified type as if there was no type. */ ++ ++ return tag; + } + + #endif /* libebl_CPU.h */ +diff --git a/tests/funcretval.c b/tests/funcretval.c +index 16cd1a44..41198ab7 100644 +--- a/tests/funcretval.c ++++ b/tests/funcretval.c +@@ -1,5 +1,6 @@ + /* Test program for dwfl_module_return_value_location. + Copyright (C) 2005 Red Hat, Inc. ++ Copyright (C) 2023 Mark J. Wielaard + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify +@@ -67,7 +68,18 @@ handle_function (Dwarf_Die *funcdie, void *arg) + error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s", + dwfl_errmsg (-1)); + else if (nlocops == 0) +- puts ("returns no value"); ++ { ++ // Check if this is the special unspecified type ++ // https://sourceware.org/bugzilla/show_bug.cgi?id=30047 ++ Dwarf_Die die_mem, *typedie = &die_mem; ++ Dwarf_Attribute attr_mem, *attr; ++ attr = dwarf_attr_integrate (funcdie, DW_AT_type, &attr_mem); ++ if (dwarf_formref_die (attr, typedie) != NULL ++ && dwarf_tag (typedie) == DW_TAG_unspecified_type) ++ puts ("returns unspecified type"); ++ else ++ puts ("returns no value"); ++ } + else + { + printf ("return value location:"); +-- +2.39.1 +