From 1fb1ae3dd654ab03fdba5e67fb0e046ad9e5b43c Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 4 Aug 2022 22:39:25 +0100 Subject: [PATCH 1/5] Build with jansson when not bootstrapping Enables automatic validation of --package-metadata --- binutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binutils.spec b/binutils.spec index c8fd2c1..f85509f 100644 --- a/binutils.spec +++ b/binutils.spec @@ -370,7 +370,7 @@ BuildRequires: gcc %endif %if %{without bootstrap} -BuildRequires: gettext, flex, zlib-devel +BuildRequires: gettext, flex, zlib-devel, jansson-devel %endif %if %{with docs} @@ -667,6 +667,9 @@ esac %endif %if %{enable_separate_code} --enable-separate-code=yes \ +%endif +%if %{without bootstrap} + --enable-jansson=yes \ %endif $CARGS \ --enable-plugins \ From 44cef2967332828e714c61c779c16d8b6f33273f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 10 Aug 2022 11:26:47 +0100 Subject: [PATCH 2/5] Build with jansson when not bootstrapping. --- binutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binutils.spec b/binutils.spec index f85509f..5832d7e 100644 --- a/binutils.spec +++ b/binutils.spec @@ -39,7 +39,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.38 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -951,6 +951,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Aug 10 2022 Luca Boccassi - 2.38-24 +- Build with jansson when not bootstrapping. + * Thu Aug 04 2022 Nick Clifton - 2.38-23 - Add the --package-metadata option to the linkers. (#2099999) From 4a4bd90398e164663cf2789625299b9b9dcbdf87 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 12 Aug 2022 15:22:59 +0100 Subject: [PATCH 3/5] Rebase to GNU Binutils 2.39. - Retire: binutils-CVE-2019-1010204.patch - Retire: binutils-use-long-long.patch - Retire: binutils-section-type.patch - Retire: binutils-gas-loc-view.patch - Retire: binutils-do-not-use-debuginfod.patch - Retire: binutils-indirect-symbols.patch - Retire: binutils-s390x-static-PIE.patch - Retire: binutils-link-following.patch - Retire: binutils-x86-non-canonical-references.patch - Retire: binutils-ppc64-DT_RELR-relocs.patch - Retire: binutils-ppc-gas-machine-directive.patch --- .gitignore | 1 + binutils-CVE-2019-1010204.patch | 15 - binutils-do-not-use-debuginfod.patch | 258 ------ binutils-gas-dwarf-skip-empty-functions.patch | 93 ++ binutils-gas-loc-view.patch | 91 -- binutils-indirect-symbols.patch | 14 - binutils-link-following.patch | 358 -------- binutils-package-metadata.patch | 860 +----------------- binutils-ppc-gas-machine-directive.patch | 52 -- binutils-ppc64-DT_RELR-relocs.patch | 266 ------ binutils-s390x-static-PIE.patch | 142 --- binutils-section-type.patch | 369 -------- binutils-testsuite-fixes.patch | 843 ++++++++++++----- binutils-use-long-long.patch | 38 - binutils-x86-non-canonical-references.patch | 92 -- binutils.spec | 134 +-- sources | 2 +- 17 files changed, 812 insertions(+), 2816 deletions(-) delete mode 100644 binutils-CVE-2019-1010204.patch delete mode 100644 binutils-do-not-use-debuginfod.patch create mode 100644 binutils-gas-dwarf-skip-empty-functions.patch delete mode 100644 binutils-gas-loc-view.patch delete mode 100644 binutils-indirect-symbols.patch delete mode 100644 binutils-link-following.patch delete mode 100644 binutils-ppc-gas-machine-directive.patch delete mode 100644 binutils-ppc64-DT_RELR-relocs.patch delete mode 100644 binutils-s390x-static-PIE.patch delete mode 100644 binutils-section-type.patch delete mode 100644 binutils-use-long-long.patch delete mode 100644 binutils-x86-non-canonical-references.patch diff --git a/.gitignore b/.gitignore index 87bb600..315cb48 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ stamp-* /binutils-2.36.1.tar.xz /binutils-2.37.tar.xz /binutils-2.38.tar.xz +/binutils-2.39.tar.xz diff --git a/binutils-CVE-2019-1010204.patch b/binutils-CVE-2019-1010204.patch deleted file mode 100644 index 56434b1..0000000 --- a/binutils-CVE-2019-1010204.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- binutils.orig/gold/fileread.cc 2019-08-06 14:22:08.669313110 +0100 -+++ binutils-2.32/gold/fileread.cc 2019-08-06 14:22:28.799177543 +0100 -@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_ - ssize_t bytes; - if (this->whole_file_view_ != NULL) - { -+ // See PR 23765 for an example of a testcase that triggers this error. -+ if (((ssize_t) start) < 0) -+ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"), -+ this->filename().c_str(), -+ static_cast(start)); -+ - bytes = this->size_ - start; - if (static_cast(bytes) >= size) - { diff --git a/binutils-do-not-use-debuginfod.patch b/binutils-do-not-use-debuginfod.patch deleted file mode 100644 index be1f43a..0000000 --- a/binutils-do-not-use-debuginfod.patch +++ /dev/null @@ -1,258 +0,0 @@ -diff -rup binutils.orig/binutils/NEWS binutils-2.38/binutils/NEWS ---- binutils.orig/binutils/NEWS 2022-03-10 09:13:18.284641005 +0000 -+++ binutils-2.38/binutils/NEWS 2022-03-10 09:13:26.007586352 +0000 -@@ -1,5 +1,8 @@ - -*- text -*- - -+* Add an option to objdump and readelf to prevent attempts to access debuginfod -+ servers when following links. -+ - Changes in 2.38: - - * elfedit: Add --output-abiversion option to update ABIVERSION. -diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.38/binutils/doc/binutils.texi ---- binutils.orig/binutils/doc/binutils.texi 2022-03-10 09:13:18.285640998 +0000 -+++ binutils-2.38/binutils/doc/binutils.texi 2022-03-10 09:13:26.009586338 +0000 -@@ -2246,6 +2246,8 @@ objdump [@option{-a}|@option{--archive-h - @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]] - [@option{-WK}|@option{--dwarf=follow-links}] - [@option{-WN}|@option{--dwarf=no-follow-links}] -+ [@option{-wD}|@option{--dwarf=use-debuginfod}] -+ [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}] - [@option{-L}|@option{--process-links}] - [@option{--ctf=}@var{section}] - [@option{-G}|@option{--stabs}] -@@ -4879,6 +4881,8 @@ readelf [@option{-a}|@option{--all}] - @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]] - [@option{-wK}|@option{--debug-dump=follow-links}] - [@option{-wN}|@option{--debug-dump=no-follow-links}] -+ [@option{-wD}|@option{--debug-dump=use-debuginfod}] -+ [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}] - [@option{-P}|@option{--process-links}] - [@option{--dwarf-depth=@var{n}}] - [@option{--dwarf-start=@var{n}}] -@@ -5504,7 +5508,8 @@ deduced from the input file - @cindex separate debug files - - debuginfod is a web service that indexes ELF/DWARF debugging resources --by build-id and serves them over HTTP. -+by build-id and serves them over HTTP. For more information see: -+@emph{https://sourceware.org/elfutils/Debuginfod.html} - - Binutils can be built with the debuginfod client library - @code{libdebuginfod} using the @option{--with-debuginfod} configure option. -@@ -5516,6 +5521,10 @@ separate debug files when the files are - debuginfod is packaged with elfutils, starting with version 0.178. - You can get the latest version from `https://sourceware.org/elfutils/'. - -+The DWARF info dumping tools (@command{readelf} and @command{objdump}) -+have options to control when they should access the debuginfod -+servers. By default this access is enabled. -+ - @node Reporting Bugs - @chapter Reporting Bugs - @cindex bugs -Only in binutils-2.38/binutils/doc: binutils.texi.orig -diff -rup binutils.orig/binutils/doc/debug.options.texi binutils-2.38/binutils/doc/debug.options.texi ---- binutils.orig/binutils/doc/debug.options.texi 2022-03-10 09:13:18.285640998 +0000 -+++ binutils-2.38/binutils/doc/debug.options.texi 2022-03-10 09:13:26.009586338 +0000 -@@ -68,10 +68,27 @@ chosen when configuring the binutils via - @option{--enable-follow-debug-links=no} options. If these are not - used then the default is to enable the following of debug links. - -+Note - if support for the debuginfod protocol was enabled when the -+binutils were built then this option will also include an attempt to -+contact any debuginfod servers mentioned in the @var{DEBUGINFOD_URLS} -+environment variable. This could take some time to resolve. This -+behaviour can be disabled via the @option{=do-not-use-debuginfod} debug -+option. -+ - @item N - @itemx =no-follow-links - Disables the following of links to separate debug info files. - -+@item D -+@itemx =use-debuginfod -+Enables contacting debuginfod servers if there is a need to follow -+debug links. This is the default behaviour. -+ -+@item E -+@itemx =do-not-use-debuginfod -+Disables contacting debuginfod servers when there is a need to follow -+debug links. -+ - @item l - @itemx =rawline - Displays the contents of the @samp{.debug_line} section in a raw -diff -rup binutils.orig/binutils/dwarf.c binutils-2.38/binutils/dwarf.c ---- binutils.orig/binutils/dwarf.c 2022-03-10 09:13:18.283641012 +0000 -+++ binutils-2.38/binutils/dwarf.c 2022-03-10 09:13:26.010586331 +0000 -@@ -109,6 +109,9 @@ int do_debug_cu_index; - int do_wide; - int do_debug_links; - int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS; -+#ifdef HAVE_LIBDEBUGINFOD -+int use_debuginfod = 1; -+#endif - bool do_checks; - - int dwarf_cutoff_level = -1; -@@ -11038,7 +11041,7 @@ debuginfod_fetch_separate_debug_info (st - - return false; - } --#endif -+#endif /* HAVE_LIBDEBUGINFOD */ - - static void * - load_separate_debug_info (const char * main_filename, -@@ -11157,9 +11160,10 @@ load_separate_debug_info (const char * - { - char * tmp_filename; - -- if (debuginfod_fetch_separate_debug_info (xlink, -- & tmp_filename, -- file)) -+ if (use_debuginfod -+ && debuginfod_fetch_separate_debug_info (xlink, -+ & tmp_filename, -+ file)) - { - /* File successfully downloaded from server, replace - debug_filename with the file's path. */ -@@ -11207,13 +11211,15 @@ load_separate_debug_info (const char * - warn (_("tried: %s\n"), debug_filename); - - #if HAVE_LIBDEBUGINFOD -- { -- char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR); -- if (urls == NULL) -- urls = ""; -+ if (use_debuginfod) -+ { -+ char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR); - -- warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls); -- } -+ if (urls == NULL) -+ urls = ""; -+ -+ warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls); -+ } - #endif - } - -@@ -11707,6 +11713,9 @@ dwarf_select_sections_by_names (const ch - { "aranges", & do_debug_aranges, 1 }, - { "cu_index", & do_debug_cu_index, 1 }, - { "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED }, -+#ifdef HAVE_LIBDEBUGINFOD -+ { "do-not-use-debuginfod", & use_debuginfod, 0 }, -+#endif - { "follow-links", & do_follow_links, 1 }, - { "frames", & do_debug_frames, 1 }, - { "frames-interp", & do_debug_frames_interp, 1 }, -@@ -11730,6 +11739,9 @@ dwarf_select_sections_by_names (const ch - { "trace_abbrev", & do_trace_abbrevs, 1 }, - { "trace_aranges", & do_trace_aranges, 1 }, - { "trace_info", & do_trace_info, 1 }, -+#ifdef HAVE_LIBDEBUGINFOD -+ { "use-debuginfod", & use_debuginfod, 1 }, -+#endif - { NULL, NULL, 0 } - }; - -@@ -11783,6 +11795,10 @@ dwarf_select_sections_by_letters (const - case 'A': do_debug_addr = 1; break; - case 'a': do_debug_abbrevs = 1; break; - case 'c': do_debug_cu_index = 1; break; -+#ifdef HAVE_LIBDEBUGINFOD -+ case 'D': use_debuginfod = 1; break; -+ case 'E': use_debuginfod = 0; break; -+#endif - case 'F': do_debug_frames_interp = 1; /* Fall through. */ - case 'f': do_debug_frames = 1; break; - case 'g': do_gdb_index = 1; break; -diff -rup binutils.orig/binutils/dwarf.h binutils-2.38/binutils/dwarf.h ---- binutils.orig/binutils/dwarf.h 2022-03-10 09:13:18.284641005 +0000 -+++ binutils-2.38/binutils/dwarf.h 2022-03-10 09:13:26.010586331 +0000 -@@ -224,6 +224,9 @@ extern int do_debug_cu_index; - extern int do_wide; - extern int do_debug_links; - extern int do_follow_links; -+#ifdef HAVE_LIBDEBUGINFOD -+extern int use_debuginfod; -+#endif - extern bool do_checks; - - extern int dwarf_cutoff_level; -diff -rup binutils.orig/binutils/objdump.c binutils-2.38/binutils/objdump.c ---- binutils.orig/binutils/objdump.c 2022-03-10 09:13:18.283641012 +0000 -+++ binutils-2.38/binutils/objdump.c 2022-03-10 09:13:26.011586324 +0000 -@@ -281,6 +281,14 @@ usage (FILE *stream, int status) - Do not follow links to separate debug info files\n\ - (default)\n")); - #endif -+#if HAVE_LIBDEBUGINFOD -+ fprintf (stream, _("\ -+ -WD --dwarf=use-debuginfod\n\ -+ When following links, also query debuginfod servers (default)\n")); -+ fprintf (stream, _("\ -+ -WE --dwarf=do-not-use-debuginfod\n\ -+ When following links, do not query debuginfod servers\n")); -+#endif - fprintf (stream, _("\ - -L, --process-links Display the contents of non-debug sections in\n\ - separate debuginfo files. (Implies -WK)\n")); -Only in binutils-2.38/binutils/: objdump.c.orig -diff -rup binutils.orig/binutils/readelf.c binutils-2.38/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2022-03-10 09:13:18.302640878 +0000 -+++ binutils-2.38/binutils/readelf.c 2022-03-10 09:13:26.012586316 +0000 -@@ -5126,6 +5126,14 @@ usage (FILE * stream) - Do not follow links to separate debug info files\n\ - (default)\n")); - #endif -+#if HAVE_LIBDEBUGINFOD -+ fprintf (stream, _("\ -+ -wD --debug-dump=use-debuginfod\n\ -+ When following links, also query debuginfod servers (default)\n")); -+ fprintf (stream, _("\ -+ -wE --debug-dump=do-not-use-debuginfod\n\ -+ When following links, do not query debuginfod servers\n")); -+#endif - fprintf (stream, _("\ - --dwarf-depth=N Do not display DIEs at depth N or greater\n")); - fprintf (stream, _("\ -Only in binutils-2.38/binutils/: readelf.c.orig -diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp ---- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:18.291640956 +0000 -+++ binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:26.012586316 +0000 -@@ -185,8 +185,14 @@ proc test_fetch_debugaltlink { prog prog - } - - if { [regexp ".*DEBUGINFOD.*" $conf_objdump] } { -- test_fetch_debuglink $OBJDUMP "-W" -+ test_fetch_debuglink $OBJDUMP "-W -WD" - test_fetch_debugaltlink $OBJDUMP "-Wk" -+ -+ set test "disabling debuginfod access" -+ setup_xfail *-*-* -+ test_fetch_debuglink $OBJDUMP "-W -WE" -+ set test "debuginfod" -+ - } else { - untested "$test (objdump not configured with debuginfod)" - } -@@ -194,6 +200,12 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd - if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } { - test_fetch_debuglink $READELF "-w" - test_fetch_debugaltlink $READELF "-wk" -+ -+ set test "disabling debuginfod access" -+ setup_xfail *-*-* -+ test_fetch_debuglink $READELF "-w -wE" -+ set test "debuginfod" -+ - } else { - untested "$test (readelf not configured with debuginfod)" - } diff --git a/binutils-gas-dwarf-skip-empty-functions.patch b/binutils-gas-dwarf-skip-empty-functions.patch new file mode 100644 index 0000000..6d75c0b --- /dev/null +++ b/binutils-gas-dwarf-skip-empty-functions.patch @@ -0,0 +1,93 @@ +From b53c44bfe31fb036f212275b6d70edd5eee7b088 Mon Sep 17 00:00:00 2001 +From: Jan Beulich via Binutils +Date: Tue, 9 Aug 2022 13:12:03 +0200 +Subject: [PATCH] gas/Dwarf: properly skip zero-size functions + +PR gas/29451 + +While out_debug_abbrev() properly skips such functions, out_debug_info() +mistakenly didn't. It needs to calculate the high_pc expression ahead of +time, in order to skip emitting any data for the function if the value +is zero. + +The one case which would still leave a zero-size entry is when +symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can +expect that to not be the case, otherwise we'd need to have a way to +post-process .debug_info contents between resolving expressions and +actually writing the data out to the file. Even then it wouldn't be +entirely obvious in which way to alter the data. +--- + gas/dwarf2dbg.c | 39 ++++++++++++++++++++------------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c +index 868ec79ee2c..f346bd6a412 100644 +--- a/gas/dwarf2dbg.c ++++ b/gas/dwarf2dbg.c +@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg, + { + const char *name; + size_t len; ++ expressionS size = { .X_op = O_constant }; + + /* Skip warning constructs (see above). */ + if (symbol_get_bfdsym (symp)->flags & BSF_WARNING) +@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg, + if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp)) + continue; + ++#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ ++ size.X_add_number = S_GET_SIZE (symp); ++ if (size.X_add_number == 0 && IS_ELF ++ && symbol_get_obj (symp)->size != NULL) ++ { ++ size.X_op = O_add; ++ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); ++ } ++#endif ++ if (size.X_op == O_constant && size.X_add_number == 0) ++ continue; ++ + subseg_set (str_seg, 0); + name_sym = symbol_temp_new_now_octets (); + name = S_GET_NAME (symp); +@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg, segT str_seg, + emit_expr (&exp, sizeof_address); + + /* DW_AT_high_pc */ +- exp.X_op = O_constant; +-#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ +- exp.X_add_number = S_GET_SIZE (symp); +- if (exp.X_add_number == 0 && IS_ELF +- && symbol_get_obj (symp)->size != NULL) +- { +- exp.X_op = O_add; +- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); +- } +-#else +- exp.X_add_number = 0; +-#endif + if (DWARF2_VERSION < 4) + { +- if (exp.X_op == O_constant) +- exp.X_op = O_symbol; +- exp.X_add_symbol = symp; +- emit_expr (&exp, sizeof_address); ++ if (size.X_op == O_constant) ++ size.X_op = O_symbol; ++ size.X_add_symbol = symp; ++ emit_expr (&size, sizeof_address); + } +- else if (exp.X_op == O_constant) +- out_uleb128 (exp.X_add_number); ++ else if (size.X_op == O_constant) ++ out_uleb128 (size.X_add_number); + else +- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0); ++ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0); + } + + /* End of children. */ +-- +2.37.1 + diff --git a/binutils-gas-loc-view.patch b/binutils-gas-loc-view.patch deleted file mode 100644 index f174caa..0000000 --- a/binutils-gas-loc-view.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff -rup binutils.orig/gas/symbols.c binutils-2.38/gas/symbols.c ---- binutils.orig/gas/symbols.c 2022-03-09 11:43:34.706610216 +0000 -+++ binutils-2.38/gas/symbols.c 2022-03-09 11:45:57.540686508 +0000 -@@ -61,8 +61,10 @@ struct symbol_flags - /* Whether the symbol can be re-defined. */ - unsigned int volatil : 1; - -- /* Whether the symbol is a forward reference. */ -+ /* Whether the symbol is a forward reference, and whether such has -+ been determined. */ - unsigned int forward_ref : 1; -+ unsigned int forward_resolved : 1; - - /* This is set if the symbol is defined in an MRI common section. - We handle such sections as single common symbols, so symbols -@@ -202,7 +204,7 @@ static void * - symbol_entry_find (htab_t table, const char *name) - { - hashval_t hash = htab_hash_string (name); -- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - hash, name, 0, 0, 0 } }; - return htab_find_with_hash (table, &needle, hash); - } -@@ -784,7 +786,9 @@ symbol_clone (symbolS *orgsymP, int repl - symbolS * - symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward) - { -- if (symbolP && !symbolP->flags.local_symbol) -+ if (symbolP -+ && !symbolP->flags.local_symbol -+ && !symbolP->flags.forward_resolved) - { - symbolS *orig_add_symbol = symbolP->x->value.X_add_symbol; - symbolS *orig_op_symbol = symbolP->x->value.X_op_symbol; -@@ -837,6 +841,7 @@ symbol_clone_if_forward_ref (symbolS *sy - - symbolP->x->value.X_add_symbol = add_symbol; - symbolP->x->value.X_op_symbol = op_symbol; -+ symbolP->flags.forward_resolved = 1; - } - - return symbolP; -diff -rup binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d ---- binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:43:34.487611632 +0000 -+++ binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:48:03.298873228 +0000 -@@ -2,9 +2,8 @@ - #readelf: -x.rodata -wL - #name: DWARF2 18 - # The am33 cr16 crx ft32 mn10 msp430 nds32 and rl78 targets do not evaluate the subtraction of symbols at assembly time. --# The mep targets turns some view computations into complex relocations. - # The riscv targets do not support the subtraction of symbols. --#xfail: am3*-* cr16-* crx-* ft32*-* mep-* mn10*-* msp430-* nds32*-* riscv*-* rl78-* -+#xfail: am3*-* cr16-* crx-* ft32*-* mn10*-* msp430-* nds32*-* riscv*-* rl78-* - - Hex dump of section '\.rodata': - 0x00000000 0100 *.* ---- binutils.orig/gas/dwarf2dbg.c 2022-03-10 09:13:18.516639363 +0000 -+++ binutils-2.38/gas/dwarf2dbg.c 2022-03-10 12:45:25.191933733 +0000 -@@ -402,18 +402,27 @@ set_or_check_view (struct line_entry *e, - if (viewx.X_op != O_constant || viewx.X_add_number) - { - expressionS incv; -+ expressionS *p_view; - - if (!p->loc.u.view) -- { -- p->loc.u.view = symbol_temp_make (); -- gas_assert (!S_IS_DEFINED (p->loc.u.view)); -- } -+ p->loc.u.view = symbol_temp_make (); - - memset (&incv, 0, sizeof (incv)); - incv.X_unsigned = 1; - incv.X_op = O_symbol; - incv.X_add_symbol = p->loc.u.view; - incv.X_add_number = 1; -+ p_view = symbol_get_value_expression (p->loc.u.view); -+ if (p_view->X_op == O_constant || p_view->X_op == O_symbol) -+ { -+ /* If we can, constant fold increments so that a chain of -+ expressions v + 1 + 1 ... + 1 is not created. -+ resolve_expression isn't ideal for this purpose. The -+ base v might not be resolvable until later. */ -+ incv.X_op = p_view->X_op; -+ incv.X_add_symbol = p_view->X_add_symbol; -+ incv.X_add_number = p_view->X_add_number + 1; -+ } - - if (viewx.X_op == O_constant) - { diff --git a/binutils-indirect-symbols.patch b/binutils-indirect-symbols.patch deleted file mode 100644 index 1c1982b..0000000 --- a/binutils-indirect-symbols.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- binutils.orig/bfd/elflink.c 2022-03-30 11:44:05.686040593 +0100 -+++ binutils-2.38/bfd/elflink.c 2022-03-30 11:45:18.066541463 +0100 -@@ -1294,9 +1294,8 @@ _bfd_elf_merge_symbol (bfd *abfd, - h->root.non_ir_ref_dynamic = true; - hi->root.non_ir_ref_dynamic = true; - } -- -- if ((oldbfd->flags & BFD_PLUGIN) != 0 -- && hi->root.type == bfd_link_hash_indirect) -+ else if ((oldbfd->flags & BFD_PLUGIN) != 0 -+ && hi->root.type == bfd_link_hash_indirect) - { - /* Change indirect symbol from IR to undefined. */ - hi->root.type = bfd_link_hash_undefined; diff --git a/binutils-link-following.patch b/binutils-link-following.patch deleted file mode 100644 index cd6ab08..0000000 --- a/binutils-link-following.patch +++ /dev/null @@ -1,358 +0,0 @@ -diff -rup binutils.orig/binutils/dwarf.c binutils-2.38/binutils/dwarf.c ---- binutils.orig/binutils/dwarf.c 2022-05-20 16:57:16.563961379 +0100 -+++ binutils-2.38/binutils/dwarf.c 2022-05-20 16:57:32.880853694 +0100 -@@ -11693,7 +11693,11 @@ free_debug_memory (void) - free_dwo_info (); - } - --void -+/* Enable display of specific DWARF sections as determined by the comma -+ separated strings in NAMES. Returns non-zero if any displaying was -+ enabled. */ -+ -+int - dwarf_select_sections_by_names (const char *names) - { - typedef struct -@@ -11746,6 +11750,7 @@ dwarf_select_sections_by_names (const ch - }; - - const char *p; -+ int result = 0; - - p = names; - while (*p) -@@ -11760,6 +11765,7 @@ dwarf_select_sections_by_names (const ch - && (p[len] == ',' || p[len] == '\0')) - { - * entry->variable = entry->val; -+ result |= entry->val; - - /* The --debug-dump=frames-interp option also - enables the --debug-dump=frames option. */ -@@ -11782,48 +11788,82 @@ dwarf_select_sections_by_names (const ch - if (*p == ',') - p++; - } -+ -+ return result; - } - --void -+/* Enable display of specific DWARF sections as determined by the characters -+ in LETTERS. Returns non-zero if any displaying was enabled. */ -+ -+int - dwarf_select_sections_by_letters (const char *letters) - { -- unsigned int lindex = 0; -+ typedef struct -+ { -+ const char letter; -+ int * variable; -+ int val; -+ bool cont; -+ } -+ debug_dump_letter_opts; - -- while (letters[lindex]) -- switch (letters[lindex++]) -- { -- case 'A': do_debug_addr = 1; break; -- case 'a': do_debug_abbrevs = 1; break; -- case 'c': do_debug_cu_index = 1; break; -+ static const debug_dump_letter_opts letter_table [] = -+ { -+ { 'A', & do_debug_addr, 1, false}, -+ { 'a', & do_debug_abbrevs, 1, false }, -+ { 'c', & do_debug_cu_index, 1, false }, - #ifdef HAVE_LIBDEBUGINFOD -- case 'D': use_debuginfod = 1; break; -- case 'E': use_debuginfod = 0; break; -+ { 'D', & use_debuginfod, 1, false }, -+ { 'E', & use_debuginfod, 0, false }, - #endif -- case 'F': do_debug_frames_interp = 1; /* Fall through. */ -- case 'f': do_debug_frames = 1; break; -- case 'g': do_gdb_index = 1; break; -- case 'i': do_debug_info = 1; break; -- case 'K': do_follow_links = 1; break; -- case 'N': do_follow_links = 0; break; -- case 'k': do_debug_links = 1; break; -- case 'l': do_debug_lines |= FLAG_DEBUG_LINES_RAW; break; -- case 'L': do_debug_lines |= FLAG_DEBUG_LINES_DECODED; break; -- case 'm': do_debug_macinfo = 1; break; -- case 'O': do_debug_str_offsets = 1; break; -- case 'o': do_debug_loc = 1; break; -- case 'p': do_debug_pubnames = 1; break; -- case 'R': do_debug_ranges = 1; break; -- case 'r': do_debug_aranges = 1; break; -- case 's': do_debug_str = 1; break; -- case 'T': do_trace_aranges = 1; break; -- case 't': do_debug_pubtypes = 1; break; -- case 'U': do_trace_info = 1; break; -- case 'u': do_trace_abbrevs = 1; break; -- -- default: -- warn (_("Unrecognized debug option '%s'\n"), letters); -- break; -- } -+ { 'F', & do_debug_frames_interp, 1, true }, /* Note the fall through. */ -+ { 'f', & do_debug_frames, 1, false }, -+ { 'g', & do_gdb_index, 1, false }, -+ { 'i', & do_debug_info, 1, false }, -+ { 'K', & do_follow_links, 1, false }, -+ { 'k', & do_debug_links, 1, false }, -+ { 'L', & do_debug_lines, FLAG_DEBUG_LINES_DECODED, false }, -+ { 'l', & do_debug_lines, FLAG_DEBUG_LINES_RAW, false }, -+ { 'm', & do_debug_macinfo, 1, false }, -+ { 'N', & do_follow_links, 0, false }, -+ { 'O', & do_debug_str_offsets, 1, false }, -+ { 'o', & do_debug_loc, 1, false }, -+ { 'p', & do_debug_pubnames, 1, false }, -+ { 'R', & do_debug_ranges, 1, false }, -+ { 'r', & do_debug_aranges, 1, false }, -+ { 's', & do_debug_str, 1, false }, -+ { 'T', & do_trace_aranges, 1, false }, -+ { 't', & do_debug_pubtypes, 1, false }, -+ { 'U', & do_trace_info, 1, false }, -+ { 'u', & do_trace_abbrevs, 1, false }, -+ { 0, NULL, 0, false } -+ }; -+ -+ int result = 0; -+ -+ while (* letters) -+ { -+ const debug_dump_letter_opts * entry; -+ -+ for (entry = letter_table; entry->letter; entry++) -+ { -+ if (entry->letter == * letters) -+ { -+ * entry->variable |= entry->val; -+ result |= entry->val; -+ -+ if (! entry->cont) -+ break; -+ } -+ } -+ -+ if (entry->letter == 0) -+ warn (_("Unrecognized debug letter option '%c'\n"), * letters); -+ -+ letters ++; -+ } -+ -+ return result; - } - - void -Only in binutils-2.38/binutils: dwarf.c.orig -diff -rup binutils.orig/binutils/dwarf.h binutils-2.38/binutils/dwarf.h ---- binutils.orig/binutils/dwarf.h 2022-05-20 16:57:16.565961366 +0100 -+++ binutils-2.38/binutils/dwarf.h 2022-05-20 16:57:32.880853694 +0100 -@@ -246,8 +246,8 @@ extern void *open_debug_file (const char - - extern void free_debug_memory (void); - --extern void dwarf_select_sections_by_names (const char *); --extern void dwarf_select_sections_by_letters (const char *); -+extern int dwarf_select_sections_by_names (const char *); -+extern int dwarf_select_sections_by_letters (const char *); - extern void dwarf_select_sections_all (void); - - extern unsigned int * find_cu_tu_set (void *, unsigned int); -Only in binutils-2.38/binutils: dwarf.h.orig -diff -rup binutils.orig/binutils/objdump.c binutils-2.38/binutils/objdump.c ---- binutils.orig/binutils/objdump.c 2022-05-20 16:57:16.566961359 +0100 -+++ binutils-2.38/binutils/objdump.c 2022-05-20 16:57:32.881853688 +0100 -@@ -5008,6 +5008,26 @@ sign_extend_address (bfd *abfd ATTRIBUTE - return (((vma & ((mask << 1) - 1)) ^ mask) - mask); - } - -+static bool -+might_need_separate_debug_info (bool is_mainfile) -+{ -+ /* We do not follow links from debug info files. */ -+ if (! is_mainfile) -+ return false; -+ -+ /* Since do_follow_links might be enabled by default, only treat it as an -+ indication that separate files should be loaded if setting it was a -+ deliberate user action. */ -+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links) -+ return true; -+ -+ if (process_links || dump_symtab || dump_debugging -+ || dump_dwarf_section_info) -+ return true; -+ -+ return false; -+} -+ - /* Dump selected contents of ABFD. */ - - static void -@@ -5022,16 +5042,8 @@ dump_bfd (bfd *abfd, bool is_mainfile) - else - byte_get = NULL; - -- /* Load any separate debug information files. -- We do this now and without checking do_follow_links because separate -- debug info files may contain symbol tables that we will need when -- displaying information about the main file. Any memory allocated by -- load_separate_debug_files will be released when we call -- free_debug_memory below. -- -- The test on is_mainfile is there because the chain of separate debug -- info files is a global variable shared by all invocations of dump_bfd. */ -- if (byte_get != NULL && is_mainfile) -+ /* Load any separate debug information files. */ -+ if (byte_get != NULL && might_need_separate_debug_info (is_mainfile)) - { - load_separate_debug_files (abfd, bfd_get_filename (abfd)); - -@@ -5593,20 +5605,30 @@ main (int argc, char **argv) - do_follow_links = true; - break; - case 'W': -- dump_dwarf_section_info = true; - seenflag = true; - if (optarg) -- dwarf_select_sections_by_letters (optarg); -+ { -+ if (dwarf_select_sections_by_letters (optarg)) -+ dump_dwarf_section_info = true; -+ } - else -- dwarf_select_sections_all (); -+ { -+ dump_dwarf_section_info = true; -+ dwarf_select_sections_all (); -+ } - break; - case OPTION_DWARF: -- dump_dwarf_section_info = true; - seenflag = true; - if (optarg) -- dwarf_select_sections_by_names (optarg); -+ { -+ if (dwarf_select_sections_by_names (optarg)) -+ dump_dwarf_section_info = true; -+ } - else -- dwarf_select_sections_all (); -+ { -+ dwarf_select_sections_all (); -+ dump_dwarf_section_info = true; -+ } - break; - case OPTION_DWARF_DEPTH: - { -Only in binutils-2.38/binutils: objdump.c.orig -diff -rup binutils.orig/binutils/readelf.c binutils-2.38/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2022-05-20 16:57:16.565961366 +0100 -+++ binutils-2.38/binutils/readelf.c 2022-05-20 16:57:32.883853675 +0100 -@@ -21900,6 +21900,26 @@ initialise_dump_sects (Filedata * fileda - } - } - -+static bool -+might_need_separate_debug_info (Filedata * filedata) -+{ -+ /* Debuginfo files do not need further separate file loading. */ -+ if (filedata->file_header.e_shstrndx == SHN_UNDEF) -+ return false; -+ -+ /* Since do_follow_links might be enabled by default, only treat it as an -+ indication that separate files should be loaded if setting it was a -+ deliberate user action. */ -+ if (DEFAULT_FOR_FOLLOW_LINKS == 0 && do_follow_links) -+ return true; -+ -+ if (process_links || do_syms || do_unwind -+ || do_dump || do_debugging) -+ return true; -+ -+ return false; -+} -+ - /* Process one ELF object file according to the command line options. - This file may actually be stored in an archive. The file is - positioned at the start of the ELF object. Returns TRUE if no -@@ -21983,7 +22003,7 @@ process_object (Filedata * filedata) - if (! process_version_sections (filedata)) - res = false; - -- if (filedata->file_header.e_shstrndx != SHN_UNDEF) -+ if (might_need_separate_debug_info (filedata)) - have_separate_files = load_separate_debug_files (filedata, filedata->file_name); - else - have_separate_files = false; -Only in binutils-2.38/binutils: readelf.c.orig -Only in binutils-2.38/binutils: readelf.c.rej -diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp ---- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-20 16:57:16.579961273 +0100 -+++ binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-05-20 16:57:32.883853675 +0100 -@@ -189,7 +189,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd - test_fetch_debugaltlink $OBJDUMP "-Wk" - - set test "disabling debuginfod access" -- setup_xfail *-*-* -+ # setup_xfail *-*-* - test_fetch_debuglink $OBJDUMP "-W -WE" - set test "debuginfod" - -@@ -202,7 +202,7 @@ if { [regexp ".*DEBUGINFOD.*" $conf_read - test_fetch_debugaltlink $READELF "-wk" - - set test "disabling debuginfod access" -- setup_xfail *-*-* -+ # setup_xfail *-*-* - test_fetch_debuglink $READELF "-w -wE" - set test "debuginfod" - -diff -rup binutils.orig/binutils/testsuite/binutils-all/objdump.Wk binutils-2.38/binutils/testsuite/binutils-all/objdump.Wk ---- binutils.orig/binutils/testsuite/binutils-all/objdump.Wk 2022-05-20 16:57:16.574961306 +0100 -+++ binutils-2.38/binutils/testsuite/binutils-all/objdump.Wk 2022-05-20 16:57:32.883853675 +0100 -@@ -1,8 +1,9 @@ -+#... - tmpdir/debuglink\.o: file format .* --Contents of the \.gnu_debuglink section: -+Contents of the \.gnu_debuglink section.* - Separate debug info file: this_is_a_debuglink\.debug - CRC value: 0x12345678 --Contents of the \.gnu_debugaltlink section: -+Contents of the \.gnu_debugaltlink section.* - Separate debug info file: linkdebug\.debug - Build-ID \(0x18 bytes\): - 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef -diff -rup binutils.orig/binutils/testsuite/binutils-all/readelf.k binutils-2.38/binutils/testsuite/binutils-all/readelf.k ---- binutils.orig/binutils/testsuite/binutils-all/readelf.k 2022-05-20 16:57:16.575961300 +0100 -+++ binutils-2.38/binutils/testsuite/binutils-all/readelf.k 2022-05-20 16:57:32.883853675 +0100 -@@ -1,7 +1,8 @@ --Contents of the \.gnu_debuglink section: -+#... -+Contents of the \.gnu_debuglink section.* - Separate debug info file: this_is_a_debuglink\.debug - CRC value: 0x12345678 --Contents of the \.gnu_debugaltlink section: -+Contents of the \.gnu_debugaltlink section.* - Separate debug info file: linkdebug\.debug - Build-ID \(0x18 bytes\): - 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 01 23 45 67 89 ab cd ef ---- binutils.ori/binutils/dwarf.c 2022-06-30 14:55:24.390992919 +0100 -+++ binutils-2.38/binutils/dwarf.c 2022-06-30 14:58:06.540908399 +0100 -@@ -11849,7 +11852,10 @@ dwarf_select_sections_by_letters (const - { - if (entry->letter == * letters) - { -- * entry->variable |= entry->val; -+ if (entry->val == 0) -+ * entry->variable = 0; -+ else -+ * entry->variable |= entry->val; - result |= entry->val; - - if (! entry->cont) diff --git a/binutils-package-metadata.patch b/binutils-package-metadata.patch index e54ae0f..d2925b0 100644 --- a/binutils-package-metadata.patch +++ b/binutils-package-metadata.patch @@ -1,55 +1,3 @@ -diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.38/bfd/elf-bfd.h ---- binutils.orig/bfd/elf-bfd.h 2022-08-04 11:11:01.755495353 +0100 -+++ binutils-2.38/bfd/elf-bfd.h 2022-08-04 11:11:09.149453165 +0100 -@@ -1917,6 +1917,14 @@ struct output_elf_obj_tdata - asection *sec; - } build_id; - -+ /* FDO_PACKAGING_METADATA note type info. */ -+ struct -+ { -+ bool (*after_write_object_contents) (bfd *); -+ const char *json; -+ asection *sec; -+ } package_metadata; -+ - /* Records the result of `get_program_header_size'. */ - bfd_size_type program_header_size; - -Only in binutils-2.38/bfd: elf-bfd.h.orig -diff -rup binutils.orig/bfd/elf.c binutils-2.38/bfd/elf.c ---- binutils.orig/bfd/elf.c 2022-08-04 11:11:01.771495262 +0100 -+++ binutils-2.38/bfd/elf.c 2022-08-04 11:11:09.150453159 +0100 -@@ -6762,8 +6762,12 @@ _bfd_elf_write_object_contents (bfd *abf - return false; - - /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */ -- if (t->o->build_id.after_write_object_contents != NULL) -- return (*t->o->build_id.after_write_object_contents) (abfd); -+ if (t->o->build_id.after_write_object_contents != NULL -+ && !(*t->o->build_id.after_write_object_contents) (abfd)) -+ return false; -+ if (t->o->package_metadata.after_write_object_contents != NULL -+ && !(*t->o->package_metadata.after_write_object_contents) (abfd)) -+ return false; - - return true; - } -Only in binutils-2.38/bfd: elf.c.orig -diff -rup binutils.orig/elfcpp/elfcpp.h binutils-2.38/elfcpp/elfcpp.h ---- binutils.orig/elfcpp/elfcpp.h 2022-08-04 11:11:00.940500003 +0100 -+++ binutils-2.38/elfcpp/elfcpp.h 2022-08-04 11:12:26.124013955 +0100 -@@ -999,7 +999,9 @@ enum - // string. - NT_GNU_GOLD_VERSION = 4, - // Program property note, as described in "Linux Extensions to the gABI". -- NT_GNU_PROPERTY_TYPE_0 = 5 -+ NT_GNU_PROPERTY_TYPE_0 = 5, -+ // FDO .note.package notes as defined on https://systemd.io/ELF_PACKAGE_METADATA/ -+ FDO_PACKAGING_METADATA = 0xcafe1a7e - }; - - // The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note. diff -rup binutils.orig/gold/Makefile.am binutils-2.38/gold/Makefile.am --- binutils.orig/gold/Makefile.am 2022-08-04 11:11:01.788495165 +0100 +++ binutils-2.38/gold/Makefile.am 2022-08-04 11:12:26.124013955 +0100 @@ -196,7 +144,6 @@ diff -rup binutils.orig/gold/layout.cc binutils-2.38/gold/layout.cc // If we have both .stabXX and .stabXXstr sections, then the sh_link // field of the former should point to the latter. I'm not sure who // started this, but the GNU linker does it, and some tools depend -Only in binutils-2.38/gold: layout.cc.orig diff -rup binutils.orig/gold/layout.h binutils-2.38/gold/layout.h --- binutils.orig/gold/layout.h 2022-08-04 11:11:01.788495165 +0100 +++ binutils-2.38/gold/layout.h 2022-08-04 11:12:26.125013949 +0100 @@ -234,800 +181,17 @@ diff -rup binutils.orig/gold/options.h binutils-2.38/gold/options.h DEFINE_bool(pie, options::ONE_DASH, '\0', false, N_("Create a position independent executable"), N_("Do not create a position independent executable")); -diff -rup binutils.orig/gold/testsuite/Makefile.am binutils-2.38/gold/testsuite/Makefile.am ---- binutils.orig/gold/testsuite/Makefile.am 2022-08-04 11:11:01.802495085 +0100 -+++ binutils-2.38/gold/testsuite/Makefile.am 2022-08-04 11:12:26.126013943 +0100 -@@ -149,25 +149,25 @@ check_PROGRAMS += object_unittest - object_unittest_SOURCES = object_unittest.cc - object_unittest_LDFLAGS = $(THREADFLAGS) - object_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ -- $(THREADLIBS) $(LIBDL) $(ZLIB) -+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS) - - check_PROGRAMS += binary_unittest - binary_unittest_SOURCES = binary_unittest.cc - binary_unittest_LDFLAGS = $(THREADFLAGS) - binary_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ -- $(THREADLIBS) $(LIBDL) $(ZLIB) -+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS) - - check_PROGRAMS += leb128_unittest - leb128_unittest_SOURCES = leb128_unittest.cc - leb128_unittest_LDFLAGS = $(THREADFLAGS) - leb128_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ -- $(THREADLIBS) $(LIBDL) $(ZLIB) -+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS) - - check_PROGRAMS += overflow_unittest - overflow_unittest_SOURCES = overflow_unittest.cc - overflow_unittest_LDFLAGS = $(THREADFLAGS) - overflow_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ -- $(THREADLIBS) $(LIBDL) $(ZLIB) -+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS) - overflow_unittest.o: overflow_unittest.cc - $(CXXCOMPILE) -O3 -c -o $@ $< - -@@ -4435,3 +4435,10 @@ retain_2.o: retain_2.s - $(TEST_AS) -o $@ $< - - endif DEFAULT_TARGET_X86_64 -+ -+check_PROGRAMS += package_metadata_test -+package_metadata_test.o: package_metadata_main.c -+ $(COMPILE) -c -o $@ $< -+package_metadata_test$(EXEEXT): package_metadata_test.o gcctestdir/ld -+ $(CXXLINK) package_metadata_test.o -Wl,--package-metadata='{"foo":"bar"}' -+ $(TEST_READELF) --notes $@ | grep -q '{"foo":"bar"}' -Only in binutils-2.38/gold/testsuite: package_metadata_main.c -diff -rup binutils.orig/ld/Makefile.am binutils-2.38/ld/Makefile.am ---- binutils.orig/ld/Makefile.am 2022-08-04 11:11:01.311497887 +0100 -+++ binutils-2.38/ld/Makefile.am 2022-08-04 11:11:09.150453159 +0100 -@@ -46,7 +46,7 @@ ELF_CLFAGS=-DELF_LIST_OPTIONS=@elf_list_ - -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ - WARN_CFLAGS = @WARN_CFLAGS@ - NO_WERROR = @NO_WERROR@ --AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) -+AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS) - - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR -@@ -973,8 +973,8 @@ ld_new_SOURCES = ldgram.y ldlex-wrapper. - ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c plugin.c \ - ldbuildid.c - ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) \ -- $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL_DEP) --ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL) $(ZLIB) -+ $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL_DEP) $(JANSSON_LIBS) -+ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL) $(ZLIB) $(JANSSON_LIBS) - - # Dependency tracking for the generated emulation files. - EXTRA_ld_new_SOURCES += $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES) -Only in binutils-2.38/ld: Makefile.am.orig -diff -rup binutils.orig/ld/Makefile.in binutils-2.38/ld/Makefile.in ---- binutils.orig/ld/Makefile.in 2022-08-04 11:11:01.310497892 +0100 -+++ binutils-2.38/ld/Makefile.in 2022-08-04 11:11:09.150453159 +0100 -@@ -122,6 +122,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../b - $(top_srcdir)/../config/lead-dot.m4 \ - $(top_srcdir)/../config/nls.m4 \ - $(top_srcdir)/../config/override.m4 \ -+ $(top_srcdir)/../config/pkg.m4 \ - $(top_srcdir)/../config/plugins.m4 \ - $(top_srcdir)/../config/po.m4 \ - $(top_srcdir)/../config/progtest.m4 \ -@@ -405,6 +406,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_SCRIPT = @INSTALL_SCRIPT@ - INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ - INSTOBJEXT = @INSTOBJEXT@ -+JANSSON_CFLAGS = @JANSSON_CFLAGS@ -+JANSSON_LIBS = @JANSSON_LIBS@ - LARGEFILE_CPPFLAGS = @LARGEFILE_CPPFLAGS@ - LD = @LD@ - LDFLAGS = @LDFLAGS@ -@@ -450,6 +453,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ -+PKG_CONFIG = @PKG_CONFIG@ -+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ - POSUB = @POSUB@ - RANLIB = @RANLIB@ - SED = @SED@ -@@ -558,7 +564,7 @@ ELF_CLFAGS = -DELF_LIST_OPTIONS=@elf_lis - -DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \ - -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ - --AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) -+AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS) - - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR -@@ -1010,9 +1016,9 @@ ld_new_SOURCES = ldgram.y ldlex-wrapper. - ldbuildid.c - - ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) \ -- $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL_DEP) -+ $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL_DEP) $(JANSSON_LIBS) - --ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL) $(ZLIB) -+ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL) $(ZLIB) $(JANSSON_LIBS) - # - # - # Build a dummy plugin using libtool. -Only in binutils-2.38/ld: Makefile.in.orig -diff -rup binutils.orig/ld/NEWS binutils-2.38/ld/NEWS ---- binutils.orig/ld/NEWS 2022-08-04 11:11:01.323497818 +0100 -+++ binutils-2.38/ld/NEWS 2022-08-04 11:11:09.150453159 +0100 -@@ -3,6 +3,12 @@ - * TYPE= is now supported in an output section description to set the - section type value. - -+* The ELF linker now supports a new --package-metadata option that allows -+ embedding a JSON payload in accordance to the Package Metadata specification. -+ If support for libjansson is enabled at build time, the linker will use it to -+ validate the input. This can be enabled with --enable-jansson. -+ For more details, see: https://systemd.io/ELF_PACKAGE_METADATA/ -+ - Changes in 2.38: - - * Add -z pack-relative-relocs/-z no pack-relative-relocs to x86 ELF -Only in binutils-2.38/ld: NEWS.orig -diff -rup binutils.orig/ld/aclocal.m4 binutils-2.38/ld/aclocal.m4 ---- binutils.orig/ld/aclocal.m4 2022-08-04 11:11:01.024499524 +0100 -+++ binutils-2.38/ld/aclocal.m4 2022-08-04 11:11:09.150453159 +0100 -@@ -1198,6 +1198,7 @@ m4_include([../config/lcmessage.m4]) - m4_include([../config/lead-dot.m4]) - m4_include([../config/nls.m4]) - m4_include([../config/override.m4]) -+m4_include([../config/pkg.m4]) - m4_include([../config/plugins.m4]) - m4_include([../config/po.m4]) - m4_include([../config/progtest.m4]) -diff -rup binutils.orig/ld/config.in binutils-2.38/ld/config.in ---- binutils.orig/ld/config.in 2022-08-04 11:11:01.023499530 +0100 -+++ binutils-2.38/ld/config.in 2022-08-04 11:11:09.151453154 +0100 -@@ -88,6 +88,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_INTTYPES_H - -+/* The jansson library is to be used */ -+#undef HAVE_JANSSON -+ - /* Define if your file defines LC_MESSAGES. */ - #undef HAVE_LC_MESSAGES - -Only in binutils-2.38/ld: config.in.orig -diff -rup binutils.orig/ld/configure binutils-2.38/ld/configure ---- binutils.orig/ld/configure 2022-08-04 11:11:01.023499530 +0100 -+++ binutils-2.38/ld/configure 2022-08-04 11:11:09.153453142 +0100 -@@ -677,6 +677,11 @@ WARN_WRITE_STRINGS - NO_WERROR - WARN_CFLAGS_FOR_BUILD - WARN_CFLAGS -+JANSSON_LIBS -+JANSSON_CFLAGS -+PKG_CONFIG_LIBDIR -+PKG_CONFIG_PATH -+PKG_CONFIG - enable_libctf - ENABLE_LIBCTF_FALSE - ENABLE_LIBCTF_TRUE -@@ -842,6 +847,7 @@ enable_error_handling_script - enable_default_hash_style - enable_initfini_array - enable_libctf -+enable_jansson - enable_werror - enable_build_warnings - enable_nls -@@ -860,6 +866,11 @@ CXXFLAGS - CCC - CPP - CXXCPP -+PKG_CONFIG -+PKG_CONFIG_PATH -+PKG_CONFIG_LIBDIR -+JANSSON_CFLAGS -+JANSSON_LIBS - YACC - YFLAGS' - -@@ -1517,6 +1528,7 @@ Optional Features: - use this default hash style - --disable-initfini-array do not use .init_array/.fini_array sections - --enable-libctf Handle .ctf type-info sections [default=yes] -+ --enable-jansson enable jansson [default=no] - --enable-werror treat compile warnings as errors - --enable-build-warnings enable build-time compiler warnings - --disable-nls do not use Native Language Support -@@ -1543,6 +1555,15 @@ Some influential environment variables: - CXXFLAGS C++ compiler flags - CPP C preprocessor - CXXCPP C++ preprocessor -+ PKG_CONFIG path to pkg-config utility -+ PKG_CONFIG_PATH -+ directories to add to pkg-config's search path -+ PKG_CONFIG_LIBDIR -+ path overriding pkg-config's built-in search path -+ JANSSON_CFLAGS -+ C compiler flags for JANSSON, overriding pkg-config -+ JANSSON_LIBS -+ linker flags for JANSSON, overriding pkg-config - YACC The `Yet Another Compiler Compiler' implementation to use. - Defaults to the first program found out of: `bison -y', `byacc', - `yacc'. -@@ -15529,6 +15550,251 @@ fi - - - -+# Used to validate --package-metadata= input. Disabled by default. -+# Check whether --enable-jansson was given. -+if test "${enable_jansson+set}" = set; then : -+ enableval=$enable_jansson; enable_jansson=$enableval -+else -+ enable_jansson="no" -+fi -+ -+ -+if test "x$enable_jansson" != "xno"; then -+ -+ -+ -+ -+ -+ -+ -+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then -+ if test -n "$ac_tool_prefix"; then -+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -+$as_echo_n "checking for $ac_word... " >&6; } -+if ${ac_cv_path_PKG_CONFIG+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ case $PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+ done -+IFS=$as_save_IFS -+ -+ ;; -+esac -+fi -+PKG_CONFIG=$ac_cv_path_PKG_CONFIG -+if test -n "$PKG_CONFIG"; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -+$as_echo "$PKG_CONFIG" >&6; } -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+fi -+ -+ -+fi -+if test -z "$ac_cv_path_PKG_CONFIG"; then -+ ac_pt_PKG_CONFIG=$PKG_CONFIG -+ # Extract the first word of "pkg-config", so it can be a program name with args. -+set dummy pkg-config; ac_word=$2 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -+$as_echo_n "checking for $ac_word... " >&6; } -+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ case $ac_pt_PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+ done -+IFS=$as_save_IFS -+ -+ ;; -+esac -+fi -+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -+if test -n "$ac_pt_PKG_CONFIG"; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -+$as_echo "$ac_pt_PKG_CONFIG" >&6; } -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+fi -+ -+ if test "x$ac_pt_PKG_CONFIG" = x; then -+ PKG_CONFIG="" -+ else -+ case $cross_compiling:$ac_tool_warned in -+yes:) -+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -+ac_tool_warned=yes ;; -+esac -+ PKG_CONFIG=$ac_pt_PKG_CONFIG -+ fi -+else -+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -+fi -+ -+fi -+if test -n "$PKG_CONFIG"; then -+ _pkg_min_version=0.9.0 -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } -+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; } -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ PKG_CONFIG="" -+ fi -+fi -+ if test -n "$PKG_CONFIG"; then : -+ -+ -+pkg_failed=no -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jansson" >&5 -+$as_echo_n "checking for jansson... " >&6; } -+ -+if test -n "$JANSSON_CFLAGS"; then -+ pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS" -+ elif test -n "$PKG_CONFIG"; then -+ if test -n "$PKG_CONFIG" && \ -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5 -+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5 -+ ac_status=$? -+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -+ test $ac_status = 0; }; then -+ pkg_cv_JANSSON_CFLAGS=`$PKG_CONFIG --cflags "jansson" 2>/dev/null` -+ test "x$?" != "x0" && pkg_failed=yes -+else -+ pkg_failed=yes -+fi -+ else -+ pkg_failed=untried -+fi -+if test -n "$JANSSON_LIBS"; then -+ pkg_cv_JANSSON_LIBS="$JANSSON_LIBS" -+ elif test -n "$PKG_CONFIG"; then -+ if test -n "$PKG_CONFIG" && \ -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson\""; } >&5 -+ ($PKG_CONFIG --exists --print-errors "jansson") 2>&5 -+ ac_status=$? -+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -+ test $ac_status = 0; }; then -+ pkg_cv_JANSSON_LIBS=`$PKG_CONFIG --libs "jansson" 2>/dev/null` -+ test "x$?" != "x0" && pkg_failed=yes -+else -+ pkg_failed=yes -+fi -+ else -+ pkg_failed=untried -+fi -+ -+if test $pkg_failed = no; then -+ pkg_save_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS $pkg_cv_JANSSON_LIBS" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_link "$LINENO"; then : -+ -+else -+ pkg_failed=yes -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS=$pkg_save_LDFLAGS -+fi -+ -+ -+ -+if test $pkg_failed = yes; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ -+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then -+ _pkg_short_errors_supported=yes -+else -+ _pkg_short_errors_supported=no -+fi -+ if test $_pkg_short_errors_supported = yes; then -+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson" 2>&1` -+ else -+ JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson" 2>&1` -+ fi -+ # Put the nasty error message in config.log where it belongs -+ echo "$JANSSON_PKG_ERRORS" >&5 -+ -+ -+ as_fn_error $? "Cannot find jansson library" "$LINENO" 5 -+ -+elif test $pkg_failed = untried; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+ -+ as_fn_error $? "Cannot find jansson library" "$LINENO" 5 -+ -+else -+ JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS -+ JANSSON_LIBS=$pkg_cv_JANSSON_LIBS -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; } -+ -+ -+$as_echo "#define HAVE_JANSSON 1" >>confdefs.h -+ -+ -+ -+ -+fi -+ -+else -+ -+ as_fn_error $? "Cannot find pkg-config" "$LINENO" 5 -+ -+fi -+fi -+ - - # Set the 'development' global. - . $srcdir/../bfd/development.sh -diff -rup binutils.orig/ld/configure.ac binutils-2.38/ld/configure.ac ---- binutils.orig/ld/configure.ac 2022-08-04 11:11:01.323497818 +0100 -+++ binutils-2.38/ld/configure.ac 2022-08-04 11:11:09.153453142 +0100 -@@ -258,6 +258,32 @@ fi - AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes) - AC_SUBST(enable_libctf) - -+# Used to validate --package-metadata= input. Disabled by default. -+AC_ARG_ENABLE([jansson], -+ [AS_HELP_STRING([--enable-jansson], -+ [enable jansson [default=no]])], -+ [enable_jansson=$enableval], -+ [enable_jansson="no"]) -+ -+if test "x$enable_jansson" != "xno"; then -+ PKG_PROG_PKG_CONFIG -+ AS_IF([test -n "$PKG_CONFIG"], -+ [ -+ PKG_CHECK_MODULES(JANSSON, [jansson], -+ [ -+ AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used]) -+ AC_SUBST([JANSSON_CFLAGS]) -+ AC_SUBST([JANSSON_LIBS]) -+ ], -+ [ -+ AC_MSG_ERROR([Cannot find jansson library]) -+ ]) -+ ], -+ [ -+ AC_MSG_ERROR([Cannot find pkg-config]) -+ ]) -+fi -+ - AM_BINUTILS_WARNINGS - - AM_LC_MESSAGES -Only in binutils-2.38/ld: configure.ac.orig -Only in binutils-2.38/ld: configure.orig -Only in binutils-2.38/ld: configure.rej -diff -rup binutils.orig/ld/emultempl/elf.em binutils-2.38/ld/emultempl/elf.em ---- binutils.orig/ld/emultempl/elf.em 2022-08-04 11:11:01.027499507 +0100 -+++ binutils-2.38/ld/emultempl/elf.em 2022-08-04 11:11:09.153453142 +0100 -@@ -556,6 +556,7 @@ enum elf_options - OPTION_EXCLUDE_LIBS, - OPTION_HASH_STYLE, - OPTION_BUILD_ID, -+ OPTION_PACKAGE_METADATA, - OPTION_AUDIT, - OPTION_COMPRESS_DEBUG +diff -rup binutils.orig/elfcpp/elfcpp.h binutils-2.38/elfcpp/elfcpp.h +--- binutils.orig/elfcpp/elfcpp.h 2022-08-04 11:11:00.940500003 +0100 ++++ binutils-2.38/elfcpp/elfcpp.h 2022-08-04 11:12:26.124013955 +0100 +@@ -999,7 +999,9 @@ enum + // string. + NT_GNU_GOLD_VERSION = 4, + // Program property note, as described in "Linux Extensions to the gABI". +- NT_GNU_PROPERTY_TYPE_0 = 5 ++ NT_GNU_PROPERTY_TYPE_0 = 5, ++ // FDO .note.package notes as defined on https://systemd.io/ELF_PACKAGE_METADATA/ ++ FDO_PACKAGING_METADATA = 0xcafe1a7e }; -@@ -586,6 +587,7 @@ EOF - fi - fragment < 0) -+ ldelf_emit_note_fdo_package_metadata = xstrdup (optarg); -+ break; -+ - case OPTION_COMPRESS_DEBUG: - if (strcasecmp (optarg, "none") == 0) - link_info.compress_debug = COMPRESS_DEBUG_NONE; -Only in binutils-2.38/ld/emultempl: elf.em.orig -diff -rup binutils.orig/ld/ld.texi binutils-2.38/ld/ld.texi ---- binutils.orig/ld/ld.texi 2022-08-04 11:11:01.311497887 +0100 -+++ binutils-2.38/ld/ld.texi 2022-08-04 11:11:09.154453136 +0100 -@@ -2892,6 +2892,18 @@ string identifying the original linked f - - Passing @code{none} for @var{style} disables the setting from any - @code{--build-id} options earlier on the command line. -+ -+@kindex --package-metadata=@var{JSON} -+@item --package-metadata=@var{JSON} -+Request the creation of a @code{.note.package} ELF note section. The -+contents of the note are in JSON format, as per the package metadata -+specification. For more information see: -+https://systemd.io/ELF_PACKAGE_METADATA/ -+If the JSON argument is missing/empty then this will disable the -+creation of the metadata note, if one had been enabled by an earlier -+occurrence of the --package-metdata option. -+If the linker has been built with libjansson, then the JSON string -+will be validated. - @end table - - @c man end -Only in binutils-2.38/ld: ld.texi.orig -diff -rup binutils.orig/ld/ldelf.c binutils-2.38/ld/ldelf.c ---- binutils.orig/ld/ldelf.c 2022-08-04 11:11:01.311497887 +0100 -+++ binutils-2.38/ld/ldelf.c 2022-08-04 11:11:09.154453136 +0100 -@@ -39,6 +39,9 @@ - #include - #endif - #include "ldelf.h" -+#ifdef HAVE_JANSSON -+#include -+#endif - - struct dt_needed - { -@@ -49,6 +52,9 @@ struct dt_needed - /* Style of .note.gnu.build-id section. */ - const char *ldelf_emit_note_gnu_build_id; - -+/* Content of .note.package section. */ -+const char *ldelf_emit_note_fdo_package_metadata; -+ - /* These variables are required to pass information back and forth - between after_open and check_needed and stat_needed and vercheck. */ - -@@ -1037,7 +1043,8 @@ ldelf_after_open (int use_libpath, int n - } - } - -- if (ldelf_emit_note_gnu_build_id != NULL) -+ if (ldelf_emit_note_gnu_build_id != NULL -+ || ldelf_emit_note_fdo_package_metadata != NULL) - { - /* Find an ELF input. */ - for (abfd = link_info.input_bfds; -@@ -1050,11 +1057,20 @@ ldelf_after_open (int use_libpath, int n - /* PR 10555: If there are no ELF input files do not try to - create a .note.gnu-build-id section. */ - if (abfd == NULL -- || !ldelf_setup_build_id (abfd)) -+ || (ldelf_emit_note_gnu_build_id != NULL -+ && !ldelf_setup_build_id (abfd))) - { - free ((char *) ldelf_emit_note_gnu_build_id); - ldelf_emit_note_gnu_build_id = NULL; - } -+ -+ if (abfd == NULL -+ || (ldelf_emit_note_fdo_package_metadata != NULL -+ && !ldelf_setup_package_metadata (abfd))) -+ { -+ free ((char *) ldelf_emit_note_fdo_package_metadata); -+ ldelf_emit_note_fdo_package_metadata = NULL; -+ } - } - - get_elf_backend_data (link_info.output_bfd)->setup_gnu_properties (&link_info); -@@ -1466,6 +1482,121 @@ ldelf_setup_build_id (bfd *ibfd) - return false; - } - -+static bool -+write_package_metadata (bfd *abfd) -+{ -+ struct elf_obj_tdata *t = elf_tdata (abfd); -+ const char *json; -+ asection *asec; -+ Elf_Internal_Shdr *i_shdr; -+ unsigned char *contents, *json_bits; -+ bfd_size_type size; -+ file_ptr position; -+ Elf_External_Note *e_note; -+ -+ json = t->o->package_metadata.json; -+ asec = t->o->package_metadata.sec; -+ if (bfd_is_abs_section (asec->output_section)) -+ { -+ einfo (_("%P: warning: .note.package section discarded," -+ " --package-metadata ignored\n")); -+ return true; -+ } -+ i_shdr = &elf_section_data (asec->output_section)->this_hdr; -+ -+ if (i_shdr->contents == NULL) -+ { -+ if (asec->contents == NULL) -+ asec->contents = (unsigned char *) xmalloc (asec->size); -+ contents = asec->contents; -+ } -+ else -+ contents = i_shdr->contents + asec->output_offset; -+ -+ e_note = (Elf_External_Note *) contents; -+ size = offsetof (Elf_External_Note, name[sizeof "FDO"]); -+ size = (size + 3) & -(bfd_size_type) 4; -+ json_bits = contents + size; -+ size = asec->size - size; -+ -+ /* Clear the package metadata field. */ -+ memset (json_bits, 0, size); -+ -+ bfd_h_put_32 (abfd, sizeof "FDO", &e_note->namesz); -+ bfd_h_put_32 (abfd, size, &e_note->descsz); -+ bfd_h_put_32 (abfd, FDO_PACKAGING_METADATA, &e_note->type); -+ memcpy (e_note->name, "FDO", sizeof "FDO"); -+ memcpy (json_bits, json, strlen(json)); -+ -+ position = i_shdr->sh_offset + asec->output_offset; -+ size = asec->size; -+ return (bfd_seek (abfd, position, SEEK_SET) == 0 -+ && bfd_bwrite (contents, size, abfd) == size); -+} -+ -+/* Make .note.package section. -+ https://systemd.io/ELF_PACKAGE_METADATA/ */ -+ -+bool -+ldelf_setup_package_metadata (bfd *ibfd) -+{ -+ asection *s; -+ bfd_size_type size; -+ size_t json_length; -+ flagword flags; -+ -+ /* If the option wasn't specified, silently return. */ -+ if (!ldelf_emit_note_fdo_package_metadata) -+ return false; -+ -+ /* The option was specified, but it's empty, log and return. */ -+ json_length = strlen (ldelf_emit_note_fdo_package_metadata); -+ if (json_length == 0) -+ { -+ einfo (_("%P: warning: --package-metadata is empty, ignoring\n")); -+ return false; -+ } -+ -+#ifdef HAVE_JANSSON -+ json_error_t json_error; -+ json_t *json = json_loads (ldelf_emit_note_fdo_package_metadata, -+ 0, &json_error); -+ if (!json) -+ { -+ einfo (_("%P: warning: --package-metadata=%s does not contain valid " -+ "JSON, ignoring: %s\n"), -+ ldelf_emit_note_fdo_package_metadata, json_error.text); -+ return false; -+ } -+ else -+ json_decref (json); -+#endif -+ -+ size = offsetof (Elf_External_Note, name[sizeof "FDO"]); -+ size += json_length + 1; -+ size = (size + 3) & -(bfd_size_type) 4; -+ -+ flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY -+ | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA); -+ s = bfd_make_section_anyway_with_flags (ibfd, ".note.package", -+ flags); -+ if (s != NULL && bfd_set_section_alignment (s, 2)) -+ { -+ struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd); -+ t->o->package_metadata.after_write_object_contents -+ = &write_package_metadata; -+ t->o->package_metadata.json = ldelf_emit_note_fdo_package_metadata; -+ t->o->package_metadata.sec = s; -+ elf_section_type (s) = SHT_NOTE; -+ s->size = size; -+ return true; -+ } -+ -+ einfo (_("%P: warning: cannot create .note.package section," -+ " --package-metadata ignored\n")); -+ return false; -+} -+ - /* Look through an expression for an assignment statement. */ - - static void -Only in binutils-2.38/ld: ldelf.c.orig -diff -rup binutils.orig/ld/ldelf.h binutils-2.38/ld/ldelf.h ---- binutils.orig/ld/ldelf.h 2022-08-04 11:11:01.026499513 +0100 -+++ binutils-2.38/ld/ldelf.h 2022-08-04 11:11:09.154453136 +0100 -@@ -19,11 +19,13 @@ - MA 02110-1301, USA. */ - - extern const char *ldelf_emit_note_gnu_build_id; -+extern const char *ldelf_emit_note_fdo_package_metadata; - - extern void ldelf_after_parse (void); - extern bool ldelf_load_symbols (lang_input_statement_type *); - extern void ldelf_after_open (int, int, int, int, int, const char *); - extern bool ldelf_setup_build_id (bfd *); -+extern bool ldelf_setup_package_metadata (bfd *); - extern void ldelf_append_to_separated_string (char **, char *); - extern void ldelf_before_allocation (char *, char *, const char *); - extern bool ldelf_open_dynamic_archive -Only in binutils-2.38/ld: ldelf.h.orig -diff -rup binutils.orig/ld/lexsup.c binutils-2.38/ld/lexsup.c ---- binutils.orig/ld/lexsup.c 2022-08-04 11:11:01.024499524 +0100 -+++ binutils-2.38/ld/lexsup.c 2022-08-04 11:11:09.154453136 +0100 -@@ -2124,6 +2124,8 @@ elf_static_list_options (FILE *file) - fprintf (file, _("\ - --build-id[=STYLE] Generate build ID note\n")); - fprintf (file, _("\ -+ --package-metadata[=JSON] Generate package metadata note\n")); -+ fprintf (file, _("\ - --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]\n\ - Compress DWARF debug sections using zlib\n")); - #ifdef DEFAULT_FLAG_COMPRESS_DEBUG -Only in binutils-2.38/ld: lexsup.c.orig -diff -rup binutils.orig/ld/testsuite/ld-bootstrap/bootstrap.exp binutils-2.38/ld/testsuite/ld-bootstrap/bootstrap.exp ---- binutils.orig/ld/testsuite/ld-bootstrap/bootstrap.exp 2022-08-04 11:11:01.063499301 +0100 -+++ binutils-2.38/ld/testsuite/ld-bootstrap/bootstrap.exp 2022-08-04 11:11:09.154453136 +0100 -@@ -155,6 +155,12 @@ foreach flags $test_flags { - set extralibs "$extralibs -lz" - } - -+ # Check if the system's jansson library is used. If so, the object files will -+ # be using symbols from it, so link to it. -+ if { [lindex [remote_exec build grep "-q \"HAVE_JANSSON 1\" config.h" ] 0] == 0 } then { -+ set extralibs "$extralibs -ljansson" -+ } -+ - # Plugin support requires linking with libdl. - if { $plugins == "yes" } { - if { ![istarget "*-*-freebsd*"]} { -Only in binutils-2.38/ld/testsuite/ld-elf: package-note.exp -Only in binutils-2.38/ld/testsuite/ld-elf: package-note.rd + // The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note. diff --git a/binutils-ppc-gas-machine-directive.patch b/binutils-ppc-gas-machine-directive.patch deleted file mode 100644 index 4211d39..0000000 --- a/binutils-ppc-gas-machine-directive.patch +++ /dev/null @@ -1,52 +0,0 @@ -From cebc89b9328eab994f6b0314c263f94e7949a553 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Mon, 21 Feb 2022 10:58:57 +1030 -Subject: [PATCH] binutils 2.38 vs. ppc32 linux kernel - -Commit b25f942e18d6 made .machine more strict. Weaken it again. - - * config/tc-ppc.c (ppc_machine): Treat an early .machine specially, - keeping sticky options to work around gcc bugs. ---- - gas/config/tc-ppc.c | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c -index 054f9c72161..89bc7d3f9b9 100644 ---- a/gas/config/tc-ppc.c -+++ b/gas/config/tc-ppc.c -@@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED) - options do not count as a new machine, instead they add - to currently selected opcodes. */ - ppc_cpu_t machine_sticky = 0; -- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string); -+ /* Unfortunately, some versions of gcc emit a .machine -+ directive very near the start of the compiler's assembly -+ output file. This is bad because it overrides user -Wa -+ cpu selection. Worse, there are versions of gcc that -+ emit the *wrong* cpu, not even respecting the -mcpu given -+ to gcc. See gcc pr101393. And to compound the problem, -+ as of 20220222 gcc doesn't pass the correct cpu option to -+ gas on the command line. See gcc pr59828. Hack around -+ this by keeping sticky options for an early .machine. */ -+ asection *sec; -+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next) -+ { -+ segment_info_type *info = seg_info (sec); -+ /* Are the frags for this section perturbed from their -+ initial state? Even .align will count here. */ -+ if (info != NULL -+ && (info->frchainP->frch_root != info->frchainP->frch_last -+ || info->frchainP->frch_root->fr_type != rs_fill -+ || info->frchainP->frch_root->fr_fix != 0)) -+ break; -+ } -+ new_cpu = ppc_parse_cpu (ppc_cpu, -+ sec == NULL ? &sticky : &machine_sticky, -+ cpu_string); - if (new_cpu != 0) - ppc_cpu = new_cpu; - else --- -2.37.1 - diff --git a/binutils-ppc64-DT_RELR-relocs.patch b/binutils-ppc64-DT_RELR-relocs.patch deleted file mode 100644 index b7eca2b..0000000 --- a/binutils-ppc64-DT_RELR-relocs.patch +++ /dev/null @@ -1,266 +0,0 @@ ---- binutils.orig/bfd/elf64-ppc.c 2022-06-13 12:05:13.325289568 +0100 -+++ binutils-2.38/bfd/elf64-ppc.c 2022-06-13 12:05:36.080143584 +0100 -@@ -3270,10 +3270,14 @@ struct ppc_link_hash_table - /* The size of reliplt used by got entry relocs. */ - bfd_size_type got_reli_size; - -- /* DT_RELR array of r_offset. */ -+ /* DT_RELR array of section/r_offset. */ - size_t relr_alloc; - size_t relr_count; -- bfd_vma *relr_addr; -+ struct -+ { -+ asection *sec; -+ bfd_vma off; -+ } *relr; - - /* Statistics. */ - unsigned long stub_count[ppc_stub_save_res]; -@@ -13419,16 +13423,11 @@ maybe_strip_output (struct bfd_link_info - } - } - --static int --compare_relr_address (const void *arg1, const void *arg2) --{ -- bfd_vma a = *(bfd_vma *) arg1; -- bfd_vma b = *(bfd_vma *) arg2; -- return a < b ? -1 : a > b ? 1 : 0; --} -+/* Stash R_PPC64_RELATIVE reloc at input section SEC, r_offset OFF to -+ the array of such relocs. */ - - static bool --append_relr_off (struct ppc_link_hash_table *htab, bfd_vma off) -+append_relr_off (struct ppc_link_hash_table *htab, asection *sec, bfd_vma off) - { - if (htab->relr_count >= htab->relr_alloc) - { -@@ -13436,16 +13435,51 @@ append_relr_off (struct ppc_link_hash_ta - htab->relr_alloc = 4096; - else - htab->relr_alloc *= 2; -- htab->relr_addr -- = bfd_realloc (htab->relr_addr, -- htab->relr_alloc * sizeof (htab->relr_addr[0])); -- if (htab->relr_addr == NULL) -+ htab->relr = bfd_realloc (htab->relr, -+ htab->relr_alloc * sizeof (*htab->relr)); -+ if (htab->relr == NULL) - return false; - } -- htab->relr_addr[htab->relr_count++] = off; -+ htab->relr[htab->relr_count].sec = sec; -+ htab->relr[htab->relr_count].off = off; -+ htab->relr_count++; - return true; - } - -+/* qsort comparator for bfd_vma args. */ -+ -+static int -+compare_relr_address (const void *arg1, const void *arg2) -+{ -+ bfd_vma a = *(bfd_vma *) arg1; -+ bfd_vma b = *(bfd_vma *) arg2; -+ return a < b ? -1 : a > b ? 1 : 0; -+} -+ -+/* Produce a malloc'd sorted array of reloc addresses from the info -+ stored by append_relr_off. */ -+ -+static bfd_vma * -+sort_relr (struct ppc_link_hash_table *htab) -+{ -+ bfd_vma *addr = bfd_malloc (htab->relr_count * sizeof (*addr)); -+ if (addr == NULL) -+ return NULL; -+ -+ for (size_t i = 0; i < htab->relr_count; i++) -+ addr[i] = (htab->relr[i].sec->output_section->vma -+ + htab->relr[i].sec->output_offset -+ + htab->relr[i].off); -+ -+ if (htab->relr_count > 1) -+ qsort (addr, htab->relr_count, sizeof (*addr), compare_relr_address); -+ -+ return addr; -+} -+ -+/* Look over GOT and PLT entries saved on elf_local_got_ents for all -+ input files, stashing info about needed relative relocs. */ -+ - static bool - got_and_plt_relr_for_local_syms (struct bfd_link_info *info) - { -@@ -13493,10 +13527,7 @@ got_and_plt_relr_for_local_syms (struct - && isym->st_shndx != SHN_ABS) - { - asection *got = ppc64_elf_tdata (gent->owner)->got; -- bfd_vma r_offset = (got->output_section->vma -- + got->output_offset -- + gent->got.offset); -- if (!append_relr_off (htab, r_offset)) -+ if (!append_relr_off (htab, got, gent->got.offset)) - { - htab->stub_error = true; - return false; -@@ -13511,10 +13542,7 @@ got_and_plt_relr_for_local_syms (struct - if (pent->plt.offset != (bfd_vma) -1 - && ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC) - { -- bfd_vma r_offset = (pent->plt.offset -- + htab->pltlocal->output_offset -- + htab->pltlocal->output_section->vma); -- if (!append_relr_off (htab, r_offset)) -+ if (!append_relr_off (htab, htab->pltlocal, pent->plt.offset)) - { - if (symtab_hdr->contents != (unsigned char *) local_syms) - free (local_syms); -@@ -13534,6 +13562,9 @@ got_and_plt_relr_for_local_syms (struct - return true; - } - -+/* Stash info about needed GOT and PLT entry relative relocs for -+ global symbol H. */ -+ - static bool - got_and_plt_relr (struct elf_link_hash_entry *h, void *inf) - { -@@ -13565,10 +13596,7 @@ got_and_plt_relr (struct elf_link_hash_e - && gent->got.offset != (bfd_vma) -1) - { - asection *got = ppc64_elf_tdata (gent->owner)->got; -- bfd_vma r_offset = (got->output_section->vma -- + got->output_offset -- + gent->got.offset); -- if (!append_relr_off (htab, r_offset)) -+ if (!append_relr_off (htab, got, gent->got.offset)) - { - htab->stub_error = true; - return false; -@@ -13580,10 +13608,7 @@ got_and_plt_relr (struct elf_link_hash_e - for (pent = h->plt.plist; pent != NULL; pent = pent->next) - if (pent->plt.offset != (bfd_vma) -1) - { -- bfd_vma r_offset = (htab->pltlocal->output_section->vma -- + htab->pltlocal->output_offset -- + pent->plt.offset); -- if (!append_relr_off (htab, r_offset)) -+ if (!append_relr_off (htab, htab->pltlocal, pent->plt.offset)) - { - htab->stub_error = true; - return false; -@@ -13861,9 +13886,7 @@ ppc64_elf_size_stubs (struct bfd_link_in - irela->r_offset); - if (r_offset >= (bfd_vma) -2) - continue; -- r_offset += (section->output_section->vma -- + section->output_offset); -- if (!append_relr_off (htab, r_offset)) -+ if (!append_relr_off (htab, section, r_offset)) - goto error_ret_free_internal; - continue; - } -@@ -14214,9 +14237,7 @@ ppc64_elf_size_stubs (struct bfd_link_in - bfd_vma r_offset; - - for (r_offset = 0; r_offset < htab->brlt->size; r_offset += 8) -- if (!append_relr_off (htab, (r_offset -- + htab->brlt->output_section->vma -- + htab->brlt->output_offset))) -+ if (!append_relr_off (htab, htab->brlt, r_offset)) - return false; - - if (!got_and_plt_relr_for_local_syms (info)) -@@ -14225,28 +14246,28 @@ ppc64_elf_size_stubs (struct bfd_link_in - if (htab->stub_error) - return false; - -- if (htab->relr_count > 1) -- qsort (htab->relr_addr, htab->relr_count, sizeof (*htab->relr_addr), -- compare_relr_address); -+ bfd_vma *relr_addr = sort_relr (htab); -+ if (htab->relr_count != 0 && relr_addr == NULL) -+ return false; - - size_t i = 0; - while (i < htab->relr_count) - { -- bfd_vma base = htab->relr_addr[i]; -+ bfd_vma base = relr_addr[i]; - htab->elf.srelrdyn->size += 8; - i++; - /* Handle possible duplicate address. This can happen - as sections increase in size when adding stubs. */ - while (i < htab->relr_count -- && htab->relr_addr[i] == base) -+ && relr_addr[i] == base) - i++; - base += 8; - while (1) - { - size_t start_i = i; - while (i < htab->relr_count -- && htab->relr_addr[i] - base < 63 * 8 -- && (htab->relr_addr[i] - base) % 8 == 0) -+ && relr_addr[i] - base < 63 * 8 -+ && (relr_addr[i] - base) % 8 == 0) - i++; - if (i == start_i) - break; -@@ -14254,6 +14275,7 @@ ppc64_elf_size_stubs (struct bfd_link_in - base += 63 * 8; - } - } -+ free (relr_addr); - } - - for (group = htab->group; group != NULL; group = group->next) -@@ -15193,17 +15215,21 @@ ppc64_elf_build_stubs (struct bfd_link_i - if (htab->elf.srelrdyn->contents == NULL) - return false; - -+ bfd_vma *relr_addr = sort_relr (htab); -+ if (htab->relr_count != 0 && relr_addr == NULL) -+ return false; -+ - size_t i = 0; - bfd_byte *loc = htab->elf.srelrdyn->contents; - while (i < htab->relr_count) - { -- bfd_vma base = htab->relr_addr[i]; -+ bfd_vma base = relr_addr[i]; - BFD_ASSERT (base % 2 == 0); - bfd_put_64 (htab->elf.dynobj, base, loc); - loc += 8; - i++; - while (i < htab->relr_count -- && htab->relr_addr[i] == base) -+ && relr_addr[i] == base) - { - htab->stub_error = true; - i++; -@@ -15213,10 +15239,10 @@ ppc64_elf_build_stubs (struct bfd_link_i - { - bfd_vma bits = 0; - while (i < htab->relr_count -- && htab->relr_addr[i] - base < 63 * 8 -- && (htab->relr_addr[i] - base) % 8 == 0) -+ && relr_addr[i] - base < 63 * 8 -+ && (relr_addr[i] - base) % 8 == 0) - { -- bits |= (bfd_vma) 1 << ((htab->relr_addr[i] - base) / 8); -+ bits |= (bfd_vma) 1 << ((relr_addr[i] - base) / 8); - i++; - } - if (bits == 0) -@@ -15226,6 +15252,7 @@ ppc64_elf_build_stubs (struct bfd_link_i - base += 63 * 8; - } - } -+ free (relr_addr); - /* Pad any excess with 1's, a do-nothing encoding. */ - while ((size_t) (loc - htab->elf.srelrdyn->contents) - < htab->elf.srelrdyn->size) diff --git a/binutils-s390x-static-PIE.patch b/binutils-s390x-static-PIE.patch deleted file mode 100644 index 556bdb5..0000000 --- a/binutils-s390x-static-PIE.patch +++ /dev/null @@ -1,142 +0,0 @@ -diff -rup binutils-2.38/bfd/elf64-s390.c binutils-2.38.new/bfd/elf64-s390.c ---- binutils-2.38/bfd/elf64-s390.c 2022-01-22 12:14:07.000000000 +0000 -+++ binutils-2.38.new/bfd/elf64-s390.c 2022-05-19 11:07:33.353913654 +0100 -@@ -774,7 +774,7 @@ elf_s390_tls_transition (struct bfd_link - int r_type, - int is_local) - { -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - return r_type; - - switch (r_type) -@@ -1026,7 +1026,7 @@ elf_s390_check_relocs (bfd *abfd, - case R_390_TLS_GOTIE20: - case R_390_TLS_GOTIE64: - case R_390_TLS_IEENT: -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - info->flags |= DF_STATIC_TLS; - /* Fall through */ - -@@ -1107,7 +1107,7 @@ elf_s390_check_relocs (bfd *abfd, - if (r_type == R_390_TLS_LE64 && bfd_link_pie (info)) - break; - -- if (!bfd_link_pic (info)) -+ if (!bfd_link_dll (info)) - break; - info->flags |= DF_STATIC_TLS; - /* Fall through */ -@@ -1571,7 +1571,7 @@ allocate_dynrelocs (struct elf_link_hash - to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT - we can save the dynamic TLS relocation. */ - if (h->got.refcount > 0 -- && !bfd_link_pic (info) -+ && !bfd_link_dll (info) - && h->dynindx == -1 - && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE) - { -@@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *out - else if (startswith (bfd_section_name (s), ".rela")) - { - if (s->size != 0 && s != htab->elf.srelplt) -- relocs = true; -+ { -+ relocs = true; -+ if (s == htab->elf.irelplt) -+ { -+ /* In static-pie case, there are IRELATIVE-relocs in -+ .rela.iplt (htab->irelplt), which will later be grouped -+ to .rela.plt. On s390, the IRELATIVE relocations are -+ always located in .rela.iplt - even for non-static case. -+ Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added -+ to the dynamic section even if htab->srelplt->size == 0. -+ See _bfd_elf_add_dynamic_tags in bfd/elflink.c. */ -+ htab->elf.dt_jmprel_required = true; -+ } -+ } - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ -@@ -2662,7 +2675,7 @@ elf_s390_relocate_section (bfd *output_b - - /* Relocations for tls literal pool entries. */ - case R_390_TLS_IE64: -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - { - Elf_Internal_Rela outrel; - asection *sreloc; -@@ -2690,7 +2703,7 @@ elf_s390_relocate_section (bfd *output_b - else if (h != NULL) - { - tls_type = elf_s390_hash_entry(h)->tls_type; -- if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE) -+ if (!bfd_link_dll (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE) - r_type = R_390_TLS_LE64; - } - if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE) -@@ -2801,14 +2814,14 @@ elf_s390_relocate_section (bfd *output_b - if (local_got_offsets == NULL) - abort(); - off = local_got_offsets[r_symndx]; -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - goto emit_tls_relocs; - } - else - { - off = h->got.offset; - tls_type = elf_s390_hash_entry(h)->tls_type; -- if (bfd_link_pic (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE) -+ if (bfd_link_dll (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE) - goto emit_tls_relocs; - } - -@@ -2825,7 +2838,7 @@ elf_s390_relocate_section (bfd *output_b - break; - - case R_390_TLS_LDM64: -- if (! bfd_link_pic (info)) -+ if (! bfd_link_dll (info)) - /* The literal pool entry this relocation refers to gets ignored - by the optimized code of the local exec model. Do nothing - and the value will turn out zero. */ -@@ -2900,7 +2913,7 @@ elf_s390_relocate_section (bfd *output_b - continue; - - case R_390_TLS_LDO64: -- if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING)) -+ if (bfd_link_dll (info) || (input_section->flags & SEC_DEBUGGING)) - relocation -= dtpoff_base (info); - else - /* When converting LDO to LE, we must negate. */ -@@ -2922,7 +2935,7 @@ elf_s390_relocate_section (bfd *output_b - - if (r_type == R_390_TLS_LOAD) - { -- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1)) -+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1)) - { - /* IE->LE transition. Four valid cases: - lg %rx,(0,%ry) -> sllg %rx,%ry,0 -@@ -2972,7 +2985,7 @@ elf_s390_relocate_section (bfd *output_b - invalid_tls_insn (input_bfd, input_section, rel); - return false; - } -- if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1)) -+ if (!bfd_link_dll (info) && (h == NULL || h->dynindx == -1)) - { - /* GD->LE transition. - brasl %r14,__tls_get_addr@plt -> brcl 0,. */ -@@ -2991,7 +3004,7 @@ elf_s390_relocate_section (bfd *output_b - } - else if (r_type == R_390_TLS_LDCALL) - { -- if (!bfd_link_pic (info)) -+ if (!bfd_link_dll (info)) - { - unsigned int insn0, insn1; - -Only in binutils-2.38.new/bfd/: elf64-s390.c.orig diff --git a/binutils-section-type.patch b/binutils-section-type.patch deleted file mode 100644 index b8ebfa7..0000000 --- a/binutils-section-type.patch +++ /dev/null @@ -1,369 +0,0 @@ -diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h -index 3b2a4f49a9b..78a0a1dea42 100644 ---- a/bfd/bfd-in2.h -+++ b/bfd/bfd-in2.h -@@ -1170,6 +1170,9 @@ typedef struct bfd_section - This is used when support for non-contiguous memory regions is enabled. */ - struct bfd_section *already_assigned; - -+ /* Explicitly specified section type, if non-zero. */ -+ unsigned int type; -+ - } asection; - - /* Relax table contains information about instructions which can -@@ -1352,8 +1355,8 @@ discarded_section (const asection *sec) - /* symbol, symbol_ptr_ptr, */ \ - (struct bfd_symbol *) SYM, &SEC.symbol, \ - \ -- /* map_head, map_tail, already_assigned */ \ -- { NULL }, { NULL }, NULL \ -+ /* map_head, map_tail, already_assigned, type */ \ -+ { NULL }, { NULL }, NULL, 0 \ - \ - } - -diff --git a/bfd/elf.c b/bfd/elf.c -index a67415e76e1..82b53be99f9 100644 ---- a/bfd/elf.c -+++ b/bfd/elf.c -@@ -3280,7 +3280,9 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg) - - /* If the section type is unspecified, we set it based on - asect->flags. */ -- if ((asect->flags & SEC_GROUP) != 0) -+ if (asect->type != 0) -+ sh_type = asect->type; -+ else if ((asect->flags & SEC_GROUP) != 0) - sh_type = SHT_GROUP; - else - sh_type = bfd_elf_get_default_section_type (asect->flags); -diff --git a/bfd/section.c b/bfd/section.c -index 899438a1c5e..2de7dbf661a 100644 ---- a/bfd/section.c -+++ b/bfd/section.c -@@ -737,8 +737,8 @@ CODE_FRAGMENT - . {* symbol, symbol_ptr_ptr, *} \ - . (struct bfd_symbol *) SYM, &SEC.symbol, \ - . \ --. {* map_head, map_tail, already_assigned *} \ --. { NULL }, { NULL }, NULL \ -+. {* map_head, map_tail, already_assigned, type *} \ -+. { NULL }, { NULL }, NULL, 0 \ - . \ - . } - . -diff --git a/ld/NEWS b/ld/NEWS -index dbb402d1f8a..a498abaf0f9 100644 ---- a/ld/NEWS -+++ b/ld/NEWS -@@ -1,5 +1,8 @@ - -*- text -*- - -+* TYPE= is now supported in an output section description to set the -+ section type value. -+ - Changes in 2.38: - - * Add -z pack-relative-relocs/-z no pack-relative-relocs to x86 ELF -diff --git a/ld/ld.texi b/ld/ld.texi -index fc75e9b3625..d57e9221410 100644 ---- a/ld/ld.texi -+++ b/ld/ld.texi -@@ -5483,13 +5483,23 @@ loaded into memory when the program is run. - @item READONLY - The section should be marked as read-only. - @item DSECT --@itemx COPY --@itemx INFO --@itemx OVERLAY -+@item COPY -+@item INFO -+@item OVERLAY - These type names are supported for backward compatibility, and are - rarely used. They all have the same effect: the section should be - marked as not allocatable, so that no memory is allocated for the - section when the program is run. -+@item TYPE = @var{type} -+Set the section type to the integer @var{type}. When generating an ELF -+output file, type names @code{SHT_PROGBITS}, @code{SHT_STRTAB}, -+@code{SHT_NOTE}, @code {SHT_NOBITS}, @code{SHT_INIT_ARRAY}, -+@code{SHT_FINI_ARRAY}, and @code{SHT_PREINIT_ARRAY} are also allowed -+for @var{type}. It is the user's responsibility to ensure that any -+special requirements of the section type are met. -+@item READONLY ( TYPE = @var{type} ) -+This form of the syntax combines the @var{READONLY} type with the -+type specified by @var{type}. - @end table - - @kindex NOLOAD -diff --git a/ld/ldgram.y b/ld/ldgram.y -index 11c2f219c05..3a904e39482 100644 ---- a/ld/ldgram.y -+++ b/ld/ldgram.y -@@ -47,6 +47,7 @@ - #endif - - static enum section_type sectype; -+static etree_type *sectype_value; - static lang_memory_region_type *region; - - static bool ldgram_had_keep = false; -@@ -139,6 +140,7 @@ static int error_index; - %token LD_FEATURE - %token NOLOAD DSECT COPY INFO OVERLAY - %token READONLY -+%token TYPE - %token DEFINED TARGET_K SEARCH_DIR MAP ENTRY - %token NEXT - %token SIZEOF ALIGNOF ADDR LOADADDR MAX_K MIN_K -@@ -1058,9 +1060,8 @@ section: NAME - { - ldlex_popstate (); - ldlex_wild (); -- lang_enter_output_section_statement($1, $3, sectype, -- $5, $7, $4, -- $8, $6); -+ lang_enter_output_section_statement ($1, $3, sectype, -+ sectype_value, $5, $7, $4, $8, $6); - } - '{' - statement_list_opt -@@ -1130,8 +1131,10 @@ type: - | COPY { sectype = noalloc_section; } - | INFO { sectype = noalloc_section; } - | OVERLAY { sectype = noalloc_section; } -+ | READONLY '(' TYPE '=' exp ')' { sectype = typed_readonly_section; sectype_value = $5; } - | READONLY { sectype = readonly_section; } -- ; -+ | TYPE '=' exp { sectype = type_section; sectype_value = $3; } -+ ; - - atype: - '(' type ')' -diff --git a/ld/ldlang.c b/ld/ldlang.c -index 474784c874a..1733f8e65c4 100644 ---- a/ld/ldlang.c -+++ b/ld/ldlang.c -@@ -1891,8 +1891,8 @@ lang_insert_orphan (asection *s, - address = exp_intop (0); - - os_tail = (lang_output_section_statement_type **) lang_os_list.tail; -- os = lang_enter_output_section_statement (secname, address, normal_section, -- NULL, NULL, NULL, constraint, 0); -+ os = lang_enter_output_section_statement ( -+ secname, address, normal_section, 0, NULL, NULL, NULL, constraint, 0); - - if (add_child == NULL) - add_child = &os->children; -@@ -2635,10 +2635,12 @@ lang_add_section (lang_statement_list_type *ptr, - case normal_section: - case overlay_section: - case first_overlay_section: -+ case type_section: - break; - case noalloc_section: - flags &= ~SEC_ALLOC; - break; -+ case typed_readonly_section: - case readonly_section: - flags |= SEC_READONLY; - break; -@@ -4209,6 +4211,7 @@ map_input_to_output_sections - { - lang_output_section_statement_type *tos; - flagword flags; -+ unsigned int type = 0; - - switch (s->header.type) - { -@@ -4264,6 +4267,42 @@ map_input_to_output_sections - case readonly_section: - flags |= SEC_READONLY; - break; -+ case typed_readonly_section: -+ flags |= SEC_READONLY; -+ /* Fall through. */ -+ case type_section: -+ if (os->sectype_value->type.node_class == etree_name -+ && os->sectype_value->type.node_code == NAME) -+ { -+ const char *name = os->sectype_value->name.name; -+ if (strcmp (name, "SHT_PROGBITS") == 0) -+ type = SHT_PROGBITS; -+ else if (strcmp (name, "SHT_STRTAB") == 0) -+ type = SHT_STRTAB; -+ else if (strcmp (name, "SHT_NOTE") == 0) -+ type = SHT_NOTE; -+ else if (strcmp (name, "SHT_NOBITS") == 0) -+ type = SHT_NOBITS; -+ else if (strcmp (name, "SHT_INIT_ARRAY") == 0) -+ type = SHT_INIT_ARRAY; -+ else if (strcmp (name, "SHT_FINI_ARRAY") == 0) -+ type = SHT_FINI_ARRAY; -+ else if (strcmp (name, "SHT_PREINIT_ARRAY") == 0) -+ type = SHT_PREINIT_ARRAY; -+ else -+ einfo (_ ("%F%P: invalid type for output section `%s'\n"), -+ os->name); -+ } -+ else -+ { -+ exp_fold_tree_no_dot (os->sectype_value); -+ if (expld.result.valid_p) -+ type = expld.result.value; -+ else -+ einfo (_ ("%F%P: invalid type for output section `%s'\n"), -+ os->name); -+ } -+ break; - case noload_section: - if (bfd_get_flavour (link_info.output_bfd) - == bfd_target_elf_flavour) -@@ -4276,6 +4315,7 @@ map_input_to_output_sections - init_os (os, flags | SEC_READONLY); - else - os->bfd_section->flags |= flags; -+ os->bfd_section->type = type; - break; - case lang_input_section_enum: - break; -@@ -7506,6 +7546,7 @@ lang_output_section_statement_type * - lang_enter_output_section_statement (const char *output_section_statement_name, - etree_type *address_exp, - enum section_type sectype, -+ etree_type *sectype_value, - etree_type *align, - etree_type *subalign, - etree_type *ebase, -@@ -7523,10 +7564,12 @@ lang_enter_output_section_statement (const char *output_section_statement_name, - os->addr_tree = address_exp; - } - os->sectype = sectype; -- if (sectype != noload_section) -- os->flags = SEC_NO_FLAGS; -- else -+ if (sectype == type_section || sectype == typed_readonly_section) -+ os->sectype_value = sectype_value; -+ else if (sectype == noload_section) - os->flags = SEC_NEVER_LOAD; -+ else -+ os->flags = SEC_NO_FLAGS; - os->block_value = 1; - - /* Make next things chain into subchain of this. */ -@@ -8842,7 +8885,7 @@ lang_enter_overlay_section (const char *name) - etree_type *size; - - lang_enter_output_section_statement (name, overlay_vma, overlay_section, -- 0, overlay_subalign, 0, 0, 0); -+ 0, 0, overlay_subalign, 0, 0, 0); - - /* If this is the first section, then base the VMA of future - sections on this one. This will work correctly even if `.' is -diff --git a/ld/ldlang.h b/ld/ldlang.h -index 0d057c9bee9..95f6e468b30 100644 ---- a/ld/ldlang.h -+++ b/ld/ldlang.h -@@ -122,7 +122,9 @@ enum section_type - overlay_section, - noload_section, - noalloc_section, -- readonly_section -+ type_section, -+ readonly_section, -+ typed_readonly_section - }; - - /* This structure holds a list of program headers describing -@@ -166,6 +168,7 @@ typedef struct lang_output_section_statement_struct - int constraint; - flagword flags; - enum section_type sectype; -+ etree_type *sectype_value; - unsigned int processed_vma : 1; - unsigned int processed_lma : 1; - unsigned int all_input_readonly : 1; -@@ -545,7 +548,7 @@ extern void lang_add_output - (const char *, int from_script); - extern lang_output_section_statement_type *lang_enter_output_section_statement - (const char *, etree_type *, enum section_type, etree_type *, etree_type *, -- etree_type *, int, int); -+ etree_type *, etree_type *, int, int); - extern void lang_final - (void); - extern void lang_relax_sections -diff --git a/ld/ldlex.l b/ld/ldlex.l -index 78db16e3a48..c38b46b9336 100644 ---- a/ld/ldlex.l -+++ b/ld/ldlex.l -@@ -323,6 +323,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* - "DSECT" { RTOKEN(DSECT); } - "COPY" { RTOKEN(COPY); } - "INFO" { RTOKEN(INFO); } -+"TYPE" { RTOKEN(TYPE); } - "ONLY_IF_RO" { RTOKEN(ONLY_IF_RO); } - "ONLY_IF_RW" { RTOKEN(ONLY_IF_RW); } - "SPECIAL" { RTOKEN(SPECIAL); } -diff --git a/ld/mri.c b/ld/mri.c -index b428ab0d0bf..5749870ef1e 100644 ---- a/ld/mri.c -+++ b/ld/mri.c -@@ -210,8 +210,8 @@ mri_draw_tree (void) - base = p->vma ? p->vma : exp_nameop (NAME, "."); - - lang_enter_output_section_statement (p->name, base, -- p->ok_to_load ? normal_section : noload_section, -- align, subalign, NULL, 0, 0); -+ p->ok_to_load ? normal_section : noload_section, 0, -+ align, subalign, NULL, 0, 0); - base = 0; - tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); - tmp->next = NULL; -diff --git a/ld/testsuite/ld-scripts/output-section-types.d b/ld/testsuite/ld-scripts/output-section-types.d -index ab124fa4dd7..2ecacaba57d 100644 ---- a/ld/testsuite/ld-scripts/output-section-types.d -+++ b/ld/testsuite/ld-scripts/output-section-types.d -@@ -1,13 +1,17 @@ - #ld: -Toutput-section-types.t - #source: align2a.s --#objdump: -h -+#readelf: -S --wide - #target: [is_elf_format] - - #... -- . \.rom.* --[ ]+ALLOC, READONLY -- . \.ro.* --[ ]+CONTENTS, ALLOC, LOAD, READONLY, DATA -- . \.over.* --[ ]+CONTENTS, READONLY -+.* .rom +NOBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] -+.* .ro +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] -+.* .over +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 + +0 +0 +[1248] -+.* progbits +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] -+.* strtab +STRTAB +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] -+.* note +NOTE +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] -+.* init_array +INIT_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248] -+.* fini_array +FINI_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248] -+.* preinit_array +PREINIT_ARRAY +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0[48] +A +0 +0 +[1248] -+.* .ro.note +NOTE +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +00 +A +0 +0 +[1248] - #pass -diff --git a/ld/testsuite/ld-scripts/output-section-types.t b/ld/testsuite/ld-scripts/output-section-types.t -index d8fdfda1a03..18fc5c11980 100644 ---- a/ld/testsuite/ld-scripts/output-section-types.t -+++ b/ld/testsuite/ld-scripts/output-section-types.t -@@ -2,6 +2,13 @@ SECTIONS { - .rom (NOLOAD) : { LONG(1234); } - .ro (READONLY) : { LONG(5678); } - .over (OVERLAY) : { LONG(0123); } -+ progbits (TYPE=SHT_PROGBITS) : { BYTE(1) } -+ strtab (TYPE = SHT_STRTAB) : { BYTE(0) } -+ note (TYPE =SHT_NOTE) : { BYTE(8) } -+ init_array (TYPE= 14) : { QUAD(14) } -+ fini_array ( TYPE=SHT_FINI_ARRAY) : { QUAD(15) } -+ preinit_array (TYPE=SHT_PREINIT_ARRAY ) : { QUAD(16) } -+ .ro.note (READONLY (TYPE=SHT_NOTE)) : { LONG(5678); } - /DISCARD/ : { *(*) } - - } diff --git a/binutils-testsuite-fixes.patch b/binutils-testsuite-fixes.patch index 2c84a7c..4090e82 100644 --- a/binutils-testsuite-fixes.patch +++ b/binutils-testsuite-fixes.patch @@ -430,28 +430,6 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.36.1/ld/tes #xfail: mips64vr-*-* msp430-*-* powerpc*-*-eabivle rl78-*-* rx-*-* sh*-*-* #... ---- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 09:55:20.315674651 +0100 -+++ binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 10:15:51.096886972 +0100 -@@ -664,6 +664,11 @@ run_cc_link_tests [list \ - ] \ - ] - -+if { [isnative] -+ && !([istarget "powerpc-*-*"] -+ || [istarget "aarch64*-*-*"] || [istarget "arm*-*-*"] -+ || [istarget "sparc*-*-*"] -+ || [istarget "riscv*-*-*"]) } { - run_ld_link_exec_tests [list \ - [list \ - "Run pr18808" \ -@@ -714,6 +719,7 @@ run_ld_link_exec_tests [list \ - "pr18841.out" \ - ] \ - ] -+} - - # The pr23169 testcase is not valid. In general, you can't call ifunc - # resolvers in another binary unless you know what you're doing. In --- binutils.orig/ld/testsuite/ld-i386/i386.exp 2021-07-20 13:28:42.211613869 +0100 +++ binutils-2.37/ld/testsuite/ld-i386/i386.exp 2021-07-20 13:40:00.116839084 +0100 @@ -1057,15 +1057,6 @@ if { [isnative] @@ -480,21 +458,11 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.36.1/ld/tes undefined_weak "-fPIE" "-pie" --- binutils.orig/ld/testsuite/ld-i386/plt-main.rd 2021-07-20 13:28:42.214613852 +0100 +++ binutils-2.37/ld/testsuite/ld-i386/plt-main.rd 2021-07-20 13:39:25.781030283 +0100 -@@ -1,4 +1 @@ +@@ -1,4 +1,1 @@ -#failif -#... -[0-9a-f ]+R_386_JUMP_SLOT +0+ +bar #... ---- binutils.orig/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-20 13:28:42.211613869 +0100 -+++ binutils-2.37/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-20 13:42:32.515990374 +0100 -@@ -1,7 +1,2 @@ - #... --Disassembly of section .plt.got: -- --[a-f0-9]+ <[_a-z]+@plt>: --[ ]*[a-f0-9]+: f3 0f 1e fb endbr32 --[ ]*[a-f0-9]+: ff a3 .. .. .. .. jmp +\*\-0x[a-f0-9]+\(%ebx\) - #pass --- binutils.orig/ld/testsuite/ld-scripts/crossref.exp 2021-07-20 13:28:42.114614409 +0100 +++ binutils-2.37/ld/testsuite/ld-scripts/crossref.exp 2021-07-20 13:45:27.476015992 +0100 @@ -147,6 +147,8 @@ set exec_output [prune_warnings $exec_ou @@ -612,50 +580,6 @@ diff -rup binutils.orig/ld/testsuite/ld-powerpc/notoc3.d binutils-2.37/ld/testsu +8000000000000004:.* 8000000000000008: (00 00 00 60|60 00 00 00) nop 800000000000000c: (20 00 80 4e|4e 80 00 20) blr -diff -rup binutils.orig/ld/testsuite/ld-powerpc/pr23937.d binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d ---- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 15:22:27.828562108 +0100 -+++ binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 15:40:52.012401643 +0100 -@@ -6,5 +6,4 @@ - #... - .* R_PPC64_IRELATIVE +10000180 - #... --.*: 0+10000180 +20 IFUNC +LOCAL +DEFAULT .* magic - #pass -diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsexe32.r binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r ---- binutils.orig/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-20 15:22:27.824562131 +0100 -+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-20 15:35:59.630032873 +0100 -@@ -22,7 +22,8 @@ Section Headers: - +\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4 - +\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000018 04 +WA +0 +0 +4 - +\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4 -- +\[[ 0-9]+\] \.symtab +SYMTAB +.* -+#pass -++\[[ 0-9]+\] \.symtab +SYMTAB +.* - +\[[ 0-9]+\] \.strtab +STRTAB +.* - +\[[ 0-9]+\] \.shstrtab +STRTAB +.* - #... -diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsexe32no.r binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r ---- binutils.orig/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-20 15:22:27.826562119 +0100 -+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-20 15:36:34.541838084 +0100 -@@ -22,6 +22,7 @@ Section Headers: - +\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4 - +\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000038 04 +WA +0 +0 +4 - +\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4 -+#pass - +\[[ 0-9]+\] \.symtab +SYMTAB +.* - +\[[ 0-9]+\] \.strtab +STRTAB +.* - +\[[ 0-9]+\] \.shstrtab +STRTAB +.* -diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r ---- binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-20 15:22:27.825562125 +0100 -+++ binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-20 15:37:05.434665742 +0100 -@@ -20,6 +20,7 @@ Section Headers: - +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 08 +WA +3 +0 +4 - +\[[ 0-9]+\] \.got +PROGBITS .* 0+40 04 +WA +0 +0 +4 - +\[[ 0-9]+\] \.plt +PROGBITS .* 0+4 00 +WA +0 +0 +4 -+#pass - +\[[ 0-9]+\] \.symtab +.* - +\[[ 0-9]+\] \.strtab +.* - +\[[ 0-9]+\] \.shstrtab +.* --- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 16:24:17.370869076 +0100 +++ binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-20 16:24:31.069792658 +0100 @@ -39,6 +39,7 @@ if { ![is_elf_format] || ![supports_gnu_ @@ -673,15 +597,7 @@ diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r binutils-2.37/ld/tests #pass --- binutils.orig/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 16:24:17.389868970 +0100 +++ binutils-2.37/ld/testsuite/ld-powerpc/group3.sym 2021-07-20 16:28:33.372441000 +0100 -@@ -1,2 +1 @@ --#... - #pass ---- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 16:24:17.386868986 +0100 -+++ binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d 2021-07-20 16:29:00.604289085 +0100 -@@ -5,5 +5,4 @@ - - #... - .* R_PPC64_IRELATIVE +10000180 +@@ -1,2 +1,1 @@ -#... #pass --- binutils.orig/ld/testsuite/ld-elf/pr26580-3.out 2021-07-20 17:07:36.952369125 +0100 @@ -738,80 +654,6 @@ diff -rup binutils.orig/ld/testsuite/ld-powerpc/tlsso32.r binutils-2.37/ld/tests } if {[is_elf_format]} then { -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-1a.c binutils-2.38/ld/testsuite/ld-elf/pr21964-1a.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-1a.c 2022-04-04 10:38:14.163433074 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-1a.c 2022-04-04 10:46:07.878920587 +0100 -@@ -4,7 +4,7 @@ int - foo1 (void) - { - static int my_var __attribute__((used, section("__verbose"))) = 5; -- if (__start___verbose == __stop___verbose -+ if (& __start___verbose[0] == & __stop___verbose[0] - || __start___verbose[0] != 5) - return -1; - else -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-1b.c binutils-2.38/ld/testsuite/ld-elf/pr21964-1b.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-1b.c 2022-04-04 10:38:14.177432977 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-1b.c 2022-04-04 10:46:07.878920587 +0100 -@@ -4,7 +4,7 @@ int - foo2 (void) - { - static int my_var __attribute__((used, section("__verbose"))) = 10; -- if (__start___verbose == __stop___verbose -+ if (& __start___verbose[0] == & __stop___verbose[0] - || __start___verbose[0] != 10) - return -1; - else -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-1c.c binutils-2.38/ld/testsuite/ld-elf/pr21964-1c.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-1c.c 2022-04-04 10:38:14.166433054 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-1c.c 2022-04-04 10:46:07.879920580 +0100 -@@ -9,7 +9,7 @@ static int my_var __attribute__((used, s - int - bar (void) - { -- if (__start___verbose == __stop___verbose) -+ if (& __start___verbose[0] == & __stop___verbose[0]) - return -1; - - if (__start___verbose[0] != 6) -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-2a.c binutils-2.38/ld/testsuite/ld-elf/pr21964-2a.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-2a.c 2022-04-04 10:38:14.165433061 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-2a.c 2022-04-04 10:46:07.879920580 +0100 -@@ -4,7 +4,8 @@ int - foo1 (void) - { - static int my_var __attribute__((used, section("__verbose"))) = 5; -- if (__start___verbose == __stop___verbose -+ -+ if (& __start___verbose[0] == & __stop___verbose[0] - && __start___verbose[0] != 5) - return -1; - else -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-2b.c binutils-2.38/ld/testsuite/ld-elf/pr21964-2b.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-2b.c 2022-04-04 10:38:14.170433026 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-2b.c 2022-04-04 10:46:07.879920580 +0100 -@@ -4,7 +4,8 @@ int - foo2 (void) - { - static int my_var __attribute__((used, section("__verbose"))) = 10; -- if (__start___verbose == __stop___verbose -+ -+ if (& __start___verbose[0] == & __stop___verbose[0] - || __start___verbose[0] != 10) - return -1; - else -diff -rup binutils.orig/ld/testsuite/ld-elf/pr21964-3a.c binutils-2.38/ld/testsuite/ld-elf/pr21964-3a.c ---- binutils.orig/ld/testsuite/ld-elf/pr21964-3a.c 2022-04-04 10:38:14.172433012 +0100 -+++ binutils-2.38/ld/testsuite/ld-elf/pr21964-3a.c 2022-04-04 10:46:07.879920580 +0100 -@@ -3,7 +3,7 @@ extern int __stop___verbose[]; - int - foo3 (void) - { -- if (__start___verbose == __stop___verbose -+ if (& __start___verbose[0] == & __stop___verbose[0] - || __start___verbose[0] != 6) - return -1; - else diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.38/ld/testsuite/ld-plugin/lto.exp --- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2022-04-04 10:38:14.068433736 +0100 +++ binutils-2.38/ld/testsuite/ld-plugin/lto.exp 2022-04-04 10:46:07.879920580 +0100 @@ -826,35 +668,6 @@ diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.38/ld/testsuit proc restore_notify { } { global saved_CFLAGS -diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.38/ld/testsuite/ld-x86-64/plt-main-bnd.dd ---- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2022-04-04 10:38:14.138433248 +0100 -+++ binutils-2.38/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2022-04-04 11:17:41.804090216 +0100 -@@ -1,7 +1 @@ --#... --Disassembly of section .plt.got: -- --[a-f0-9]+ <[a-z_]+@plt>: --[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmp \*0x20....\(%rip\) # ...... <.*> --[ ]*[a-f0-9]+: 90 nop - #pass -diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.38/ld/testsuite/ld-x86-64/plt-main-ibt.dd ---- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2022-04-04 10:38:14.145433200 +0100 -+++ binutils-2.38/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2022-04-04 11:17:55.676988674 +0100 -@@ -1,7 +1 @@ --#... --Disassembly of section .plt.got: -- --[a-f0-9]+ <[_a-z]+@plt>: --[ ]*[a-f0-9]+: f3 0f 1e fa endbr64 --[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmp \*0x20....\(%rip\) # ...... <.*> - #pass -diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err binutils-2.38/ld/testsuite/ld-x86-64/pr21997-1b.err ---- binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err 2022-04-04 10:38:14.145433200 +0100 -+++ binutils-2.38/ld/testsuite/ld-x86-64/pr21997-1b.err 2022-04-04 10:46:07.879920580 +0100 -@@ -1,2 +1,2 @@ --.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE -+.*relocation R_X86_64_(PC32|32S) against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE - #... diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err binutils-2.38/ld/testsuite/ld-x86-64/pr22001-1b.err --- binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err 2022-04-04 10:38:14.144433207 +0100 +++ binutils-2.38/ld/testsuite/ld-x86-64/pr22001-1b.err 2022-04-04 10:46:07.879920580 +0100 @@ -980,30 +793,640 @@ diff -rup binutils.orig/ld/testsuite/lib/ld-lib.exp binutils-2.38/ld/testsuite/l if [check_ctf_available] { return 0 } ---- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2022-07-28 08:36:10.805963313 +0100 -+++ binutils-2.38/ld/testsuite/ld-x86-64/x86-64.exp 2022-07-28 08:40:35.482073002 +0100 -@@ -1886,24 +1886,6 @@ if { [isnative] && [check_compiler_avail - "-fPIE" \ +diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.39/ld/testsuite/ld-plugin/lto.exp +--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2022-08-11 12:39:44.419478335 +0100 ++++ binutils-2.39/ld/testsuite/ld-plugin/lto.exp 2022-08-11 12:43:50.508080379 +0100 +@@ -481,23 +481,6 @@ set lto_link_elf_tests [list \ + "c++" \ + ] \ + [list \ +- "Build libpr28879b.so" \ +- "-shared -Wl,--no-as-needed tmpdir/libpr28879a.so" \ +- "-O2 -fpic" \ +- {dummy.c} \ +- {} \ +- "libpr28879b.so" \ +- ] \ +- [list \ +- "Build pr28879" \ +- "-Wl,--no-as-needed tmpdir/libpr28879b.so -Wl,-rpath-link,." \ +- "-O0 -flto -D_GLIBCXX_ASSERTIONS" \ +- {pr28879b.cc} \ +- {} \ +- "pr28879" \ +- "c++" \ +- ] \ +- [list \ + "Build libpr28849a.so" \ + "-shared" \ + "-fPIC" \ +--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 12:39:44.491477934 +0100 ++++ binutils-2.39/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 12:47:25.610857959 +0100 +@@ -1376,14 +1376,6 @@ if { [isnative] && [check_compiler_avail + "libprotected-func-2b.so" \ ] \ [list \ -- "Run protected-data-1a without PIE" \ -- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-data-1a.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { protected-data-1b.c } \ -- "protected-data-1a" \ -- "pass.out" \ +- "Build protected-func-2 without PIE" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2b.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { protected-func-1b.c } \ +- {{error_output "pr28875-func.err"}} \ +- "protected-func-2" \ +- ] \ +- [list \ + "Build libprotected-func-2c.so" \ + "-shared" \ + "-fPIC -Wa,-mx86-used-note=yes" \ +@@ -1392,14 +1384,6 @@ if { [isnative] && [check_compiler_avail + "libprotected-func-2c.so" \ + ] \ + [list \ +- "Build protected-func-2a without PIE" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2c.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { protected-func-1b.c } \ +- {{error_output "pr28875-func.err"}} \ +- "protected-func-2a" \ +- ] \ +- [list \ + "Build libprotected-data-1a.so" \ + "-shared -z noindirect-extern-access" \ + "-fPIC -Wa,-mx86-used-note=yes" \ +@@ -1999,103 +1983,6 @@ if { [isnative] && [check_compiler_avail + if { [istarget "x86_64-*-linux*"] \ + && ![istarget "x86_64-*-linux*-gnux32"]} { + +- run_cc_link_tests [list \ +- [list \ +- "Build plt-main with -z bndplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -Wl,-z,bndplt \ +- -Wl,-z,noseparate-code,-z,max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-bnd" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z bndplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie \ +- -Wl,-z,bndplt,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-pie-bnd" \ +- ] \ +- [list \ +- "Build plt-main with -z bndplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -Wl,-z,bndplt \ +- -Wl,-z,now,-z,noseparate-code,-z,max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-bnd-now" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z bndplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie \ +- -Wl,-z,bndplt,-z,now,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-pie-bnd-now" \ +- ] \ +- ] +- +- run_ld_link_exec_tests [list \ +- [list \ +- "Run plt-main with -z bndplt" \ +- "-Wl,--no-as-needed,-z,bndplt tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-bnd" \ +- "plt-main.out" \ +- ] \ +- [list \ +- "Run plt-main with PIE and -z bndplt" \ +- "-Wl,--no-as-needed,-z,bndplt -pie tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-pie-bnd" \ +- "plt-main.out" \ +- "-fPIC" \ +- ] \ +- [list \ +- "Run plt-main with -z bndplt -z now" \ +- "-Wl,--no-as-needed,-z,bndplt,-z,now tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-bnd-now" \ +- "plt-main.out" \ +- ] \ +- [list \ +- "Run plt-main with PIE and -z bndplt -z now" \ +- "-Wl,--no-as-needed,-z,bndplt,-z,now -pie tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-pie-bnd-now" \ +- "plt-main.out" \ +- "-fPIC" \ +- ] \ +- [list \ +- "Run pr20800" \ +- "-Wl,-z,now -pie" \ +- "-Wa,-mx86-used-note=yes" \ +- { pr20800a.S pr20800b.S } \ +- "pr20800" \ +- "pass.out" \ +- ] \ +- ] + if { [check_ifunc_attribute_available] } { + run_ld_link_exec_tests [list \ + [list \ +@@ -2171,24 +2058,6 @@ if { [isnative] && [check_compiler_avail + $pltsecdump \ + "plt-main-pie-ibt-now" \ + ] \ +- [list \ +- "Build libibtplt-lib.so with -z ibtplt" \ +- "-shared -Wl,-z,ibtplt,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \ +- $pltdump \ +- "libibtplt-lib.so" \ +- ] \ +- [list \ +- "Build libibtplt--now-lib.so with -z ibtplt -z now" \ +- "-shared -Wl,-z,ibtplt,-z,now,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \ +- $pltdump \ +- "libibtplt-now-lib.so" \ +- ] \ + ] + + run_ld_link_exec_tests [list \ +--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 14:06:27.033627440 +0100 ++++ binutils-2.39/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 14:07:01.873427447 +0100 +@@ -2060,51 +2060,6 @@ if { [isnative] && [check_compiler_avail + ] \ + ] + +- run_ld_link_exec_tests [list \ +- [list \ +- "Run plt-main with -z ibtplt" \ +- "-Wl,--no-as-needed,-z,ibtplt tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-ibt" \ +- "plt-main.out" \ +- ] \ +- [list \ +- "Run plt-main with PIE and -z ibtplt" \ +- "-Wl,--no-as-needed,-z,ibtplt -pie tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-pie-ibt" \ +- "plt-main.out" \ +- "-fPIC" \ +- ] \ +- [list \ +- "Run plt-main with -z ibtplt -z now" \ +- "-Wl,--no-as-needed,-z,ibtplt,-z,now tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-ibt-now" \ +- "plt-main.out" \ +- ] \ +- [list \ +- "Run plt-main with PIE and -z ibtplt -z now" \ +- "-Wl,--no-as-needed,-z,ibtplt,-z,now -pie tmpdir/plt-main1.o \ +- tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-pie-ibt-now" \ +- "plt-main.out" \ +- "-fPIC" \ +- ] \ +- ] +- + if { [check_ifunc_attribute_available] } { + run_ld_link_exec_tests [list \ + [list \ +diff -rup binutils.orig/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp binutils-2.39/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp +--- binutils.orig/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp 2022-08-11 14:06:26.823628645 +0100 ++++ binutils-2.39/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp 2022-08-11 14:09:36.272541183 +0100 +@@ -97,9 +97,8 @@ if [is_remote host] { + set comp_output [prune_warnings [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET -gctf -fPIC -shared -o tmpdir/libctf-repeat-cu-main.so $src tmpdir/a.a tmpdir/b.a tmpdir/c.a"]] + if { $comp_output != "" } { + send_log "compilation of tmpdir/libctf-repeat-cu-main.so failed" +- perror "compilation of tmpdir/libctf-repeat-cu-main.so failed" +- fail $testname +- return $comp_output ++ unsupported "compilation of tmpdir/libctf-repeat-cu-main.so failed" ++ return 0 + } + + set comp_output [prune_warnings [run_host_cmd "$OBJDUMP" "--ctf tmpdir/libctf-repeat-cu-main.so > tmpdir/dump.out"]] +--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 14:35:37.042650489 +0100 ++++ binutils-2.39/ld/testsuite/ld-x86-64/x86-64.exp 2022-08-11 14:36:06.241485477 +0100 +@@ -2015,51 +2015,6 @@ if { [isnative] && [check_compiler_avail + set pltdump {{objdump {-drw} plt-main-ibt.dd}} + set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}} + } +- run_cc_link_tests [list \ +- [list \ +- "Build plt-main with -z ibtplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -Wl,-z,ibtplt \ +- -Wl,-z,noseparate-code,-z,max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltdump \ +- "plt-main-ibt" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z ibtplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie \ +- -Wl,-z,ibtplt,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltdump \ +- "plt-main-pie-ibt" \ +- ] \ +- [list \ +- "Build plt-main with -z ibtplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -Wl,-z,ibtplt \ +- -Wl,-z,now,-z,noseparate-code,-z,max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltsecdump \ +- "plt-main-ibt-now" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z ibtplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie \ +- -Wl,-z,ibtplt,-z,now,-z,noseparate-code \ +- -Wl,-z,max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltsecdump \ +- "plt-main-pie-ibt-now" \ +- ] \ +- ] +- + if { [check_ifunc_attribute_available] } { + run_ld_link_exec_tests [list \ + [list \ +diff -rup binutils.orig/gprofng/testsuite/lib/display-lib.exp binutils-2.39/gprofng/testsuite/lib/display-lib.exp +--- binutils.orig/gprofng/testsuite/lib/display-lib.exp 2022-08-11 14:35:37.614647256 +0100 ++++ binutils-2.39/gprofng/testsuite/lib/display-lib.exp 2022-08-11 15:09:55.419958513 +0100 +@@ -96,9 +96,8 @@ proc run_display_test { dir cflags gprof + perror "comparison of results in $dir failed" + } else { + send_log "compilation of test program in $dir failed:\n$out\n" +- perror "compilation of test program in $dir failed" ++ unsupported "compilation of test program in $dir failed" + } +- fail $dir + return 0 + } + pass $dir +--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2022-08-12 12:02:06.175831193 +0100 ++++ binutils-2.39/ld/testsuite/ld-i386/i386.exp 2022-08-12 12:04:58.423753469 +0100 +@@ -1292,22 +1292,6 @@ if { [isnative] + {} \ + "pr28875.so" \ + ] \ +- [list \ +- "Build pr28875" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr28875.so" \ - "$NOPIE_CFLAGS" \ +- { pr28875b.c } \ +- {{error_output "pr28875.err"}} \ +- "pr28875" \ - ] \ - [list \ -- "Run protected-data-1b with PIE" \ -- "-Wl,--no-as-needed -pie tmpdir/libprotected-data-1a.so" \ -- "-Wa,-mx86-used-note=yes" \ -- { protected-data-1b.c } \ -- "protected-data-1b" \ -- "pass.out" \ -- "-fPIE" \ +- "Build pr21997-1" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { pr21997-1b.c } \ +- {{error_output "pr21997-1.err"}} \ +- "pr21997-1" \ - ] \ -- [list \ - "Run protected-data-2a without PIE" \ - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-data-2a.so" \ - "-Wa,-mx86-used-note=yes" \ + ] + + run_ld_link_exec_tests [list \ +diff -rup binutils.orig/ld/testsuite/ld-aarch64/bti-plt-5.d binutils-2.39/ld/testsuite/ld-aarch64/bti-plt-5.d +--- binutils.orig/ld/testsuite/ld-aarch64/bti-plt-5.d 2022-08-12 12:02:05.957832557 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/bti-plt-5.d 2022-08-12 12:16:33.235418444 +0100 +@@ -8,21 +8,4 @@ + [^:]*: *file format elf64-.*aarch64 + + Disassembly of section \.plt: +- +-[0-9a-f]+ <.*>: +-.*: d503245f bti c +-.*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +-.*: 90000090 adrp x16, 410000 <.*> +-.*: f9421611 ldr x17, \[x16, #1064\] +-.*: 9110a210 add x16, x16, #0x428 +-.*: d61f0220 br x17 +-.*: d503201f nop +-.*: d503201f nop +- +-[0-9a-f]+ <.*>: +-.*: d503245f bti c +-.*: 90000090 adrp x16, 410000 <.*> +-.*: f9421a11 ldr x17, \[x16, #1072\] +-.*: 9110c210 add x16, x16, #0x430 +-.*: d61f0220 br x17 +-.*: d503201f nop ++#pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/erratum843419-far-full.d binutils-2.39/ld/testsuite/ld-aarch64/erratum843419-far-full.d +--- binutils.orig/ld/testsuite/ld-aarch64/erratum843419-far-full.d 2022-08-12 12:02:05.949832607 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/erratum843419-far-full.d 2022-08-12 12:06:58.967999214 +0100 +@@ -8,7 +8,7 @@ Disassembly of section \.text: + + 0*400000 <_start>: + ... +- 400ffc: 90400000 adrp x0, 80400000 <__bss_end__\+0x7ffedff0> ++ 400ffc: 90400000 adrp x0, 80400000 <__bss_end__\+.*> + 401000: f9000042 str x2, \[x2\] + 401004: d2800002 mov x2, #0x0 // #0 + 401008: 14000004 b 401018 +diff -rup binutils.orig/ld/testsuite/ld-aarch64/farcall-b-plt.d binutils-2.39/ld/testsuite/ld-aarch64/farcall-b-plt.d +--- binutils.orig/ld/testsuite/ld-aarch64/farcall-b-plt.d 2022-08-12 12:02:05.959832544 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/farcall-b-plt.d 2022-08-12 12:08:30.966423604 +0100 +@@ -10,7 +10,7 @@ Disassembly of section .plt: + + .* <.plt>: + .*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +-.*: .* adrp x16, .* <__foo_veneer\+.*> ++.*: .* adrp x16, .* <.*> + .*: .* ldr [wx]17, \[x16, #.*\] + .*: .* add [wx]16, [wx]16, #.* + .*: d61f0220 br x17 +@@ -19,7 +19,7 @@ Disassembly of section .plt: + .*: d503201f nop + + .* : +-.*: .* adrp x16, .* <__foo_veneer\+.*> ++.*: .* adrp x16, .* <.*> + .*: .* ldr [wx]17, \[x16, #.*\] + .*: .* add [wx]16, [wx]16, #.* + .*: d61f0220 br x17 +@@ -35,7 +35,7 @@ Disassembly of section .text: + .*: .* nop + + .* <__foo_veneer>: +-.*: .* adrp x16, 0 <.*> ++.*: .* adrp x16, .* <.*> + .*: .* add x16, x16, #.* + .*: d61f0200 br x16 + ... +diff -rup binutils.orig/ld/testsuite/ld-aarch64/farcall-bl-plt.d binutils-2.39/ld/testsuite/ld-aarch64/farcall-bl-plt.d +--- binutils.orig/ld/testsuite/ld-aarch64/farcall-bl-plt.d 2022-08-12 12:02:05.957832557 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/farcall-bl-plt.d 2022-08-12 12:09:02.407226875 +0100 +@@ -10,7 +10,7 @@ Disassembly of section .plt: + + .* <.plt>: + .*: a9bf7bf0 stp x16, x30, \[sp, #-16\]! +-.*: .* adrp x16, .* <__foo_veneer\+.*> ++.*: .* adrp x16, .* <.*> + .*: .* ldr [wx]17, \[x16, #.*\] + .*: .* add [wx]16, [wx]16, #.* + .*: d61f0220 br x17 +@@ -19,7 +19,7 @@ Disassembly of section .plt: + .*: d503201f nop + + .* : +-.*: .* adrp x16, .* <__foo_veneer\+.*> ++.*: .* adrp x16, .* <.*> + .*: .* ldr [wx]17, \[x16, #.*\] + .*: .* add [wx]16, [wx]16, #.* + .*: d61f0220 br x17 +@@ -35,7 +35,7 @@ Disassembly of section .text: + .*: .* nop + + .* <__foo_veneer>: +-.*: .* adrp x16, 0 <.*> ++.*: .* adrp x16, .* <.*> + .*: .* add x16, x16, #.* + .*: d61f0200 br x16 + ... +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-1-local.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1-local.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 12:02:05.952832588 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 12:09:55.750893086 +0100 +@@ -3,7 +3,4 @@ + #objdump: -dw + + #... +-0+(110|180|1a0) <(__GI_)?foo>: +-#... +-[ \t0-9a-f]+:[ \t0-9a-f]+bl[ \t0-9a-f]+<\*ABS\*\+(0x110|0x180|0x1a0)@plt> + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-1.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 12:02:05.951832594 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 12:09:42.054978785 +0100 +@@ -3,7 +3,4 @@ + #objdump: -dw + + #... +-0+(130|1a0|1c8) : +-#... +-[ \t0-9a-f]+:[ \t0-9a-f]+bl[ \t0-9a-f]+<\*ABS\*\+0x(130|1a0|1c8)@plt> + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-2-local.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2-local.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-2-local.d 2022-08-12 12:02:05.961832532 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2-local.d 2022-08-12 12:10:23.733718004 +0100 +@@ -3,9 +3,4 @@ + #objdump: -dw + + #... +-0+(110|180|1a0) <__GI_foo>: +-#... +-[ \t0-9a-f]+:[ \t0-9a-f]+bl[ \t0-9a-f]+<\*ABS\*\+0x(110|180|1a0)@plt> +-[ \t0-9a-f]+:[ \t0-9a-f]+adrp[ \t]+x0, 0 <.*> +-[ \t0-9a-f]+:[ \t0-9a-f]+add[ \t]+x0, x0, #0x(100|170|190) + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-2.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-2.d 2022-08-12 12:02:05.960832538 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2.d 2022-08-12 12:10:12.965785376 +0100 +@@ -3,9 +3,4 @@ + #objdump: -dw + + #... +-0+(130|1a0|1c8) : +-#... +-[ \t0-9a-f]+:[ \t0-9a-f]+bl[ \t0-9a-f]+<\*ABS\*\+0x(130|1a0|1c8)@plt> +-[ \t0-9a-f]+:[ \t0-9a-f]+adrp[ \t]+x0, 0 <.*> +-[ \t0-9a-f]+:[ \t0-9a-f]+add[ \t]+x0, x0, #0x(120|190|1b8) + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-21.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-21.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-21.d 2022-08-12 12:02:05.949832607 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-21.d 2022-08-12 12:12:27.844941426 +0100 +@@ -11,16 +11,4 @@ Contents of section .text: + [0-9a-f]+ .* + Contents of section .got.plt: + [0-9a-f]+ 0+ 0+ 0+ 0+ .* +- (10298|102b8) 0+ 0+ [0-9a-f]+ [0-9a-f]+ .* +- +-Disassembly of section .text: +- +-.* : +- .*: d65f03c0 ret +- +-.* : +- .*: 90000080 adrp x0, 10000 <.*> +- .*: .* ldr x0, \[x0, #(672|704)\] +- .*: d65f03c0 ret +- + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-22.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-22.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-22.d 2022-08-12 12:02:05.958832551 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-22.d 2022-08-12 12:12:47.461818683 +0100 +@@ -6,6 +6,4 @@ + # Ensure GOT is populated correctly in static link + + .*: file format elf64-(little|big)aarch64 +- +-Contents of section \.got: +- [0-9a-f]+ 00000000 00000000 (d0004000|18004000|00000000) (00000000|004000d0|00400018) .* ++#pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-3a.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-3a.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-3a.d 2022-08-12 12:02:05.962832525 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-3a.d 2022-08-12 12:10:36.645637220 +0100 +@@ -4,7 +4,4 @@ + #objdump: -dw + + #... +-0+(150|1d0|1e8) <__GI_foo>: +-#... +-[ \t0-9a-f]+:[ \t0-9a-f]+bl[ \t0-9a-f]+<\*ABS\*\+0x(150|1d0|1e8)@plt> + #pass +diff -rup binutils.orig/ld/testsuite/ld-aarch64/ifunc-7c.d binutils-2.39/ld/testsuite/ld-aarch64/ifunc-7c.d +--- binutils.orig/ld/testsuite/ld-aarch64/ifunc-7c.d 2022-08-12 12:02:05.958832551 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-7c.d 2022-08-12 12:11:50.070177794 +0100 +@@ -6,14 +6,5 @@ + # Check if adrp and ldr have been relocated correctly. + + .*: file format elf.+aarch64.* +- +- +-Disassembly of section \.text: +- +-[0-9a-f]+ : +- [0-9a-f]+: d65f03c0 ret +- +-[0-9a-f]+ <__start>: +- [0-9a-f]+: [0-9a-f]+ bl [0-9a-f]+ <\*ABS\*\+0x[0-9a-f]+@plt> +- [0-9a-f]+: [0-9a-f]+ adrp x0, [0-9]+ <__start\+0x[0-9a-f]+> +- [0-9a-f]+: [0-9a-f]+ ldr x0, \[x0, .+\] ++#... ++#pass +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/bti-plt-5.d binutils.new/ld/testsuite/ld-aarch64/bti-plt-5.d +--- binutils-2.39/ld/testsuite/ld-aarch64/bti-plt-5.d 2022-08-12 13:42:02.273863855 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/bti-plt-5.d 2022-08-12 13:39:47.130684480 +0100 +@@ -8,4 +8,4 @@ + [^:]*: *file format elf64-.*aarch64 + + Disassembly of section \.plt: +-#pass ++#... +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1-local.d binutils.new/ld/testsuite/ld-aarch64/ifunc-1-local.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 13:42:02.275863843 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 13:39:47.124684517 +0100 +@@ -3,4 +3,4 @@ + #objdump: -dw + + #... +-#pass ++ +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1.d binutils.new/ld/testsuite/ld-aarch64/ifunc-1.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 13:42:02.275863843 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 13:39:47.119684547 +0100 +@@ -3,4 +3,4 @@ + #objdump: -dw + + #... +-#pass ++ +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2-local.d binutils.new/ld/testsuite/ld-aarch64/ifunc-2-local.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2-local.d 2022-08-12 13:42:02.276863837 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-2-local.d 2022-08-12 13:39:47.118684553 +0100 +@@ -3,4 +3,3 @@ + #objdump: -dw + + #... +-#pass +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2.d binutils.new/ld/testsuite/ld-aarch64/ifunc-2.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-2.d 2022-08-12 13:42:02.276863837 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-2.d 2022-08-12 13:39:47.127684498 +0100 +@@ -3,4 +3,3 @@ + #objdump: -dw + + #... +-#pass +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-3a.d binutils.new/ld/testsuite/ld-aarch64/ifunc-3a.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-3a.d 2022-08-12 13:42:02.277863831 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-3a.d 2022-08-12 13:39:47.125684511 +0100 +@@ -4,4 +4,3 @@ + #objdump: -dw + + #... +-#pass +diff -rup binutils-2.39/ld/testsuite/ld-aarch64/ifunc-7c.d binutils.new/ld/testsuite/ld-aarch64/ifunc-7c.d +--- binutils-2.39/ld/testsuite/ld-aarch64/ifunc-7c.d 2022-08-12 13:42:02.277863831 +0100 ++++ binutils.new/ld/testsuite/ld-aarch64/ifunc-7c.d 2022-08-12 13:39:47.128684493 +0100 +@@ -7,4 +7,3 @@ + + .*: file format elf.+aarch64.* + #... +-#pass +--- binutils.new/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 13:39:47.124684517 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1-local.d 2022-08-12 14:38:32.310252736 +0100 +@@ -2,5 +2,6 @@ + #ld: -shared --hash-style=sysv + #objdump: -dw + +-#... ++.*: file format elf.+aarch64.* ++#pass + +--- binutils.new/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 13:39:47.119684547 +0100 ++++ binutils-2.39/ld/testsuite/ld-aarch64/ifunc-1.d 2022-08-12 14:38:22.118316568 +0100 +@@ -2,5 +2,6 @@ + #ld: -shared --hash-style=sysv + #objdump: -dw + +-#... ++.*: file format elf.+aarch64.* ++#pass + diff --git a/binutils-use-long-long.patch b/binutils-use-long-long.patch deleted file mode 100644 index 1ea7418..0000000 --- a/binutils-use-long-long.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac ---- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000 -+++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000 -@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8"; - BFD_HOST_64BIT_LONG=1 - test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long" - test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long" --elif test "x${ac_cv_sizeof_long_long}" = "x8"; then -+fi -+if test "x${ac_cv_sizeof_long_long}" = "x8"; then - BFD_HOST_64BIT_LONG_LONG=1 - test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" - test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" -- if test "x${ac_cv_sizeof_void_p}" = "x8"; then -+ if test "x${ac_cv_sizeof_void_p}" = "x8" \ -+ -a "x${ac_cv_sizeof_long}" != "x8"; then - BFD_HOSTPTR_T="unsigned long long" - fi - fi -diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure ---- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100 -+++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100 -@@ -12819,11 +12819,13 @@ - BFD_HOST_64BIT_LONG=1 - test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long" - test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long" --elif test "x${ac_cv_sizeof_long_long}" = "x8"; then -+fi -+if test "x${ac_cv_sizeof_long_long}" = "x8"; then - BFD_HOST_64BIT_LONG_LONG=1 - test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" - test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" -- if test "x${ac_cv_sizeof_void_p}" = "x8"; then -+ if test "x${ac_cv_sizeof_void_p}" = "x8" \ -+ -a "x${ac_cv_sizeof_long}" != "x8"; then - BFD_HOSTPTR_T="unsigned long long" - fi - fi diff --git a/binutils-x86-non-canonical-references.patch b/binutils-x86-non-canonical-references.patch deleted file mode 100644 index 069a868..0000000 --- a/binutils-x86-non-canonical-references.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.38/bfd/elf32-i386.c ---- binutils.orig/bfd/elf32-i386.c 2022-05-24 12:01:20.307998318 +0100 -+++ binutils-2.38/bfd/elf32-i386.c 2022-05-24 12:04:48.789688224 +0100 -@@ -1772,11 +1772,14 @@ elf_i386_scan_relocs (bfd *abfd, - } - else - { -- h->pointer_equality_needed = 1; -- /* R_386_32 can be resolved at run-time. */ -+ /* R_386_32 can be resolved at run-time. Function -+ pointer reference doesn't need PLT for pointer -+ equality. */ - if (r_type == R_386_32 - && (sec->flags & SEC_READONLY) == 0) - func_pointer_ref = true; -+ else -+ h->pointer_equality_needed = 1; - } - - if (!func_pointer_ref) -@@ -1798,6 +1801,23 @@ elf_i386_scan_relocs (bfd *abfd, - if (!h->def_regular - || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0) - h->plt.refcount = 1; -+ -+ if (h->pointer_equality_needed -+ && h->type == STT_FUNC -+ && eh->def_protected -+ && elf_has_indirect_extern_access (h->root.u.def.section->owner)) -+ { -+ /* Disallow non-canonical reference to canonical -+ protected function. */ -+ _bfd_error_handler -+ /* xgettext:c-format */ -+ (_("%pB: non-canonical reference to canonical " -+ "protected function `%s' in %pB"), -+ abfd, h->root.root.string, -+ h->root.u.def.section->owner); -+ bfd_set_error (bfd_error_bad_value); -+ goto error_return; -+ } - } - } - -diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.38/bfd/elf64-x86-64.c ---- binutils.orig/bfd/elf64-x86-64.c 2022-05-24 12:01:20.296998387 +0100 -+++ binutils-2.38/bfd/elf64-x86-64.c 2022-05-24 12:06:07.720192208 +0100 -@@ -2211,16 +2211,18 @@ elf_x86_64_scan_relocs (bfd *abfd, struc - else if (r_type != R_X86_64_PC32_BND - && r_type != R_X86_64_PC64) - { -- h->pointer_equality_needed = 1; - /* At run-time, R_X86_64_64 can be resolved for both - x86-64 and x32. But R_X86_64_32 and R_X86_64_32S -- can only be resolved for x32. */ -+ can only be resolved for x32. Function pointer -+ reference doesn't need PLT for pointer equality. */ - if ((sec->flags & SEC_READONLY) == 0 - && (r_type == R_X86_64_64 - || (!ABI_64_P (abfd) - && (r_type == R_X86_64_32 - || r_type == R_X86_64_32S)))) - func_pointer_ref = true; -+ else -+ h->pointer_equality_needed = 1; - } - - if (!func_pointer_ref) -@@ -2242,6 +2244,23 @@ elf_x86_64_scan_relocs (bfd *abfd, struc - if (!h->def_regular - || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0) - h->plt.refcount = 1; -+ -+ if (h->pointer_equality_needed -+ && h->type == STT_FUNC -+ && eh->def_protected -+ && elf_has_indirect_extern_access (h->root.u.def.section->owner)) -+ { -+ /* Disallow non-canonical reference to canonical -+ protected function. */ -+ _bfd_error_handler -+ /* xgettext:c-format */ -+ (_("%pB: non-canonical reference to canonical " -+ "protected function `%s' in %pB"), -+ abfd, h->root.root.string, -+ h->root.u.def.section->owner); -+ bfd_set_error (bfd_error_bad_value); -+ goto error_return; -+ } - } - } - diff --git a/binutils.spec b/binutils.spec index 5832d7e..f7c5808 100644 --- a/binutils.spec +++ b/binutils.spec @@ -38,8 +38,8 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} -Version: 2.38 -Release: 24%{?dist} +Version: 2.39 +Release: 1%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -59,6 +59,8 @@ URL: https://sourceware.org/binutils # --without gold Disable building of the GOLD linker. # --with clang To force building with the CLANG. # --without debuginfod Disable support for debuginfod. +# --without gprofng Disable the gprofng sub-package. +# --without systemzlib Use the binutils version of zlib. #---Start of Configure Options----------------------------------------------- @@ -120,6 +122,8 @@ URL: https://sourceware.org/binutils %bcond_without testsuite # Default: support debuginfod. %bcond_without debuginfod +# Default: build binutils-gprofng package. +%bcond_without gprofng # Use the system supplied version of the zlib compress library. # Change this to use the binutils builtin version instead. @@ -142,12 +146,18 @@ URL: https://sourceware.org/binutils %if %{with bootstrap} %undefine with_docs %undefine with_testsuite +%undefine with_gprofng %endif %if %{with debug} %undefine with_testsuite %endif +# GprofNG currenly onlly supports the x86 and AArch64 architectures. +%ifnarch %{ix86} x86_64 aarch64 +%undefine with_gprofng +%endif + # The opcodes library needs a few functions defined in the bfd # library, but these symbols are not defined in the stub bfd .so # that is available at link time. (They are present in the real @@ -251,88 +261,43 @@ Patch11: binutils-fix-testsuite-failures.patch # Lifetime: Fixed in 2.39 (maybe) Patch12: binutils-gold-mismatched-section-flags.patch -# Purpose: Add a check to the GOLD linker for a corrupt input file -# with a fuzzed section offset. -# Lifetime: Fixed in 2.39 (maybe) -Patch13: binutils-CVE-2019-1010204.patch - # Purpose: Change the gold configuration script to only warn about # unsupported targets. This allows the binutils to be built with # BPF support enabled. # Lifetime: Permanent. -Patch14: binutils-gold-warn-unsupported.patch - -# Purpose: Use the "unsigned long long" type for pointers on hosts where -# long is a 32-bit type but pointers are a 64-bit type. Necessary -# because users expect to be able to install both the i686- and -# x86_64 versions of binutils-devel on the same machine, so they -# need to identical versions of the bfd.h header file. -# Lifetime: Permanent. -Patch15: binutils-use-long-long.patch +Patch13: binutils-gold-warn-unsupported.patch # Purpose: Fix testsuite failures due to the patches applied here. # Lifetime: Permanent, but varying with each new rebase. -Patch16: binutils-testsuite-fixes.patch +Patch14: binutils-testsuite-fixes.patch # Purpose: Enable the creation of .note.gnu.property sections by the GOLD # linker for x86 binaries. # Lifetime: Fixed in 2.38 maybe -Patch17: binutils-gold-i386-gnu-property-notes.patch +Patch15: binutils-gold-i386-gnu-property-notes.patch # Purpose: Allow the binutils to be configured with any (recent) version of # autoconf. # Lifetime: Fixed in 2.39 (maybe ?) -Patch18: binutils-autoconf-version.patch +Patch16: binutils-autoconf-version.patch # Purpose: Stop libtool from inserting useless runpaths into binaries. # Lifetime: Who knows. -Patch19: binutils-libtool-no-rpath.patch - -# Purpose: Add support for specifying section types in linker scripts. -# Lifetime: Fixed in 2.39 -Patch20: binutils-section-type.patch - -# Purpose: Simplify the evaluation of assembler loc view expression chains. -# Lifetime: Fixed in 2.39 -Patch21: binutils-gas-loc-view.patch - -# Purpose: Add an option to disable access to debuginfod servers. -# Lifetime: Fixed in 2.39 -Patch22: binutils-do-not-use-debuginfod.patch - -# Purpose: Keep indirect symbol from IR if referenced from shared object. -# Lifetime: Fixed in 2.39 -Patch23: binutils-indirect-symbols.patch - -# Purpose: Support generating static PIE binaries for the s390x. -# Lifetime: Fixed in 2.39 -Patch24: binutils-s390x-static-PIE.patch - -# Purpose: Stop readelf and objdump from unnecessarily following links. -# Lifetime: Fixed in 2.39 -Patch25: binutils-link-following.patch - -# Purpose: x86 linker: Disallow invalid relocations against protected symbols. -# Lifetime: Fixed in 2.39 -Patch26: binutils-x86-non-canonical-references.patch +Patch17: binutils-libtool-no-rpath.patch %if %{enable_new_dtags} # Purpose: Change ld man page so that it says that --enable-new-dtags is the default. # Lifetime: Permanent -Patch27: binutils-update-linker-manual.patch +Patch18: binutils-update-linker-manual.patch %endif -# Purpose: Power64 linker: Fix bug handling DT_RELR relocs. -# Lifetime: Fixed in 2.39 -Patch28: binutils-ppc64-DT_RELR-relocs.patch - -# Purpose: Tweak the PowerPC assembler's handling of the .machine directive -# Lifetime: Fixed in 2.39 -Patch29: binutils-ppc-gas-machine-directive.patch - # Purpose: Add a --package-metadata option to the linkers. -# Lifetime: Fixed in 2.39 (for ld.bfd) -Patch30: binutils-package-metadata.patch +# Lifetime: Fixed in 2.40 +Patch19: binutils-package-metadata.patch + +# Purpose: Stop the assembler from generating DIE information for zero-sized functions. +# Lifetime: Fixed in 2.40 +Patch20: binutils-gas-dwarf-skip-empty-functions.patch #---------------------------------------------------------------------------- @@ -486,6 +451,20 @@ linker, and it may become deprecated in the future. #---------------------------------------------------------------------------- +%if %{with gprofng} + +%package gprofng +Summary: Next Generating code profiling tool +Provides: gprofng = %{version}-%{release} +Requires: binutils >= %{version} + +%description gprofng +Gprofng is the GNU Next Generation profiler for analyzing the performance +of Linux applications. Gprofng allows you to: +%endif + +#---------------------------------------------------------------------------- + %prep %autosetup -p1 -n binutils-%{version} @@ -633,6 +612,11 @@ esac %if %{with systemzlib} --with-system-zlib \ %endif +%if %{with gprofng} + --enable-gprofng=yes \ +%else + --enable-gprofng=no \ +%endif %if %{enable_shared} --enable-shared \ %else @@ -688,6 +672,7 @@ esac %if %{without testsuite} echo ====================TESTSUITE DISABLED========================= %else +# The GOLD testsuite has lots of problems... make -k check < /dev/null || : echo ====================TESTING========================= cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum @@ -905,9 +890,10 @@ exit 0 # %%verify(symlink) does not work for some reason, so using "owner" instead. %verify(owner) %{_bindir}/%{?cross}ld %{_bindir}/%{?cross}ld.bfd -# Do not export any Windows tools (if they were built) -%exclude %{_bindir}/%{?cross}dll* -%exclude %{_bindir}/%{?cross}wind* + +# # Do not export any Windows tools (if they were built) +# %%exclude %%{_bindir}/%%{?cross}dll* +# %%exclude %%{_bindir}/%%{?cross}wind* %if %{with docs} %{_mandir}/man1/ @@ -947,10 +933,34 @@ exit 0 %{_bindir}/%{?cross}ld.gold %endif +%if %{with gprofng} +%files gprofng +%{_infodir}/gprofng.info.* +%dir %{_libdir}/gprofng +%{_libdir}/gprofng/* +%dir %{_exec_prefix}/lib/debug/%{_libdir}/gprofng +%{_exec_prefix}/lib/debug/%{_libdir}/gprofng/libgp* +%{_sysconfdir}/gprofng.rc +%endif + # %%ghost %%{_bindir}/%%{?cross}ld #---------------------------------------------------------------------------- %changelog +* Thu Aug 11 2022 Nick Clifton - 2.39-1 +- Rebase to GNU Binutils 2.39. +- Retire: binutils-CVE-2019-1010204.patch +- Retire: binutils-use-long-long.patch +- Retire: binutils-section-type.patch +- Retire: binutils-gas-loc-view.patch +- Retire: binutils-do-not-use-debuginfod.patch +- Retire: binutils-indirect-symbols.patch +- Retire: binutils-s390x-static-PIE.patch +- Retire: binutils-link-following.patch +- Retire: binutils-x86-non-canonical-references.patch +- Retire: binutils-ppc64-DT_RELR-relocs.patch +- Retire: binutils-ppc-gas-machine-directive.patch + * Wed Aug 10 2022 Luca Boccassi - 2.38-24 - Build with jansson when not bootstrapping. diff --git a/sources b/sources index 7f0ee0f..db7779f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (binutils-2.38.tar.xz) = 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d +SHA512 (binutils-2.39.tar.xz) = 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2 From 92265683bfee865948f9cdeb83082ad11c76e456 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 16 Aug 2022 13:42:16 +0100 Subject: [PATCH 4/5] Move gprofng binaries and man pages into the gprofng sub-package --- binutils.spec | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/binutils.spec b/binutils.spec index f7c5808..ef45948 100644 --- a/binutils.spec +++ b/binutils.spec @@ -39,7 +39,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.39 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -887,6 +887,8 @@ exit 0 %license COPYING COPYING3 COPYING3.LIB COPYING.LIB %doc README %{_bindir}/%{?cross}[!l]* +%exclude %{_bindir}/gp-* +%exclude %{_bindir}/gprofng # %%verify(symlink) does not work for some reason, so using "owner" instead. %verify(owner) %{_bindir}/%{?cross}ld %{_bindir}/%{?cross}ld.bfd @@ -897,6 +899,8 @@ exit 0 %if %{with docs} %{_mandir}/man1/ +%exclude %{_mandir}/man1/gp-* +%exclude %{_mandir}/man1/gprofng* %if %{isnative} %{_infodir}/as.info.* %{_infodir}/binutils.info.* @@ -935,6 +939,10 @@ exit 0 %if %{with gprofng} %files gprofng +%{_bindir}/gp-* +%{_bindir}/gprofng +%{_mandir}/man1/gp-* +%{_mandir}/man1/gprofng* %{_infodir}/gprofng.info.* %dir %{_libdir}/gprofng %{_libdir}/gprofng/* @@ -947,6 +955,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Tue Aug 16 2022 Nick Clifton - 2.39-2 +- Move gprofng related files into the gprofng sub-package. + * Thu Aug 11 2022 Nick Clifton - 2.39-1 - Rebase to GNU Binutils 2.39. - Retire: binutils-CVE-2019-1010204.patch From dd133b6b81be8dbb0c1e7b31736c6b267c0c92e3 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 31 Aug 2022 15:50:50 +0100 Subject: [PATCH 5/5] Stop a potential infinite loop in the binutils DWARF parser. Resolves: #2122675 --- binutils-CVE-38128-dwarf-abbrev-parsing.patch | 15 +++++++++++++++ binutils.spec | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 binutils-CVE-38128-dwarf-abbrev-parsing.patch diff --git a/binutils-CVE-38128-dwarf-abbrev-parsing.patch b/binutils-CVE-38128-dwarf-abbrev-parsing.patch new file mode 100644 index 0000000..a175bb7 --- /dev/null +++ b/binutils-CVE-38128-dwarf-abbrev-parsing.patch @@ -0,0 +1,15 @@ +--- binutils.orig/binutils/dwarf.c 2022-08-31 11:58:08.918685348 +0100 ++++ binutils-2.39/binutils/dwarf.c 2022-08-31 15:24:13.881865797 +0100 +@@ -6365,7 +6365,11 @@ display_debug_abbrev (struct dwarf_secti + list->start_of_next_abbrevs = start; + } + else +- start = list->start_of_next_abbrevs; ++ { ++ if (start == list->start_of_next_abbrevs) ++ break; ++ start = list->start_of_next_abbrevs; ++ } + + if (list->first_abbrev == NULL) + continue; diff --git a/binutils.spec b/binutils.spec index ef45948..eda2dd3 100644 --- a/binutils.spec +++ b/binutils.spec @@ -39,7 +39,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.39 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -299,6 +299,10 @@ Patch19: binutils-package-metadata.patch # Lifetime: Fixed in 2.40 Patch20: binutils-gas-dwarf-skip-empty-functions.patch +# Purpose: Stop an infinite loop in the binutils DWARF decoder. (CVE 2022-38128) +# Lifetime: Fixed in 2.40 +Patch21: binutils-CVE-38128-dwarf-abbrev-parsing.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -955,6 +959,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Aug 31 2022 Nick Clifton - 2.39-3 +- Stop a potential infinite loop in the binutils DWARF parser. (#2122675) + * Tue Aug 16 2022 Nick Clifton - 2.39-2 - Move gprofng related files into the gprofng sub-package.