From 2580f878fbdd39a803c4cf8a91779ea5db5c4f8b1a4e5e77b223296d9210bb93 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 20 Jan 2023 17:08:10 +0000 Subject: [PATCH] Accepting request 1060005 from home:dirkmueller:Factory - fix build on x86_64_vX platforms - add arm32-avoid-copyreloc.patch for PR16177 (bsc#1200962) OBS-URL: https://build.opensuse.org/request/show/1060005 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=426 --- arm32-avoid-copyreloc.patch | 61 +++++++++++++++++++++++++++++++++++++ binutils.changes | 10 ++++++ binutils.spec | 10 +++--- 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 arm32-avoid-copyreloc.patch diff --git a/arm32-avoid-copyreloc.patch b/arm32-avoid-copyreloc.patch new file mode 100644 index 0000000..f5e18f4 --- /dev/null +++ b/arm32-avoid-copyreloc.patch @@ -0,0 +1,61 @@ +When a writable input section (i.e. data) refers to a symbol defined in an +ET_DYN object, BFD ld for ARM targets generates a COPY dynamic reloc. For +other targets like x86, this situation generates a plain data dynamic +reloc. Gold for ARM also generates the plain data dynamic reloc. + +https://bugzilla.suse.com/show_bug.cgi?id=1200962 +https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + +--- + bfd/elf32-arm.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) +Index: binutils-2.39/bfd/elf32-arm.c +=================================================================== +--- binutils-2.39.orig/bfd/elf32-arm.c ++++ binutils-2.39/bfd/elf32-arm.c +@@ -16196,6 +16196,21 @@ elf32_arm_adjust_dynamic_symbol (struct + if (bfd_link_pic (info) || globals->root.is_relocatable_executable) + return true; + ++ /* If -z nocopyreloc was given, we won't generate them either. */ ++ if (info->nocopyreloc) ++ { ++ h->non_got_ref = 0; ++ return true; ++ } ++ ++ /* If we don't find any dynamic relocs in read-only sections, then ++ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ ++ if (!_bfd_elf_readonly_dynrelocs (h)) ++ { ++ h->non_got_ref = 0; ++ return true; ++ } ++ + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic +@@ -16205,9 +16220,9 @@ elf32_arm_adjust_dynamic_symbol (struct + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ +- /* If allowed, we must generate a R_ARM_COPY reloc to tell the dynamic +- linker to copy the initial value out of the dynamic object and into +- the runtime process image. We need to remember the offset into the ++ /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to ++ copy the initial value out of the dynamic object and into the ++ runtime process image. We need to remember the offset into the + .rel(a).bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_READONLY) != 0) + { +@@ -16219,9 +16234,7 @@ elf32_arm_adjust_dynamic_symbol (struct + s = globals->root.sdynbss; + srel = globals->root.srelbss; + } +- if (info->nocopyreloc == 0 +- && (h->root.u.def.section->flags & SEC_ALLOC) != 0 +- && h->size != 0) ++ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) + { + elf32_arm_allocate_dynrelocs (info, srel, 1); + h->needs_copy = 1; diff --git a/binutils.changes b/binutils.changes index ef1d7a7..48a2e21 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sat Dec 10 10:00:56 UTC 2022 - Dirk Müller + +- fix build on x86_64_vX platforms + ------------------------------------------------------------------- Tue Oct 25 14:52:30 UTC 2022 - Michael Matz @@ -29,6 +34,11 @@ Mon Oct 17 15:16:23 UTC 2022 - Michael Matz [bsc#1202967] aka PR29290 aka CVE-2022-38127 [bsc#1202969] aka CVE-2021-3826 +------------------------------------------------------------------- +Fri Oct 14 15:22:38 UTC 2022 - Dirk Müller + +- add arm32-avoid-copyreloc.patch for PR16177 (bsc#1200962) + ------------------------------------------------------------------- Fri Aug 26 13:24:35 UTC 2022 - Michael Matz diff --git a/binutils.spec b/binutils.spec index bc2ce10..7506275 100644 --- a/binutils.spec +++ b/binutils.spec @@ -94,7 +94,7 @@ Release: 0 %define make_check_handling false %endif # handle all binary object formats supported by SUSE (and a few more) -%ifarch %ix86 %arm aarch64 ia64 ppc ppc64 ppc64le riscv64 s390 s390x x86_64 +%ifarch %ix86 %arm aarch64 ia64 ppc ppc64 ppc64le riscv64 s390 s390x x86_64 %x86_64 %define build_multitarget 1 %else %define build_multitarget 0 @@ -125,6 +125,7 @@ Patch6: unit-at-a-time.patch Patch8: ld-relro.diff Patch9: testsuite.diff Patch10: enable-targets-gold.diff +Patch11: arm32-avoid-copyreloc.patch Patch12: s390-pic-dso.diff Patch14: binutils-build-as-needed.diff Patch15: binutils-znow.patch @@ -168,7 +169,7 @@ Requires: alts PreReq: update-alternatives %endif %if 0%{!?cross:1} && 0%{?suse_version} >= 1310 -%define gold_archs %ix86 aarch64 %arm x86_64 ppc ppc64 ppc64le s390x %sparc +%define gold_archs %ix86 aarch64 %arm x86_64 %x86_64 ppc ppc64 ppc64le s390x %sparc %endif %description gold @@ -218,7 +219,7 @@ The next generation profiling tool for Linux %ifarch %arm %define HOST %{_target_cpu}-suse-linux-gnueabi %else -%define HOST %(echo %{_target_cpu} | sed -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/" -e "s/sparc64v.*/sparc64/" -e "s/sparcv.*/sparc/")-suse-linux +%define HOST %(echo %{_target_cpu} | sed -s -e "s/x86_64_v./x86_64/" -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/" -e "s/sparc64v.*/sparc64/" -e "s/sparcv.*/sparc/")-suse-linux %endif %define DIST %(echo '%distribution' | sed 's/ (.*)//') @@ -246,6 +247,7 @@ cp ld/ldgram.y ld/ldgram.y.orig %patch8 %patch9 %patch10 +%patch11 -p1 %patch12 %patch14 %patch15 @@ -696,7 +698,7 @@ fi; %{_libdir}/libctf-nobfd.so.* %if %{suse_version} > 1500 -%ifarch %ix86 x86_64 aarch64 +%ifarch %ix86 x86_64 %x86_64 aarch64 %files -n gprofng %defattr(-,root,root) %dir %{_libdir}/gprofng/