diff --git a/SOURCES/binutils-aarch64-rng.patch b/SOURCES/binutils-aarch64-rng.patch new file mode 100644 index 0000000..c19b421 --- /dev/null +++ b/SOURCES/binutils-aarch64-rng.patch @@ -0,0 +1,53 @@ +Only in binutils-2.35.2/gas/testsuite/gas/aarch64: rng-1.d +Only in binutils-2.35.2/gas/testsuite/gas/aarch64: rng-1.s +diff -rup binutils.orig/opcodes/aarch64-opc.c binutils-2.35.2/opcodes/aarch64-opc.c +--- binutils.orig/opcodes/aarch64-opc.c 2022-04-05 11:50:10.131798329 +0100 ++++ binutils-2.35.2/opcodes/aarch64-opc.c 2022-04-05 11:54:32.596827591 +0100 +@@ -3810,9 +3810,6 @@ aarch64_print_operand (char *buf, size_t + #define SR_FEAT(n,e,f,feat) \ + SYSREG ((n), (e), (f) | F_ARCHEXT, AARCH64_FEATURE_##feat) + +-#define SR_RNG(n,e,f) \ +- SYSREG ((n), (e), (f) | F_ARCHEXT, AARCH64_FEATURE_RNG | AARCH64_FEATURE_V8_5) +- + #define SR_V8_1(n,e,f) SR_FEAT (n,e,f,V8_1) + #define SR_V8_2(n,e,f) SR_FEAT (n,e,f,V8_2) + #define SR_V8_3(n,e,f) SR_FEAT (n,e,f,V8_3) +@@ -3820,6 +3817,7 @@ aarch64_print_operand (char *buf, size_t + #define SR_V8_4(n,e,f) SR_FEAT (n,e,f,V8_4) + #define SR_PAN(n,e,f) SR_FEAT (n,e,f,PAN) + #define SR_RAS(n,e,f) SR_FEAT (n,e,f,RAS) ++#define SR_RNG(n,e,f) SR_FEAT (n,e,f,RNG) + #define SR_SSBS(n,e,f) SR_FEAT (n,e,f,SSBS) + #define SR_SVE(n,e,f) SR_FEAT (n,e,f,SVE) + #define SR_ID_PFR2(n,e,f) SR_FEAT (n,e,f,ID_PFR2) +--- /dev/null 2022-04-05 09:32:54.900867346 +0100 ++++ binutils-2.35.2/gas/testsuite/gas/aarch64/rng-1.s 2022-04-05 11:55:13.973674567 +0100 +@@ -0,0 +1,3 @@ ++ .arch armv8.4-a+rng ++ mrs x5, rndr ++ mrs x6, rndrrs +--- /dev/null 2022-04-05 09:32:54.900867346 +0100 ++++ binutils-2.35.2/gas/testsuite/gas/aarch64/rng-1.d 2022-04-05 11:55:45.338558554 +0100 +@@ -0,0 +1,10 @@ ++#source: rng-1.s ++#objdump: -dr ++ ++.*: file format .* ++ ++Disassembly of section \.text: ++ ++0+ <.*>: ++.*: d53b2405 mrs x5, rndr ++.*: d53b2426 mrs x6, rndrrs +--- binutils.orig/gas/config/tc-aarch64.c 2022-05-23 09:44:07.623234684 +0100 ++++ binutils-2.35.2/gas/config/tc-aarch64.c 2022-05-23 09:47:09.147696001 +0100 +@@ -9206,7 +9206,7 @@ aarch64_parse_features (const char *str, + break; + } + +- if (opt->name == NULL) ++ if (opt->name == NULL && adding_value) + { + as_bad (_("unknown architectural extension `%s'"), str); + return 0; diff --git a/SOURCES/binutils-s390-z16.patch b/SOURCES/binutils-s390-z16.patch new file mode 100644 index 0000000..f795a80 --- /dev/null +++ b/SOURCES/binutils-s390-z16.patch @@ -0,0 +1,51 @@ +diff -rup binutils-2.35.2/gas/config/tc-s390.c fred/gas/config/tc-s390.c +--- binutils-2.35.2/gas/config/tc-s390.c 2022-04-11 08:54:46.529179603 +0100 ++++ fred/gas/config/tc-s390.c 2022-04-11 08:51:08.030832065 +0100 +@@ -293,7 +293,7 @@ s390_parse_cpu (const char * arg + S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }, + { STRING_COMMA_LEN ("z15"), STRING_COMMA_LEN ("arch13"), + S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }, +- { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch14"), ++ { STRING_COMMA_LEN ("z16"), STRING_COMMA_LEN ("arch14"), + S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX } + }; + static struct +diff -rup binutils-2.35.2/gas/doc/as.texi fred/gas/doc/as.texi +--- binutils-2.35.2/gas/doc/as.texi 2022-04-11 08:54:46.099182880 +0100 ++++ fred/gas/doc/as.texi 2022-04-11 08:52:33.088196625 +0100 +@@ -1872,8 +1872,8 @@ Specify which s390 processor variant is + @samp{arch3}), @samp{g6}, @samp{z900} (or @samp{arch5}), @samp{z990} (or + @samp{arch6}), @samp{z9-109}, @samp{z9-ec} (or @samp{arch7}), @samp{z10} (or + @samp{arch8}), @samp{z196} (or @samp{arch9}), @samp{zEC12} (or @samp{arch10}), +-@samp{z13} (or @samp{arch11}), @samp{z14} (or @samp{arch12}), or @samp{z15} +-(or @samp{arch13}). ++@samp{z13} (or @samp{arch11}), @samp{z14} (or @samp{arch12}), @samp{z15} ++(or @samp{arch13}), or @samp{z16} (or @samp{arch14}). + @item -mregnames + @itemx -mno-regnames + Allow or disallow symbolic names for registers. +diff -rup binutils-2.35.2/gas/doc/c-s390.texi fred/gas/doc/c-s390.texi +--- binutils-2.35.2/gas/doc/c-s390.texi 2022-04-11 08:54:46.551179435 +0100 ++++ fred/gas/doc/c-s390.texi 2022-04-11 08:51:50.623520271 +0100 +@@ -18,7 +18,7 @@ and eleven chip levels. The architecture + Architecture (ESA) and the newer z/Architecture mode. The chip levels + are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec + (or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13 +-(or arch11), z14 (or arch12), z15 (or arch13), or arch14. ++(or arch11), z14 (or arch12), z15 (or arch13), or z16 (or arch14). + + @menu + * s390 Options:: Command-line Options. +diff -rup binutils-2.35.2/opcodes/s390-mkopc.c fred/opcodes/s390-mkopc.c +--- binutils-2.35.2/opcodes/s390-mkopc.c 2022-04-11 08:54:46.530179595 +0100 ++++ fred/opcodes/s390-mkopc.c 2022-04-11 08:53:04.701955680 +0100 +@@ -380,7 +380,8 @@ main (void) + else if (strcmp (cpu_string, "z15") == 0 + || strcmp (cpu_string, "arch13") == 0) + min_cpu = S390_OPCODE_ARCH13; +- else if (strcmp (cpu_string, "arch14") == 0) ++ else if (strcmp (cpu_string, "z16") == 0 ++ || strcmp (cpu_string, "arch14") == 0) + min_cpu = S390_OPCODE_ARCH14; + else { + fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string); diff --git a/SOURCES/binutils-s390x-static-PIE.patch b/SOURCES/binutils-s390x-static-PIE.patch new file mode 100644 index 0000000..bdd5da0 --- /dev/null +++ b/SOURCES/binutils-s390x-static-PIE.patch @@ -0,0 +1,143 @@ +diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.35.2/bfd/elf64-s390.c +--- binutils.orig/bfd/elf64-s390.c 2022-05-03 12:03:39.004203905 +0100 ++++ binutils-2.35.2/bfd/elf64-s390.c 2022-05-03 12:06:19.884715801 +0100 +@@ -773,7 +773,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) +@@ -1025,7 +1025,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 */ + +@@ -1106,7 +1106,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 */ +@@ -1570,7 +1570,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) + { +@@ -1875,7 +1875,20 @@ elf_s390_size_dynamic_sections (bfd *out + else if (CONST_STRNEQ (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. */ +@@ -2661,7 +2674,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; +@@ -2689,7 +2702,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) +@@ -2800,14 +2813,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; + } + +@@ -2824,7 +2837,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. */ +@@ -2899,7 +2912,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. */ +@@ -2921,7 +2934,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 +@@ -2971,7 +2984,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,. */ +@@ -2990,7 +3003,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.35.2/bfd: elf64-s390.c.orig +Only in binutils-2.35.2/bfd: elf64-s390.c.rej diff --git a/SOURCES/binutils-undefined-ref-to-sym.patch b/SOURCES/binutils-undefined-ref-to-sym.patch new file mode 100644 index 0000000..d0dc9a8 --- /dev/null +++ b/SOURCES/binutils-undefined-ref-to-sym.patch @@ -0,0 +1,15 @@ +--- binutils.orig/bfd/elflink.c 2022-06-13 14:22:15.071831986 +0100 ++++ binutils-2.35.2/bfd/elflink.c 2022-06-13 14:26:37.386163819 +0100 +@@ -5226,10 +5226,12 @@ elf_link_add_object_symbols (bfd *abfd, + if (!add_needed + && matched + && definition ++ && h->root.type != bfd_link_hash_indirect + && ((dynsym + && h->ref_regular_nonweak) + || (old_bfd != NULL + && (old_bfd->flags & BFD_PLUGIN) != 0 ++ && !info->lto_all_symbols_read + && bind != STB_WEAK) + || (h->ref_dynamic_nonweak + && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0 diff --git a/SOURCES/gcc12-libtool-no-rpath.patch b/SOURCES/gcc12-libtool-no-rpath.patch new file mode 100644 index 0000000..a4f90a1 --- /dev/null +++ b/SOURCES/gcc12-libtool-no-rpath.patch @@ -0,0 +1,28 @@ +diff -rup binutils.orig/ltmain.sh binutils-2.37/ltmain.sh +--- binutils.orig/ltmain.sh 2022-01-27 16:23:09.304207432 +0000 ++++ binutils-2.37/ltmain.sh 2022-01-27 16:23:18.380143759 +0000 +@@ -7103,6 +7103,7 @@ EOF + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -7798,6 +7799,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +@@ -7849,6 +7851,7 @@ EOF + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do ++ case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then +Only in binutils-2.37: ltmain.sh.orig diff --git a/SPECS/binutils.spec b/SPECS/binutils.spec index 48b3dae..dc4cdcd 100644 --- a/SPECS/binutils.spec +++ b/SPECS/binutils.spec @@ -39,7 +39,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?name_cross}%{?_with_debug:-debug} Version: 2.35.2 -Release: 17%{?dist} +Release: 24%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -402,6 +402,32 @@ Patch51: binutils-x86-AMX-insns.patch # Lifetime: Fixed in 2.38. Patch52: binutils-gas-Use-the-directory-name-in-.file-0.patch +# Purpose: Stop libtool from inserting useless runpaths into binaries. +# Lifetime: Who knows. +Patch53: gcc12-libtool-no-rpath.patch + +# Purpose: Allow the AArch64 RNG extension to be used wihtout ARMv8.5. +# In addition stops the assembler from issuing error messages for +# unknown AArch64 architectural extensions that are being disabled. +# This can happen when compiling with -mcpu=native on a machine which +# does not support all of the extensions known to GCC. +# See BZ 2071038 for more details. +# Lifetime: Permanent. +Patch54: binutils-aarch64-rng.patch + +# Purpose: Allow 'z16' to be used as an alias for the arch14 +# extensions of the S390 architecture. +# Lifetime: Fixed in 2.39 +Patch55: binutils-s390-z16.patch + +# Purpose: Add support for generating s390x static PIE binaries. +# Lifetime: Fixed in 2.37 +Patch56: binutils-s390x-static-PIE.patch + +# Purpose: Fix bogis linker warnings about references to undefined symbols. +# Lifetime: Fixed in 2.36 +Patch57: binutils-undefined-ref-to-sym.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -952,6 +978,9 @@ exit 0 # Strictly speaking ld is a symlink not a ghost file, but %%verify does not support symlinks %ghost %{_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* %if %{with docs} %{_mandir}/man1/ @@ -969,6 +998,8 @@ exit 0 %{_libdir}/libctf* %exclude %{_libdir}/libbfd.so %exclude %{_libdir}/libopcodes.so +%exclude %{_libdir}/libctf.a +%exclude %{_libdir}/libctf-nobfd.a %endif %if %{isnative} @@ -990,6 +1021,27 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Mon Jun 13 2022 Nick Clifton - 2.35.2-24 +- Fix bogus linker warnings about references to undefined symbols. (#2095926) + +* Mon May 23 2022 Nick Clifton - 2.35.2-23 +- GAS: AArch64: Do not complain about unknown disabled architecture extensions. (#2071038) + +* Tue May 03 2022 Nick Clifton - 2.35.2-22 +- Add support for generating s390x static PIE binaries. (#2080164) + +* Mon Apr 11 2022 Nick Clifton - 2.35.2-21 +- Allow z16 to be used as an alias for the arch14 extenstions to the S390 architecture. (#2073383) + +* Tue Apr 05 2022 Nick Clifton - 2.35.2-20 +- Allow the AArch64 architecture's RNG extension to be used without ARMv8.5. (#2071038) + +* Wed Mar 30 2022 Nick Clifton - 2.35.2-19 +- NVR bump to allow rebuild. (#2057638) + +* Mon Mar 07 2022 Nick Clifton - 2.35.2-18 +- Do not export any windows tools (if they were built). (#2057638) + * Mon Jan 24 2022 Nick Clifton - 2.35.2-17 - Add upstream patch to use the directory name in .file 0, fixes ccache FTBFS (#2043970)