From c0524269631bbd6b22c41ea6f94ad8dc28a04c6e75acbe7b3770b570089b9f3f Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 16 Aug 2023 15:16:34 +0000 Subject: [PATCH 01/10] - Update to version 2.41: * The MIPS port now supports the Sony Interactive Entertainment Allegrex processor, used with the PlayStation Portable, which implements the MIPS II ISA along with a single-precision FPU and a few implementation-specific integer instructions. * Objdump's --private option can now be used on PE format files to display the fields in the file header and section headers. * New versioned release of libsframe: libsframe.so.1. This release introduces versioned symbols with version node name LIBSFRAME_1.0. This release also updates the ABI in an incompatible way: this includes removal of sframe_get_funcdesc_with_addr API, change in the behavior of sframe_fre_get_ra_offset and sframe_fre_get_fp_offset APIs. * SFrame Version 2 is now the default (and only) format version supported by gas, ld, readelf and objdump. * Add command-line option, --strip-section-headers, to objcopy and strip to remove ELF section header from ELF file. * The RISC-V port now supports the following new standard extensions: - Zicond (conditional zero instructions) - Zfa (additional floating-point instructions) - Zvbb, Zvbc, Zvkg, Zvkned, Zvknh[ab], Zvksed, Zvksh, Zvkn, Zvknc, Zvkng, Zvks, Zvksc, Zvkg, Zvkt (vector crypto instructions) * The RISC-V port now supports the following vendor-defined extensions: - XVentanaCondOps * Add support for Intel FRED, LKGS and AMX-COMPLEX instructions. * A new .insn directive is recognized by x86 gas. * Add SME2 support to the AArch64 port. * The linker now accepts a command line option of --remap-inputs = to relace any input file that matches with . In addition the option --remap-inputs-file= can be used to specify a file containing any number of these remapping directives. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=447 --- aarch64-common-pagesize.patch | 26 +++---- binutils-2.40-branch.diff.gz | 3 - binutils-2.40.tar.bz2 | 3 - binutils-2.40.tar.bz2.sig | 16 ----- binutils-2.41-branch.diff.gz | 3 + binutils-2.41.tar.bz2 | 3 + binutils-2.41.tar.bz2.sig | 16 +++++ binutils.changes | 52 ++++++++++++++ binutils.spec | 8 +-- riscv-dynamic-tls-reloc-pie.patch | 103 ---------------------------- riscv-pr22263-1.patch | 108 ------------------------------ 11 files changed, 89 insertions(+), 252 deletions(-) delete mode 100644 binutils-2.40-branch.diff.gz delete mode 100644 binutils-2.40.tar.bz2 delete mode 100644 binutils-2.40.tar.bz2.sig create mode 100644 binutils-2.41-branch.diff.gz create mode 100644 binutils-2.41.tar.bz2 create mode 100644 binutils-2.41.tar.bz2.sig delete mode 100644 riscv-dynamic-tls-reloc-pie.patch delete mode 100644 riscv-pr22263-1.patch diff --git a/aarch64-common-pagesize.patch b/aarch64-common-pagesize.patch index a20a66e..e6bea47 100644 --- a/aarch64-common-pagesize.patch +++ b/aarch64-common-pagesize.patch @@ -1,24 +1,24 @@ Change default common-page-size to 64K on aarch64. This enables the use of RELRO since we are using 64K pages. -Index: binutils-2.25.0/bfd/elfnn-aarch64.c +Index: binutils-2.41/bfd/elfnn-aarch64.c =================================================================== ---- binutils-2.25.0.orig/bfd/elfnn-aarch64.c -+++ binutils-2.25.0/bfd/elfnn-aarch64.c -@@ -9965,7 +9965,7 @@ const struct elf_size_info elfNN_aarch64_size_info = +--- binutils-2.41.orig/bfd/elfnn-aarch64.c 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/bfd/elfnn-aarch64.c 2023-08-16 16:31:51.238779641 +0200 +@@ -10251,7 +10251,7 @@ const struct elf_size_info elfNN_aarch64 #define ELF_ARCH bfd_arch_aarch64 #define ELF_MACHINE_CODE EM_AARCH64 #define ELF_MAXPAGESIZE 0x10000 -#define ELF_COMMONPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x10000 - #define bfd_elfNN_close_and_cleanup \ - elfNN_aarch64_close_and_cleanup -Index: binutils-2.25.0/gold/aarch64.cc + #define bfd_elfNN_bfd_free_cached_info \ + elfNN_aarch64_bfd_free_cached_info +Index: binutils-2.41/gold/aarch64.cc =================================================================== ---- binutils-2.25.0.orig/gold/aarch64.cc -+++ binutils-2.25.0/gold/aarch64.cc -@@ -791,7 +791,7 @@ const Target::Target_info Target_aarch64 +--- binutils-2.41.orig/gold/aarch64.cc 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/gold/aarch64.cc 2023-08-16 16:28:35.959450565 +0200 +@@ -3555,7 +3555,7 @@ const Target::Target_info Target_aarch64 "/lib/ld.so.1", // program interpreter 0x400000, // default_text_segment_address 0x10000, // abi_pagesize (overridable by -z max-page-size) @@ -27,7 +27,7 @@ Index: binutils-2.25.0/gold/aarch64.cc false, // isolate_execinstr 0, // rosegment_gap elfcpp::SHN_UNDEF, // small_common_shndx -@@ -818,7 +818,7 @@ const Target::Target_info Target_aarch64 +@@ -3584,7 +3584,7 @@ const Target::Target_info Target_aarch64 "/lib/ld.so.1", // program interpreter 0x400000, // default_text_segment_address 0x10000, // abi_pagesize (overridable by -z max-page-size) @@ -36,7 +36,7 @@ Index: binutils-2.25.0/gold/aarch64.cc false, // isolate_execinstr 0, // rosegment_gap elfcpp::SHN_UNDEF, // small_common_shndx -@@ -845,7 +845,7 @@ const Target::Target_info Target_aarch64 +@@ -3613,7 +3613,7 @@ const Target::Target_info Target_aarch64 "/lib/ld.so.1", // program interpreter 0x400000, // default_text_segment_address 0x10000, // abi_pagesize (overridable by -z max-page-size) @@ -45,7 +45,7 @@ Index: binutils-2.25.0/gold/aarch64.cc false, // isolate_execinstr 0, // rosegment_gap elfcpp::SHN_UNDEF, // small_common_shndx -@@ -872,7 +872,7 @@ const Target::Target_info Target_aarch64 +@@ -3642,7 +3642,7 @@ const Target::Target_info Target_aarch64 "/lib/ld.so.1", // program interpreter 0x400000, // default_text_segment_address 0x10000, // abi_pagesize (overridable by -z max-page-size) diff --git a/binutils-2.40-branch.diff.gz b/binutils-2.40-branch.diff.gz deleted file mode 100644 index dbd7c8c..0000000 --- a/binutils-2.40-branch.diff.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7978b2632b97d050013a2c76432981c9301f9cf9e81b19d8df88205e1be1182f -size 317038 diff --git a/binutils-2.40.tar.bz2 b/binutils-2.40.tar.bz2 deleted file mode 100644 index e8acc73..0000000 --- a/binutils-2.40.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f8298eb153a4b37d112e945aa5cb2850040bcf26a3ea65b5a715c83afe05e48a -size 35227554 diff --git a/binutils-2.40.tar.bz2.sig b/binutils-2.40.tar.bz2.sig deleted file mode 100644 index c9197b3..0000000 --- a/binutils-2.40.tar.bz2.sig +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEEOiS8Ho+0CfqfFDcYE/zvid2ePE8FAmPCvWIACgkQE/zvid2e -PE9Gtw/7BAYpMkL9WtPz07g6stVHQl2ZDKruNJt1mXo36RgBVjHPcemh8GQcVC5Q -EJ/fK83F6XTG7oiXr/EQxt8HXqbG3rLjfnS3IAXnjizVX6yujgf/XvUcqs00pzsk -Oiyxh7BO4YtKiuj7d7Yrl21iv103kQE6+UIChzCduQfSAD9RqtbINUZOoWklxjff -8zFfgAEA+7dij9LpACRmWSgnfn77kzdviHgscpIMsHC0mjyAZrIHuZy3BUeqmRY6 -TkHgQ3cl6ORieM0FN2eh9FN0Di+FwA+BVXijU6vNy26RveOtntK/Si1HC0R08z3g -1NJ2C8sL+LnmT3hFmmbFTbGA1haXlt6g1zPvQS8GVbeVoZQEn2Q7KH3I1KUaFRWQ -fzdpqR7oM2mG3RHytrNtDWKB7V9VY3FWNo9D1/5iBoX4IkXY0HsJQdl5geZR1vyr -SoL5MVwO8IfTKMZbQuC1fhllB2kL5ABa9pcm+VaWFzWccypffs5Us5sLDl3wug07 -2slVb76syHGkVsJgcNo1OhkfbvGGshMHoicN1InyjEVng2ml9/Ha86QUQEbhRjg1 -suFRfMmEAANSAwpkum6szYfE3EBz81VtMmPRjGxyYWsyU1W8LVxyiP9NlxkxYcdI -i4xZG9Q5AJQUcTsA3C9G6YZxSij1IQvDUIXQmFnLJpink7KAYNc= -=hWD9 ------END PGP SIGNATURE----- diff --git a/binutils-2.41-branch.diff.gz b/binutils-2.41-branch.diff.gz new file mode 100644 index 0000000..4b63519 --- /dev/null +++ b/binutils-2.41-branch.diff.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa95814ec895e47d81db0054e272b14cce073540ea2b85b5e0211bdf85ef9774 +size 81732 diff --git a/binutils-2.41.tar.bz2 b/binutils-2.41.tar.bz2 new file mode 100644 index 0000000..551d4ab --- /dev/null +++ b/binutils-2.41.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4c4bec052f7b8370024e60389e194377f3f48b56618418ea51067f67aaab30b +size 37132937 diff --git a/binutils-2.41.tar.bz2.sig b/binutils-2.41.tar.bz2.sig new file mode 100644 index 0000000..7e4fd14 --- /dev/null +++ b/binutils-2.41.tar.bz2.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEEOiS8Ho+0CfqfFDcYE/zvid2ePE8FAmTGcUQACgkQE/zvid2e +PE94TRAAsAGH/rarx1cyAxa8x0yKjcQxERag3KE3NXN+OnRvw2bCOfVx62UA68Dt +nTCsJ46MTSECdMnMj+b6wGNXr4JDv57r4lkJxJN8TjAS+gWrouqbjvaTPOkros3L +1uElw3JLBznDktYvv2aJxBTLSPRXxaD2gMSjVYSZ5X43/ITbNx8mSToevZf2erXB +ev+FY5ROyjPwFZyXTEYqqbbdJ4A6+Fkp1UO9UiQv3leZde29ZSiBbNZUU4u5FH3x +qNq9zTd4Wlk72X1IEK/HFIVAcFbV2bV38V/r64tw5WRndYReXejtEQMm4kvzFZP4 +tcgzlTNViTN8FmVNI3P3pByFxC4VmNEbnNCGTDzltuC/RxypqMHWdkBIFU2Zpk4p +oAuRMx+7MJ0MqbZjV+VklZAqbl71oDAtUEi7gwKL/UFsRnmUbjRV00YQrXv1kmm8 +FAuK3UJbfX95MkMV9RSB4kwAdGTLv9CpWix+NGIQs17bnYXyuZPQ0OFuYM6xBDlo +IXTS3kvAgKLRni7EQ0xAh3CqQaE5vsLHf7WwTYvi4rWdt0B1hVpFJtpkAhWRrF/N +5Hey/pJgOaS2CqEpbijkfG6mGh/xNYK0T8HnHse1pKjl1U1QEgOtluVI3UF2C/H/ +FkrlClxbExTt9+UmuF/wdvttVj7hDooI7Hh11uvOVBabtlUc66E= +=6jCW +-----END PGP SIGNATURE----- diff --git a/binutils.changes b/binutils.changes index bc20347..fff0859 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,55 @@ +------------------------------------------------------------------- +Wed Aug 16 14:36:57 UTC 2023 - Michael Matz + +- Update to version 2.41: +* The MIPS port now supports the Sony Interactive Entertainment Allegrex + processor, used with the PlayStation Portable, which implements the MIPS + II ISA along with a single-precision FPU and a few implementation-specific + integer instructions. +* Objdump's --private option can now be used on PE format files to display the + fields in the file header and section headers. +* New versioned release of libsframe: libsframe.so.1. This release introduces + versioned symbols with version node name LIBSFRAME_1.0. This release also + updates the ABI in an incompatible way: this includes removal of + sframe_get_funcdesc_with_addr API, change in the behavior of + sframe_fre_get_ra_offset and sframe_fre_get_fp_offset APIs. +* SFrame Version 2 is now the default (and only) format version supported by + gas, ld, readelf and objdump. +* Add command-line option, --strip-section-headers, to objcopy and strip to + remove ELF section header from ELF file. +* The RISC-V port now supports the following new standard extensions: + - Zicond (conditional zero instructions) + - Zfa (additional floating-point instructions) + - Zvbb, Zvbc, Zvkg, Zvkned, Zvknh[ab], Zvksed, Zvksh, Zvkn, Zvknc, Zvkng, + Zvks, Zvksc, Zvkg, Zvkt (vector crypto instructions) +* The RISC-V port now supports the following vendor-defined extensions: + - XVentanaCondOps +* Add support for Intel FRED, LKGS and AMX-COMPLEX instructions. +* A new .insn directive is recognized by x86 gas. +* Add SME2 support to the AArch64 port. +* The linker now accepts a command line option of --remap-inputs + = to relace any input file that matches with + . In addition the option --remap-inputs-file= can be used to + specify a file containing any number of these remapping directives. +* The linker command line option --print-map-locals can be used to include + local symbols in a linker map. (ELF targets only). +* For most ELF based targets, if the --enable-linker-version option is used + then the version of the linker will be inserted as a string into the .comment + section. +* The linker script syntax has a new command for output sections: ASCIZ "string" + This will insert a zero-terminated string at the current location. +* Add command-line option, -z nosectionheader, to omit ELF section + header. +- Removed obsolete patches: binutils-2.40-branch.diff.gz, + riscv-dynamic-tls-reloc-pie.patch, riscv-pr22263-1.patch . +- Add binutils-2.41-branch.diff.gz . +- Rebased aarch64-common-pagesize.patch . +- Contains fixes for these CVEs: + * bsc#1209642 aka CVE-2023-1579 aka PR29988 + * bsc#1210297 aka CVE-2023-1972 aka PR30285 + * bsc#1210733 aka CVE-2023-2222 aka PR29936 + * bsc#1213458 aka CVE-2021-32256 aka PR105039 (gcc) + ------------------------------------------------------------------- Tue May 30 09:43:15 UTC 2023 - Andreas Schwab diff --git a/binutils.spec b/binutils.spec index 53e09ae..ada7554 100644 --- a/binutils.spec +++ b/binutils.spec @@ -64,7 +64,7 @@ BuildRequires: zlib-devel %if %{suse_version} > 1500 BuildRequires: libzstd-devel %endif -Version: 2.40 +Version: 2.41 Release: 0 # disable libalternatives for now until it's changed to not @@ -131,7 +131,7 @@ Source: binutils-%{version}.tar.bz2 Source2: binutils-%{version}.tar.bz2.sig Source3: binutils.keyring Source4: baselibs.conf -Patch1: binutils-2.40-branch.diff.gz +Patch1: binutils-2.41-branch.diff.gz Patch3: binutils-skip-rpaths.patch Patch4: s390-biarch.diff Patch5: x86-64-biarch.patch @@ -154,8 +154,6 @@ Patch42: binutils-compat-old-behaviour.diff Patch43: binutils-revert-hlasm-insns.diff Patch44: binutils-revert-rela.diff Patch45: extensa-gcc-4_3-fix.diff -Patch46: riscv-dynamic-tls-reloc-pie.patch -Patch47: riscv-pr22263-1.patch Patch100: add-ulp-section.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch @@ -280,8 +278,6 @@ cp ld/ldgram.y ld/ldgram.y.orig %patch44 -p1 %patch45 -p1 %endif -%patch46 -p1 -%patch47 -p1 %patch100 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h diff --git a/riscv-dynamic-tls-reloc-pie.patch b/riscv-dynamic-tls-reloc-pie.patch deleted file mode 100644 index d72527a..0000000 --- a/riscv-dynamic-tls-reloc-pie.patch +++ /dev/null @@ -1,103 +0,0 @@ -From f491758f183592cbf8113e02a2bebbd412ff7358 Mon Sep 17 00:00:00 2001 -From: Nelson Chu -Date: Thu, 4 May 2023 17:08:50 +0800 -Subject: [PATCH] [PR ld/22263][PR ld/25694] RISC-V: Avoid dynamic TLS relocs - in PIE. - -Lots of targets already fixed the TEXTREL problem for TLS in PIE. - -* For PR ld/25694, -In the check_reloc, refer to spare and loongarch, they don't need to reserve -any local dynamic reloc for TLS LE in pie/pde, and similar to other targets. -So it seems like riscv was too conservative to estimate the TLS LE before. -Just break and don't goto static_reloc for TLS LE in pie/pde can fix the -TEXTREL problem. - -* For PR ld/22263, -The risc-v code for TLS GD/IE in the relocate_section seems same as MIPS port. -So similar to MIPS, pr22570, commits 9143e72c6d4d and 1cb83cac9a89, it seems -also the right way to do the same thing for risc-v. - -On risc-v, fixes -FAIL: Build pr22263-1 - -RISC-V haven't supported the TLS transitions, so will need the same fix (use -bfd_link_dll) in the future. - -bfd/ - PR ld/22263 - PR ld/25694 - * elfnn-riscv.c (riscv_elf_check_relocs): Replace bfd_link_pic with - bfd_link_dll for TLS IE. Don't need to reserve the local dynamic - relocation for TLS LE in pie/pde, and report error in pic just like - before. - (riscv_elf_relocate_section): For TLS GD/IE, use bfd_link_dll rather - than !bfd_link_pic in determining the dynamic symbol index. Avoid - the index of -1. ---- - bfd/elfnn-riscv.c | 25 +++++++++++-------------- - 1 file changed, 11 insertions(+), 14 deletions(-) - -diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c -index 4a5da7df3fe..ee2d19f7699 100644 ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -732,7 +732,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, - break; - - case R_RISCV_TLS_GOT_HI20: -- if (bfd_link_pic (info)) -+ if (bfd_link_dll (info)) - info->flags |= DF_STATIC_TLS; - if (!riscv_elf_record_got_reference (abfd, info, h, r_symndx) - || !riscv_elf_record_tls_type (abfd, h, r_symndx, GOT_TLS_IE)) -@@ -787,11 +787,12 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, - goto static_reloc; - - case R_RISCV_TPREL_HI20: -+ /* This is not allowed in the pic, but okay in pie. */ - if (!bfd_link_executable (info)) - return bad_static_reloc (abfd, r_type, h); - if (h != NULL) - riscv_elf_record_tls_type (abfd, h, r_symndx, GOT_TLS_LE); -- goto static_reloc; -+ break; - - case R_RISCV_HI20: - if (bfd_link_pic (info)) -@@ -2689,24 +2690,20 @@ riscv_elf_relocate_section (bfd *output_bfd, - if (htab->elf.srelgot == NULL) - abort (); - -- if (h != NULL) -- { -- bool dyn, pic; -- dyn = htab->elf.dynamic_sections_created; -- pic = bfd_link_pic (info); -- -- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, pic, h) -- && (!pic || !SYMBOL_REFERENCES_LOCAL (info, h))) -- indx = h->dynindx; -- } -+ bool dyn = elf_hash_table (info)->dynamic_sections_created; -+ if (h != NULL -+ && h->dynindx != -1 -+ && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h) -+ && (bfd_link_dll (info) || !SYMBOL_REFERENCES_LOCAL (info, h))) -+ indx = h->dynindx; - - /* The GOT entries have not been initialized yet. Do it - now, and emit any relocations. */ -- if ((bfd_link_pic (info) || indx != 0) -+ if ((bfd_link_dll (info) || indx != 0) - && (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak)) -- need_relocs = true; -+ need_relocs = true; - - if (tls_type & GOT_TLS_GD) - { --- -2.40.1 - diff --git a/riscv-pr22263-1.patch b/riscv-pr22263-1.patch deleted file mode 100644 index 7ee853c..0000000 --- a/riscv-pr22263-1.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 53e0482788fa665f532936ba3637bc0fcde6db2c Mon Sep 17 00:00:00 2001 -From: Nelson Chu -Date: Sat, 27 May 2023 09:36:20 +0800 -Subject: [PATCH] RISC-V: Avoid spurious R_RISCV_NONE for pr22263-1 test. - -For TLS GD/IE, add the same condition with the relocate_section in the -allocate_dynrelocs, to make sure we won't reserve redundant spaces -for dynamic relocations since the conservative estimatation. - -After applying this patch, ld seems no longer generate the spurious -R_RISCV_NONE for pr22263-1 test. - -bfd/ - PR ld/22263 - * elfnn-riscv.c (RISCV_TLS_GD_IE_NEED_DYN_RELOC): New defined. - Set NEED_RELOC to true if TLS GD/IE needs dynamic relocations, - and INDX will be the dynamic index. - (allocate_dynrelocs): Don't reserve extra spaces in the rela.got - if RISCV_TLS_GD_IE_NEED_DYN_RELOC set need_reloc to false. This - condition needs to be same as relocate_section. - (relocate_section): Likewise, use the same condition as - allocate_dynrelocs. ---- - bfd/elfnn-riscv.c | 41 ++++++++++++++++++++++++++++------------- - 1 file changed, 28 insertions(+), 13 deletions(-) - -diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c -index ee2d19f7699..d02c4a29324 100644 ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -38,6 +38,25 @@ - #define CHAR_BIT 8 - #endif - -+/* Set NEED_RELOC to true if TLS GD/IE needs dynamic relocations, and INDX will -+ be the dynamic index. PR22263, use the same check in allocate_dynrelocs and -+ riscv_elf_relocate_section for TLS GD/IE. */ -+#define RISCV_TLS_GD_IE_NEED_DYN_RELOC(INFO, DYN, H, INDX, NEED_RELOC) \ -+ do \ -+ { \ -+ if ((H) != NULL \ -+ && (H)->dynindx != -1 \ -+ && WILL_CALL_FINISH_DYNAMIC_SYMBOL ((DYN), bfd_link_pic (INFO), (H)) \ -+ && (bfd_link_dll (INFO) || !SYMBOL_REFERENCES_LOCAL ((INFO), (H)))) \ -+ (INDX) = (H)->dynindx; \ -+ if ((bfd_link_dll (INFO) || (INDX) != 0) \ -+ && ((H) == NULL \ -+ || ELF_ST_VISIBILITY ((H)->other) == STV_DEFAULT \ -+ || (H)->root.type != bfd_link_hash_undefweak)) \ -+ (NEED_RELOC) = true; \ -+ } \ -+ while (0) -+ - /* Internal relocations used exclusively by the relaxation pass. */ - #define R_RISCV_DELETE (R_RISCV_max + 1) - -@@ -1186,18 +1205,24 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) - dyn = htab->elf.dynamic_sections_created; - if (tls_type & (GOT_TLS_GD | GOT_TLS_IE)) - { -+ int indx = 0; -+ bool need_reloc = false; -+ RISCV_TLS_GD_IE_NEED_DYN_RELOC(info, dyn, h, indx, need_reloc); -+ - /* TLS_GD needs two dynamic relocs and two GOT slots. */ - if (tls_type & GOT_TLS_GD) - { - s->size += 2 * RISCV_ELF_WORD_BYTES; -- htab->elf.srelgot->size += 2 * sizeof (ElfNN_External_Rela); -+ if (need_reloc) -+ htab->elf.srelgot->size += 2 * sizeof (ElfNN_External_Rela); - } - - /* TLS_IE needs one dynamic reloc and one GOT slot. */ - if (tls_type & GOT_TLS_IE) - { - s->size += RISCV_ELF_WORD_BYTES; -- htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); -+ if (need_reloc) -+ htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); - } - } - else -@@ -2691,20 +2716,10 @@ riscv_elf_relocate_section (bfd *output_bfd, - abort (); - - bool dyn = elf_hash_table (info)->dynamic_sections_created; -- if (h != NULL -- && h->dynindx != -1 -- && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h) -- && (bfd_link_dll (info) || !SYMBOL_REFERENCES_LOCAL (info, h))) -- indx = h->dynindx; -+ RISCV_TLS_GD_IE_NEED_DYN_RELOC (info, dyn, h, indx, need_relocs); - - /* The GOT entries have not been initialized yet. Do it - now, and emit any relocations. */ -- if ((bfd_link_dll (info) || indx != 0) -- && (h == NULL -- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -- || h->root.type != bfd_link_hash_undefweak)) -- need_relocs = true; -- - if (tls_type & GOT_TLS_GD) - { - if (need_relocs) --- -2.40.1 - From 16ef8f473228d2afbd44a37f6adf4b5bfdf30fa9852a0bdb983685279d550fb7 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 16 Aug 2023 15:44:33 +0000 Subject: [PATCH 02/10] riscv-dynamic-tls-reloc-pie.patch, riscv-pr22263-1.patch, extensa-gcc-4_3-fix.diff . - Rebased aarch64-common-pagesize.patch and binutils-revert-rela.diff . OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=448 --- binutils-revert-rela.diff | 74 +++++++++++++++++++-------------------- binutils.changes | 5 +-- binutils.spec | 2 -- extensa-gcc-4_3-fix.diff | 20 ----------- 4 files changed, 40 insertions(+), 61 deletions(-) delete mode 100644 extensa-gcc-4_3-fix.diff diff --git a/binutils-revert-rela.diff b/binutils-revert-rela.diff index 88bd235..5ac3ab8 100644 --- a/binutils-revert-rela.diff +++ b/binutils-revert-rela.diff @@ -26,10 +26,10 @@ of missing support in ld.so. proper predicate to guard themself) -Index: binutils-2.40/bfd/elf64-x86-64.c +Index: binutils-2.41/bfd/elf64-x86-64.c =================================================================== ---- binutils-2.40.orig/bfd/elf64-x86-64.c 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/bfd/elf64-x86-64.c 2023-03-08 16:22:22.915673946 +0100 +--- binutils-2.41.orig/bfd/elf64-x86-64.c 2023-08-16 17:34:14.991069097 +0200 ++++ binutils-2.41/bfd/elf64-x86-64.c 2023-08-16 17:34:48.295651473 +0200 @@ -48,127 +48,127 @@ static reloc_howto_type x86_64_elf_howto bfd_elf_generic_reloc, "R_X86_64_NONE", false, 0, 0x00000000, false), @@ -208,21 +208,9 @@ Index: binutils-2.40/bfd/elf64-x86-64.c false) }; -Index: binutils-2.40/gas/testsuite/gas/i386/i386.exp +Index: binutils-2.41/gas/testsuite/gas/i386/rela.d =================================================================== ---- binutils-2.40.orig/gas/testsuite/gas/i386/i386.exp 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/gas/testsuite/gas/i386/i386.exp 2023-03-08 16:22:22.915673946 +0100 -@@ -1328,7 +1328,6 @@ if [gas_64_check] then { - run_list_test "reloc64" "--defsym _bad_=1" - run_list_test "x86-64-inval-tls" - run_dump_test "mixed-mode-reloc64" -- run_dump_test "rela" - run_dump_test "x86-64-ifunc" - run_dump_test "x86-64-opcode-inval" - run_dump_test "x86-64-opcode-inval-intel" -Index: binutils-2.40/gas/testsuite/gas/i386/rela.d -=================================================================== ---- binutils-2.40.orig/gas/testsuite/gas/i386/rela.d 2023-03-08 16:21:20.818669606 +0100 +--- binutils-2.41.orig/gas/testsuite/gas/i386/rela.d 2023-07-03 01:00:00.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#name: x86-64 rela relocs w/ non-zero relocated fields @@ -238,9 +226,9 @@ Index: binutils-2.40/gas/testsuite/gas/i386/rela.d - -Contents of section .data: - 0+0 11 ?11 ?11 ?11 22 ?22 ?22 ?22 33 ?33 ?33 ?33 44 ?44 ?44 ?44 .* -Index: binutils-2.40/gas/testsuite/gas/i386/rela.s +Index: binutils-2.41/gas/testsuite/gas/i386/rela.s =================================================================== ---- binutils-2.40.orig/gas/testsuite/gas/i386/rela.s 2023-03-08 16:21:20.818669606 +0100 +--- binutils-2.41.orig/gas/testsuite/gas/i386/rela.s 2023-07-03 01:00:00.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Note: This file is also used by an ld test case. @@ -257,9 +245,9 @@ Index: binutils-2.40/gas/testsuite/gas/i386/rela.s - - .reloc l, BFD_RELOC_64, q - .reloc q, BFD_RELOC_32, l -Index: binutils-2.40/ld/testsuite/ld-x86-64/rela.d +Index: binutils-2.41/ld/testsuite/ld-x86-64/rela.d =================================================================== ---- binutils-2.40.orig/ld/testsuite/ld-x86-64/rela.d 2023-03-08 16:21:20.818669606 +0100 +--- binutils-2.41.orig/ld/testsuite/ld-x86-64/rela.d 2023-07-03 01:00:00.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -#name: x86-64 rela relocs w/ non-zero relocated fields @@ -272,10 +260,10 @@ Index: binutils-2.40/ld/testsuite/ld-x86-64/rela.d - -Contents of section .data: - *[0-9a-f]*0 .8 ?.. ?.. ?.. 00 ?00 ?00 ?00 .0 ?.. ?.. ?.. 44 ?44 ?44 ?44 .* -Index: binutils-2.40/ld/testsuite/ld-x86-64/x86-64.exp +Index: binutils-2.41/ld/testsuite/ld-x86-64/x86-64.exp =================================================================== ---- binutils-2.40.orig/ld/testsuite/ld-x86-64/x86-64.exp 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/ld/testsuite/ld-x86-64/x86-64.exp 2023-03-08 16:22:22.919674009 +0100 +--- binutils-2.41.orig/ld/testsuite/ld-x86-64/x86-64.exp 2023-08-16 17:34:14.967068677 +0200 ++++ binutils-2.41/ld/testsuite/ld-x86-64/x86-64.exp 2023-08-16 17:34:48.295651473 +0200 @@ -286,7 +286,6 @@ run_dump_test "apic" run_dump_test "pcrel8" run_dump_test "pcrel16" @@ -299,11 +287,11 @@ Index: binutils-2.40/ld/testsuite/ld-x86-64/x86-64.exp if { ![skip_sframe_tests] } { run_dump_test "sframe-simple-1" -Index: binutils-2.40/binutils/testsuite/lib/binutils-common.exp +Index: binutils-2.41/binutils/testsuite/lib/binutils-common.exp =================================================================== ---- binutils-2.40.orig/binutils/testsuite/lib/binutils-common.exp 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/binutils/testsuite/lib/binutils-common.exp 2023-03-08 16:22:22.919674009 +0100 -@@ -429,6 +429,8 @@ proc supports_persistent_section {} { +--- binutils-2.41.orig/binutils/testsuite/lib/binutils-common.exp 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/binutils/testsuite/lib/binutils-common.exp 2023-08-16 17:34:48.295651473 +0200 +@@ -442,6 +442,8 @@ proc supports_persistent_section {} { # Whether a target support DT_RELR sections. proc supports_dt_relr {} { @@ -312,10 +300,10 @@ Index: binutils-2.40/binutils/testsuite/lib/binutils-common.exp if { ([istarget x86_64-*-*] || [istarget i?86-*-*] || [istarget powerpc64*-*-*]) -Index: binutils-2.40/ld/emulparams/dt-relr.sh +Index: binutils-2.41/ld/emulparams/dt-relr.sh =================================================================== ---- binutils-2.40.orig/ld/emulparams/dt-relr.sh 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/ld/emulparams/dt-relr.sh 2023-03-08 16:22:22.919674009 +0100 +--- binutils-2.41.orig/ld/emulparams/dt-relr.sh 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/ld/emulparams/dt-relr.sh 2023-08-16 17:34:48.295651473 +0200 @@ -1,3 +1,8 @@ +if false; then + # on old codestreams we don't have the DT_RELR support in the dynamic @@ -331,10 +319,10 @@ Index: binutils-2.40/ld/emulparams/dt-relr.sh PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_PACK_RELATIVE_RELOCS" + +fi -Index: binutils-2.40/ld/testsuite/ld-i386/i386.exp +Index: binutils-2.41/ld/testsuite/ld-i386/i386.exp =================================================================== ---- binutils-2.40.orig/ld/testsuite/ld-i386/i386.exp 2023-03-08 16:21:20.818669606 +0100 -+++ binutils-2.40/ld/testsuite/ld-i386/i386.exp 2023-03-08 16:22:22.919674009 +0100 +--- binutils-2.41.orig/ld/testsuite/ld-i386/i386.exp 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/ld/testsuite/ld-i386/i386.exp 2023-08-16 17:34:48.299651544 +0200 @@ -507,8 +507,8 @@ run_dump_test "pr27491-1c" run_dump_test "pr27491-2" run_dump_test "pr27491-3" @@ -346,10 +334,10 @@ Index: binutils-2.40/ld/testsuite/ld-i386/i386.exp run_dump_test "pr28870" run_dump_test "pr28894" -Index: binutils-2.40/ld/testsuite/ld-powerpc/powerpc.exp +Index: binutils-2.41/ld/testsuite/ld-powerpc/powerpc.exp =================================================================== ---- binutils-2.40.orig/ld/testsuite/ld-powerpc/powerpc.exp 2023-01-14 01:00:00.000000000 +0100 -+++ binutils-2.40/ld/testsuite/ld-powerpc/powerpc.exp 2023-03-08 16:25:29.926698626 +0100 +--- binutils-2.41.orig/ld/testsuite/ld-powerpc/powerpc.exp 2023-08-16 17:34:14.895067416 +0200 ++++ binutils-2.41/ld/testsuite/ld-powerpc/powerpc.exp 2023-08-16 17:34:48.299651544 +0200 @@ -378,14 +378,14 @@ set ppc64elftests { "-a64" {abs-reloc.s} {{objdump {-sdr} abs-shared.d} @@ -373,3 +361,15 @@ Index: binutils-2.40/ld/testsuite/ld-powerpc/powerpc.exp } set ppceabitests { +Index: binutils-2.41/gas/testsuite/gas/i386/x86-64.exp +=================================================================== +--- binutils-2.41.orig/gas/testsuite/gas/i386/x86-64.exp 2023-07-03 01:00:00.000000000 +0200 ++++ binutils-2.41/gas/testsuite/gas/i386/x86-64.exp 2023-08-16 17:38:35.023605534 +0200 +@@ -588,7 +588,6 @@ if [is_elf_format] then { + run_list_test "reloc64" "--defsym _bad_=1" + run_list_test "x86-64-inval-tls" + run_dump_test "mixed-mode-reloc64" +- run_dump_test "rela" + run_dump_test "x86-64-ifunc" + if { [gas_32_check] } then { + run_dump_test "x86-64-opcode-inval" diff --git a/binutils.changes b/binutils.changes index fff0859..517d7a7 100644 --- a/binutils.changes +++ b/binutils.changes @@ -41,9 +41,10 @@ Wed Aug 16 14:36:57 UTC 2023 - Michael Matz * Add command-line option, -z nosectionheader, to omit ELF section header. - Removed obsolete patches: binutils-2.40-branch.diff.gz, - riscv-dynamic-tls-reloc-pie.patch, riscv-pr22263-1.patch . + riscv-dynamic-tls-reloc-pie.patch, riscv-pr22263-1.patch, + extensa-gcc-4_3-fix.diff . - Add binutils-2.41-branch.diff.gz . -- Rebased aarch64-common-pagesize.patch . +- Rebased aarch64-common-pagesize.patch and binutils-revert-rela.diff . - Contains fixes for these CVEs: * bsc#1209642 aka CVE-2023-1579 aka PR29988 * bsc#1210297 aka CVE-2023-1972 aka PR30285 diff --git a/binutils.spec b/binutils.spec index ada7554..4a05b3c 100644 --- a/binutils.spec +++ b/binutils.spec @@ -153,7 +153,6 @@ Patch41: binutils-fix-relax.diff Patch42: binutils-compat-old-behaviour.diff Patch43: binutils-revert-hlasm-insns.diff Patch44: binutils-revert-rela.diff -Patch45: extensa-gcc-4_3-fix.diff Patch100: add-ulp-section.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch @@ -276,7 +275,6 @@ cp ld/ldgram.y ld/ldgram.y.orig %patch42 -p1 %patch43 -p1 %patch44 -p1 -%patch45 -p1 %endif %patch100 -p1 %if "%{TARGET}" == "avr" diff --git a/extensa-gcc-4_3-fix.diff b/extensa-gcc-4_3-fix.diff deleted file mode 100644 index a5c4bfa..0000000 --- a/extensa-gcc-4_3-fix.diff +++ /dev/null @@ -1,20 +0,0 @@ -# This fixes: -# -# [ 146s] In file included from ../../bfd/xtensa-isa.c:26: -# [ 146s] ../../bfd/../include/xtensa-dynconfig.h:107: error: redefinition of typedef 'xtensa_isa_internal' -# [ 146s] ../../bfd/../include/xtensa-isa-internal.h:227: error: previous declaration of 'xtensa_isa_internal' was here -# -# which is a strange issue with GCC 4.3 - -diff --git a/include/xtensa-dynconfig.h b/include/xtensa-dynconfig.h -index bb72d6ab22d..9c66ac4416d 100644 ---- a/include/xtensa-dynconfig.h -+++ b/include/xtensa-dynconfig.h -@@ -104,7 +104,6 @@ struct xtensa_config_v2 - int xtensa_march_earliest; - }; - --typedef struct xtensa_isa_internal_struct xtensa_isa_internal; - - extern const void *xtensa_load_config (const char *name, - const void *no_plugin_def, From fd511406bccca53263ed044e0df3b951fb8f2c7af57beb4e2fbee9817383d06b Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 16 Aug 2023 15:58:52 +0000 Subject: [PATCH 03/10] - Add binutils-old-makeinfo.diff for SLE-12 and older. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=449 --- binutils-old-makeinfo.diff | 176 +++++++++++++++++++++++++++++++++++++ binutils.changes | 1 + binutils.spec | 4 + 3 files changed, 181 insertions(+) create mode 100644 binutils-old-makeinfo.diff diff --git a/binutils-old-makeinfo.diff b/binutils-old-makeinfo.diff new file mode 100644 index 0000000..26d760d --- /dev/null +++ b/binutils-old-makeinfo.diff @@ -0,0 +1,176 @@ +This reverts 8bb23cdbb498ff645bb0937bc8c0cb89e9e5ebd8 which +requires newer makeinfo that we don't have in SLE12. + +diff --git a/bfd/doc/bfd.texi b/bfd/doc/bfd.texi +index d8cc1ecca48..f348710845f 100644 +--- a/bfd/doc/bfd.texi ++++ b/bfd/doc/bfd.texi +@@ -75,7 +75,7 @@ Copyright @copyright{} 1991-2023 Free Software Foundation, Inc. + @end iftex + @contents + +-@node Top ++@node Top, Overview, (dir), (dir) + @ifinfo + This file documents the binary file descriptor library libbfd. + @end ifinfo +@@ -88,7 +88,7 @@ This file documents the binary file descriptor library libbfd. + * BFD Index:: BFD Index + @end menu + +-@node Overview ++@node Overview, BFD front end, Top, Top + @chapter Introduction + @cindex BFD + @cindex what is it? +@@ -114,7 +114,7 @@ their own use, for greater efficiency. + * What BFD Version 2 Can Do:: What BFD Version 2 Can Do + @end menu + +-@node History ++@node History, How It Works, Overview, Overview + @section History + + One spur behind BFD was the desire, on the part of the GNU 960 team at +@@ -137,7 +137,7 @@ and David Henkel-Wallace (@code{gumby@@cygnus.com}). + + + +-@node How It Works ++@node How It Works, What BFD Version 2 Can Do, History, Overview + @section How To Use BFD + + To use the library, include @file{bfd.h} and link with @file{libbfd.a}. +@@ -188,11 +188,11 @@ and contain subordinate BFDs. This approach is fine for a.out and coff, + but loses efficiency when applied to formats such as S-records and + IEEE-695. + +-@node What BFD Version 2 Can Do ++@node What BFD Version 2 Can Do, , How It Works, Overview + @section What BFD Version 2 Can Do + @include bfdsumm.texi + +-@node BFD front end ++@node BFD front end, BFD back ends, Overview, Top + @chapter BFD Front End + + @menu +@@ -219,7 +219,7 @@ IEEE-695. + @include bfdt.texi + @include bfdio.texi + +-@node Memory Usage ++@node Memory Usage, Sections, Miscellaneous, BFD front end + @section Memory Usage + BFD keeps all of its internal structures in obstacks. There is one obstack + per open BFD file, into which the current state is stored. When a BFD is +@@ -242,46 +242,46 @@ select the greediest open BFD, close it to reclaim the memory, perform + some operation and reopen the BFD again, to get a fresh copy of the data + structures. + +-@node Sections ++@node Sections, Symbols, Memory Usage, BFD front end + @include section.texi + +-@node Symbols ++@node Symbols, Archives, Sections, BFD front end + @include syms.texi + +-@node Archives ++@node Archives, Formats, Symbols, BFD front end + @include archive.texi + +-@node Formats ++@node Formats, Relocations, Archives, BFD front end + @include format.texi + +-@node Relocations ++@node Relocations, Core Files, Formats, BFD front end + @include reloc.texi + +-@node Core Files ++@node Core Files, Targets, Relocations, BFD front end + @include corefile.texi + +-@node Targets ++@node Targets, Architectures, Core Files, BFD front end + @include targets.texi + +-@node Architectures ++@node Architectures, Opening and Closing, Targets, BFD front end + @include archures.texi + +-@node Opening and Closing ++@node Opening and Closing, Internal, Architectures, BFD front end + @include opncls.texi + +-@node Internal ++@node Internal, File Caching, Opening and Closing, BFD front end + @include libbfd.texi + +-@node File Caching ++@node File Caching, Linker Functions, Internal, BFD front end + @include cache.texi + +-@node Linker Functions ++@node Linker Functions, Hash Tables, File Caching, BFD front end + @include linker.texi + +-@node Hash Tables ++@node Hash Tables, , Linker Functions, BFD front end + @include hash.texi + +-@node BFD back ends ++@node BFD back ends, GNU Free Documentation License, BFD front end, Top + @chapter BFD back ends + @menu + * What to Put Where:: +@@ -293,28 +293,28 @@ structures. + * srecord :: s-record backend + @end ignore + @end menu +-@node What to Put Where ++@node What to Put Where, aout, BFD back ends, BFD back ends + @section What to Put Where + All of BFD lives in one directory. + +-@node aout ++@node aout, coff, What to Put Where, BFD back ends + @include aoutx.texi + +-@node coff ++@node coff, elf, aout, BFD back ends + @include coffcode.texi + +-@node elf ++@node elf, mmo, coff, BFD back ends + @include elf.texi + @c Leave this out until the file has some actual contents... + @c @include elfcode.texi + +-@node mmo ++@node mmo, , elf, BFD back ends + @include mmo.texi + +-@node GNU Free Documentation License ++@node GNU Free Documentation License, BFD Index, BFD back ends, Top + @include fdl.texi + +-@node BFD Index ++@node BFD Index, , GNU Free Documentation License, Top + @unnumbered BFD Index + @printindex cp + +diff --git a/bfd/doc/webassembly.texi b/bfd/doc/webassembly.texi +index 5a05199d5f7..ad650943a1a 100644 +--- a/bfd/doc/webassembly.texi ++++ b/bfd/doc/webassembly.texi +@@ -27,7 +27,7 @@ in some malformed WebAssembly modules being treated as valid. + * File layout:: + @end menu + +-@node File layout ++@node File layout, WebAssembly + @subsection File layout + For a description of the WebAssembly file format, see + @url{https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md}. diff --git a/binutils.changes b/binutils.changes index 517d7a7..c8d6838 100644 --- a/binutils.changes +++ b/binutils.changes @@ -44,6 +44,7 @@ Wed Aug 16 14:36:57 UTC 2023 - Michael Matz riscv-dynamic-tls-reloc-pie.patch, riscv-pr22263-1.patch, extensa-gcc-4_3-fix.diff . - Add binutils-2.41-branch.diff.gz . +- Add binutils-old-makeinfo.diff for SLE-12 and older. - Rebased aarch64-common-pagesize.patch and binutils-revert-rela.diff . - Contains fixes for these CVEs: * bsc#1209642 aka CVE-2023-1579 aka PR29988 diff --git a/binutils.spec b/binutils.spec index 4a05b3c..6c6cebe 100644 --- a/binutils.spec +++ b/binutils.spec @@ -153,6 +153,7 @@ Patch41: binutils-fix-relax.diff Patch42: binutils-compat-old-behaviour.diff Patch43: binutils-revert-hlasm-insns.diff Patch44: binutils-revert-rela.diff +Patch45: binutils-old-makeinfo.diff Patch100: add-ulp-section.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch @@ -276,6 +277,9 @@ cp ld/ldgram.y ld/ldgram.y.orig %patch43 -p1 %patch44 -p1 %endif +%if %{suse_version} < 1500 +%patch45 -p1 +%endif %patch100 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h From 4c9b49f650d479b736b7c8e5f17f6826f071cdc2e825381d8e8123145daf0353 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 7 Sep 2023 14:04:30 +0000 Subject: [PATCH 04/10] Adjust changes to match SLE versions OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=450 --- binutils.changes | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/binutils.changes b/binutils.changes index c8d6838..94acd01 100644 --- a/binutils.changes +++ b/binutils.changes @@ -52,6 +52,18 @@ Wed Aug 16 14:36:57 UTC 2023 - Michael Matz * bsc#1210733 aka CVE-2023-2222 aka PR29936 * bsc#1213458 aka CVE-2021-32256 aka PR105039 (gcc) +------------------------------------------------------------------- +Thu Jul 13 14:31:57 UTC 2023 - Michael Matz + +- Add binutils-disable-dt-relr.sh for an compatibility problem + caused by binutils-revert-rela.diff in SLE codestreams. + Needed for update of glibc as that would otherwise pick up + the broken relative relocs support. [bsc#1213282, PED-1435] +- This only existed only for a very short while in SLE-15, as the main + variant in devel:gcc subsumed this in binutils-revert-rela.diff. + Hence: +- Remove binutils-disable-dt-relr.sh as subsumed. + ------------------------------------------------------------------- Tue May 30 09:43:15 UTC 2023 - Andreas Schwab From 12ff8063489ac10dc49cf276bca669c2addead558f46710dd3f503ab1e2a20c4 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 8 Sep 2023 13:20:37 +0000 Subject: [PATCH 05/10] - Contains fixes for these non-CVEs (not security bugs per upstreams SECURITY.md): * bsc#1214565 aka CVE-2020-19726 aka PR26240 * bsc#1214567 aka CVE-2022-35206 aka PR29290 * bsc#1214579 aka CVE-2022-35205 aka PR29289 * bsc#1214580 aka CVE-2022-44840 aka PR29732 * bsc#1214604 aka CVE-2022-45703 aka PR29799 * bsc#1214611 aka CVE-2022-48065 aka PR29925 * bsc#1214619 aka CVE-2022-48064 aka PR29922 * bsc#1214620 aka CVE-2022-48063 aka PR29924 * bsc#1214623 aka CVE-2022-47696 aka PR29677 * bsc#1214624 aka CVE-2022-47695 aka PR29846 * bsc#1214625 aka CVE-2022-47673 aka PR29876 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=451 --- binutils.changes | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/binutils.changes b/binutils.changes index 94acd01..7a8b440 100644 --- a/binutils.changes +++ b/binutils.changes @@ -46,11 +46,23 @@ Wed Aug 16 14:36:57 UTC 2023 - Michael Matz - Add binutils-2.41-branch.diff.gz . - Add binutils-old-makeinfo.diff for SLE-12 and older. - Rebased aarch64-common-pagesize.patch and binutils-revert-rela.diff . -- Contains fixes for these CVEs: +- Contains fixes for these non-CVEs (not security bugs per upstreams + SECURITY.md): * bsc#1209642 aka CVE-2023-1579 aka PR29988 * bsc#1210297 aka CVE-2023-1972 aka PR30285 * bsc#1210733 aka CVE-2023-2222 aka PR29936 * bsc#1213458 aka CVE-2021-32256 aka PR105039 (gcc) + * bsc#1214565 aka CVE-2020-19726 aka PR26240 + * bsc#1214567 aka CVE-2022-35206 aka PR29290 + * bsc#1214579 aka CVE-2022-35205 aka PR29289 + * bsc#1214580 aka CVE-2022-44840 aka PR29732 + * bsc#1214604 aka CVE-2022-45703 aka PR29799 + * bsc#1214611 aka CVE-2022-48065 aka PR29925 + * bsc#1214619 aka CVE-2022-48064 aka PR29922 + * bsc#1214620 aka CVE-2022-48063 aka PR29924 + * bsc#1214623 aka CVE-2022-47696 aka PR29677 + * bsc#1214624 aka CVE-2022-47695 aka PR29846 + * bsc#1214625 aka CVE-2022-47673 aka PR29876 ------------------------------------------------------------------- Thu Jul 13 14:31:57 UTC 2023 - Michael Matz From 0ecc24e37a91df74c85bdc8fc631feee32ea8fd05d10d29007989854d8acc549 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 8 Sep 2023 13:29:52 +0000 Subject: [PATCH 06/10] - Update to version 2.41 [PED-5778]: OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=452 --- binutils.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binutils.changes b/binutils.changes index 7a8b440..12170df 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Wed Aug 16 14:36:57 UTC 2023 - Michael Matz -- Update to version 2.41: +- Update to version 2.41 [PED-5778]: * The MIPS port now supports the Sony Interactive Entertainment Allegrex processor, used with the PlayStation Portable, which implements the MIPS II ISA along with a single-precision FPU and a few implementation-specific From 9ce63b809cbf1b2e5ed3f1642259956aded998b13659b07a48a4d76fb1d44b9f Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 8 Sep 2023 13:34:48 +0000 Subject: [PATCH 07/10] update branch to b6f6a3ec (fixes a gold powerpc problem in llvm) OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=453 --- binutils-2.41-branch.diff.gz | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binutils-2.41-branch.diff.gz b/binutils-2.41-branch.diff.gz index 4b63519..bbb7608 100644 --- a/binutils-2.41-branch.diff.gz +++ b/binutils-2.41-branch.diff.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa95814ec895e47d81db0054e272b14cce073540ea2b85b5e0211bdf85ef9774 -size 81732 +oid sha256:562743882b1f8b096af610c5064debae354cb6406d4f35fecd7aba9301745c2d +size 82856 From 893acf05adfe9695efe3ee9f48ca0e2a51523eff32b00e81f27491072e2be082 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 14 Sep 2023 12:28:40 +0000 Subject: [PATCH 08/10] - Add libzstd-devel to Requires of binutils-devel. (bsc#1215341) OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=454 --- binutils.changes | 5 +++++ binutils.spec | 3 +++ 2 files changed, 8 insertions(+) diff --git a/binutils.changes b/binutils.changes index 12170df..5585587 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 14 12:27:48 UTC 2023 - Michael Matz + +- Add libzstd-devel to Requires of binutils-devel. (bsc#1215341) + ------------------------------------------------------------------- Wed Aug 16 14:36:57 UTC 2023 - Michael Matz diff --git a/binutils.spec b/binutils.spec index 6c6cebe..11a5210 100644 --- a/binutils.spec +++ b/binutils.spec @@ -195,6 +195,9 @@ License: GPL-3.0-or-later Group: Development/Libraries/C and C++ Requires: binutils = %{version}-%{release} Requires: zlib-devel +%if %{suse_version} > 1500 +Requires: libzstd-devel +%endif Provides: binutils:/usr/include/bfd.h %description devel From b848c43c43d4658fe380d2939d49de56fefcff18a1c71f38d6513f4711307731 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 27 Sep 2023 13:28:24 +0000 Subject: [PATCH 09/10] Accepting request 1113839 from home:Andreas_Schwab:Factory - riscv-relro.patch: RISC-V: Protect .got with relro OBS-URL: https://build.opensuse.org/request/show/1113839 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=455 --- binutils.changes | 5 +++++ binutils.spec | 2 ++ riscv-relro.patch | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 riscv-relro.patch diff --git a/binutils.changes b/binutils.changes index 5585587..a5cfc2c 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 25 11:12:43 UTC 2023 - Andreas Schwab + +- riscv-relro.patch: RISC-V: Protect .got with relro + ------------------------------------------------------------------- Thu Sep 14 12:27:48 UTC 2023 - Michael Matz diff --git a/binutils.spec b/binutils.spec index 11a5210..571d51f 100644 --- a/binutils.spec +++ b/binutils.spec @@ -154,6 +154,7 @@ Patch42: binutils-compat-old-behaviour.diff Patch43: binutils-revert-hlasm-insns.diff Patch44: binutils-revert-rela.diff Patch45: binutils-old-makeinfo.diff +Patch46: riscv-relro.patch Patch100: add-ulp-section.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch @@ -283,6 +284,7 @@ cp ld/ldgram.y ld/ldgram.y.orig %if %{suse_version} < 1500 %patch45 -p1 %endif +%patch46 -p1 %patch100 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h diff --git a/riscv-relro.patch b/riscv-relro.patch new file mode 100644 index 0000000..2bc913c --- /dev/null +++ b/riscv-relro.patch @@ -0,0 +1,57 @@ +From 7345d05aafde53a48d5a587a6d9c1778db78e0f3 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 21 Sep 2023 16:49:41 +0200 +Subject: [PATCH] RISC-V: Protect .got with relro + +Move .got before .data so that it can be protected with -zrelro. Also +separate .got.plt from .got if -znow is not in effect; the first two words +of .got.plt are placed within the relro region. + +ld: + PR ld/30877 + * emulparams/elf32lriscv-defs.sh (DATA_GOT, SEPARATE_GOTPLT): + Define. + * emulparams/elf64lriscv-defs.sh (SEPARATE_GOTPLT): Define. + * testsuite/ld-elf/binutils.exp (binutils_test): Remove riscv*-*-* + from relro_got expression. +--- + ld/emulparams/elf32lriscv-defs.sh | 4 ++++ + ld/emulparams/elf64lriscv-defs.sh | 1 + + ld/testsuite/ld-elf/binutils.exp | 1 - + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/ld/emulparams/elf32lriscv-defs.sh b/ld/emulparams/elf32lriscv-defs.sh +index b823cedacab..016556168c3 100644 +--- a/ld/emulparams/elf32lriscv-defs.sh ++++ b/ld/emulparams/elf32lriscv-defs.sh +@@ -47,3 +47,7 @@ INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIO + OTHER_END_SYMBOLS="${CREATE_SHLIB-__BSS_END__ = .; + __global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800, + MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));}" ++ ++# Put .got before .data ++DATA_GOT=" " ++SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 8 ? 8 : 0" +diff --git a/ld/emulparams/elf64lriscv-defs.sh b/ld/emulparams/elf64lriscv-defs.sh +index 84a700a5f58..ca15338428f 100644 +--- a/ld/emulparams/elf64lriscv-defs.sh ++++ b/ld/emulparams/elf64lriscv-defs.sh +@@ -1,2 +1,3 @@ + source_sh ${srcdir}/emulparams/elf32lriscv-defs.sh + ELFSIZE=64 ++SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 16 ? 16 : 0" +diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp +index 674e8e9a575..b38e29ed6fb 100644 +--- a/ld/testsuite/ld-elf/binutils.exp ++++ b/ld/testsuite/ld-elf/binutils.exp +@@ -95,7 +95,6 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options " + || [istarget "mips*-*-*"] \ + || [istarget "nios2*-*-*"] \ + || [istarget "or1k-*-*"] \ +- || [istarget "riscv*-*-*"] \ + || [istarget "sh*-*-*"] \ + || [istarget "x86_64-*-rdos*"])] + # Check if GNU_RELRO segment is generated. +-- +2.42.0 + From f30534e59cf0d5f409737354d41080eefadf3babfed37b4abf59ecb01517ea3b Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Thu, 9 Nov 2023 16:55:17 +0000 Subject: [PATCH 10/10] - Add binutils-use-less-memory.diff to be a little nicer to 32bit userspace and huge links. [bsc#1216908] OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=456 --- binutils-use-less-memory.diff | 131 ++++++++++++++++++++++++++++++++++ binutils.changes | 6 ++ binutils.spec | 2 + 3 files changed, 139 insertions(+) create mode 100644 binutils-use-less-memory.diff diff --git a/binutils-use-less-memory.diff b/binutils-use-less-memory.diff new file mode 100644 index 0000000..c17daff --- /dev/null +++ b/binutils-use-less-memory.diff @@ -0,0 +1,131 @@ +We need this for libQt5WebEngine on i586. (bsc#1216908) + +From 836654b1177ab305c36fe7319f08f0ad5d4fac1b Mon Sep 17 00:00:00 2001 +From: Michael Matz +Date: Tue, 7 Nov 2023 16:54:44 +0100 +Subject: ld: Avoid overflows in string merging +To: binutils@sourceware.org + +as the bug report shows we had an overflow in the test if +hash table resizing is needed. Reorder the expression to avoid +that. There's still a bug somewhere in gracefully handling +failure in resizing (e.g. out of memory), but this pushes the +boundary for that occurring somewhen into the future and +immediately helps the reporter. + + bfd/ + + PR ld/31009 + * merge.c (NEEDS_RESIZE): New macro avoiding overflow. + (sec_merge_maybe_resize): Use it. + (sec_merge_hash_insert): Ditto. +--- + bfd/merge.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/bfd/merge.c b/bfd/merge.c +index 722e6659486..61ffab4d706 100644 +--- a/bfd/merge.c ++++ b/bfd/merge.c +@@ -94,6 +94,10 @@ struct sec_merge_hash + struct sec_merge_hash_entry **values; + }; + ++/* True when given NEWCOUNT and NBUCKETS indicate that the hash table needs ++ resizing. */ ++#define NEEDS_RESIZE(newcount, nbuckets) ((newcount) > (nbuckets) / 3 * 2) ++ + struct sec_merge_sec_info; + + /* Information per merged blob. This is the unit of merging and is +@@ -167,7 +171,7 @@ static bool + sec_merge_maybe_resize (struct sec_merge_hash *table, unsigned added) + { + struct bfd_hash_table *bfdtab = &table->table; +- if (bfdtab->count + added > table->nbuckets * 2 / 3) ++ if (NEEDS_RESIZE (bfdtab->count + added, table->nbuckets)) + { + unsigned i; + unsigned long newnb = table->nbuckets * 2; +@@ -175,7 +179,7 @@ sec_merge_maybe_resize (struct sec_merge_hash *table, unsigned added) + uint64_t *newl; + unsigned long alloc; + +- while (bfdtab->count + added > newnb * 2 / 3) ++ while (NEEDS_RESIZE (bfdtab->count + added, newnb)) + { + newnb *= 2; + if (!newnb) +@@ -239,8 +243,8 @@ sec_merge_hash_insert (struct sec_merge_hash *table, + hashp->alignment = 0; + hashp->u.suffix = NULL; + hashp->next = NULL; +- // We must not need resizing, otherwise _index is wrong +- BFD_ASSERT (bfdtab->count + 1 <= table->nbuckets * 2 / 3); ++ // We must not need resizing, otherwise the estimation was wrong ++ BFD_ASSERT (!NEEDS_RESIZE (bfdtab->count + 1, table->nbuckets)); + bfdtab->count++; + table->key_lens[_index] = (hash << 32) | (uint32_t)len; + table->values[_index] = hashp; +-- +2.42.0 + + +From 21160d8a18dc21aafb8ab1026e13e5c524954a46 Mon Sep 17 00:00:00 2001 +From: Michael Matz +Date: Tue, 7 Nov 2023 17:12:46 +0100 +Subject: bfd: use less memory in string merging +To: binutils@sourceware.org + +the offset-to-entry mappings are allocated in blocks, which may +become a bit wasteful in case there are extremely many small +input files or sections. This made it so that a large project +(Qt5WebEngine) didn't build anymore on x86 32bit due to address +space limits. It barely fit into address space before the new +string merging, and then got pushed over the limit by this. + +So instead of leaving the waste reallocate the maps to their final +size once known. Now the link barely fits again. + +bfd/ + * merge.c (record_section): Reallocate offset maps to their + final size. +--- + bfd/merge.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/bfd/merge.c b/bfd/merge.c +index 61ffab4d706..eeaa1a01fe3 100644 +--- a/bfd/merge.c ++++ b/bfd/merge.c +@@ -711,6 +711,7 @@ record_section (struct sec_merge_info *sinfo, + unsigned int align; + bfd_size_type amt; + bfd_byte *contents; ++ void *tmpptr; + + amt = sec->size; + if (sec->flags & SEC_STRINGS) +@@ -771,6 +772,19 @@ record_section (struct sec_merge_info *sinfo, + + free (contents); + contents = NULL; ++ ++ /* We allocate the ofsmap arrays in blocks of 2048 elements. ++ In case we have very many small input files/sections, ++ this might waste large amounts of memory, so reallocate these ++ arrays here to their true size. */ ++ amt = secinfo->noffsetmap + 1; ++ tmpptr = bfd_realloc (secinfo->map, amt * sizeof(secinfo->map[0])); ++ if (tmpptr) ++ secinfo->map = tmpptr; ++ tmpptr = bfd_realloc (secinfo->map_ofs, amt * sizeof(secinfo->map_ofs[0])); ++ if (tmpptr) ++ secinfo->map_ofs = tmpptr; ++ + /*printf ("ZZZ %s:%s %u entries\n", sec->owner->filename, sec->name, + (unsigned)secinfo->noffsetmap);*/ + +-- +2.42.0 + diff --git a/binutils.changes b/binutils.changes index a5cfc2c..5a6ee99 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Nov 9 16:51:13 UTC 2023 - Michael Matz + +- Add binutils-use-less-memory.diff to be a little nicer to 32bit + userspace and huge links. [bsc#1216908] + ------------------------------------------------------------------- Mon Sep 25 11:12:43 UTC 2023 - Andreas Schwab diff --git a/binutils.spec b/binutils.spec index 571d51f..808b094 100644 --- a/binutils.spec +++ b/binutils.spec @@ -155,6 +155,7 @@ Patch43: binutils-revert-hlasm-insns.diff Patch44: binutils-revert-rela.diff Patch45: binutils-old-makeinfo.diff Patch46: riscv-relro.patch +Patch47: binutils-use-less-memory.diff Patch100: add-ulp-section.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch @@ -285,6 +286,7 @@ cp ld/ldgram.y ld/ldgram.y.orig %patch45 -p1 %endif %patch46 -p1 +%patch47 -p1 %patch100 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h