Drew DeVault: 1 community/binutils-cross: new aport 9 files changed, 562 insertions(+), 0 deletions(-)
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.alpinelinux.org/~alpine/aports/patches/4096/mbox | git am -3Learn more about email & git
--- ...gnu.attributes-are-not-checked-for-s.patch | 55 +++++++ community/binutils-cross/APKBUILD | 150 ++++++++++++++++++ .../binutils-ld-fix-static-linking.patch | 46 ++++++ .../binutils-mips-disable-assert.patch | 14 ++ .../binutils-ppc-fix-machine-options.patch | 41 +++++ .../binutils-cross/binutils-s390x-1.patch | 147 +++++++++++++++++ .../binutils-cross/binutils-s390x-2.patch | 51 ++++++ community/binutils-cross/gold-mips.patch | 39 +++++ community/binutils-cross/ld-bfd-mips.patch | 19 +++ 9 files changed, 562 insertions(+) create mode 100644 community/binutils-cross/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch create mode 100644 community/binutils-cross/APKBUILD create mode 100644 community/binutils-cross/binutils-ld-fix-static-linking.patch create mode 100644 community/binutils-cross/binutils-mips-disable-assert.patch create mode 100644 community/binutils-cross/binutils-ppc-fix-machine-options.patch create mode 100644 community/binutils-cross/binutils-s390x-1.patch create mode 100644 community/binutils-cross/binutils-s390x-2.patch create mode 100644 community/binutils-cross/gold-mips.patch create mode 100644 community/binutils-cross/ld-bfd-mips.patch diff --git a/community/binutils-cross/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch b/community/binutils-cross/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch new file mode 100644 index 0000000000..6e1fa7731c --- /dev/null +++ b/community/binutils-cross/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch @@ -0,0 +1,55 @@ +From bbf05b742fde518fb97c789b043fe0d3aaf549f0 Mon Sep 17 00:00:00 2001 +From: Ariadne Conill <ariadne@dereferenced.org> +Date: Tue, 21 Sep 2021 14:53:13 +0000 +Subject: [PATCH] Revert "PR25882, .gnu.attributes are not checked for shared + libraries" + +This revert is needed to avoid wrongly tagging objects with the incompatible +IBM long double ABI, which is not supported by musl and will result in +linking errors if used. + +This reverts commit a8acd6eeb6dc2cc5460ece90f90ebe36b56b20ba. +--- + bfd/elf32-tic6x.c | 3 --- + ld/ldlang.c | 10 ++++------ + 2 files changed, 4 insertions(+), 9 deletions(-) + +diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c +index 5754f3cb860..3ad1d612749 100644 +--- a/bfd/elf32-tic6x.c ++++ b/bfd/elf32-tic6x.c +@@ -3735,9 +3735,6 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info) + + case Tag_ABI_PIC: + case Tag_ABI_PID: +- /* Don't transfer these tags from dynamic objects. */ +- if ((ibfd->flags & DYNAMIC) != 0) +- continue; + if (out_attr[i].i > in_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; +diff --git a/ld/ldlang.c b/ld/ldlang.c +index 37b64c89ee1..f13beaef9d9 100644 +--- a/ld/ldlang.c ++++ b/ld/ldlang.c +@@ -7071,13 +7071,11 @@ lang_check (void) + bfd_printable_name (input_bfd), input_bfd, + bfd_printable_name (link_info.output_bfd)); + } +- +- /* If the input bfd has no contents, it shouldn't set the +- private data of the output bfd. */ +- else if (!file->flags.just_syms +- && ((input_bfd->flags & DYNAMIC) != 0 +- || bfd_count_sections (input_bfd) != 0)) ++ else if (bfd_count_sections (input_bfd)) + { ++ /* If the input bfd has no contents, it shouldn't set the ++ private data of the output bfd. */ ++ + bfd_error_handler_type pfn = NULL; + + /* If we aren't supposed to warn about mismatched input +-- +2.33.0 + diff --git a/community/binutils-cross/APKBUILD b/community/binutils-cross/APKBUILD new file mode 100644 index 0000000000..8dc0d4fbae --- /dev/null +++ b/community/binutils-cross/APKBUILD @@ -0,0 +1,150 @@ +# Contributor: Natanael Copa <ncopa@alpinelinux.org> +# Contributor: Ariadne Conill <ariadne@dereferenced.org> +# Maintainer: Drew DeVault <sir@cmpwn.com> +pkgname=binutils-cross +pkgver=2.38 +pkgrel=0 +pkgdesc="Tools necessary to build programs for foreign architectures" +url="https://www.gnu.org/software/binutils/" +makedepends_build="bison flex texinfo" +makedepends_host="zlib-dev" +makedepends="$makedepends_build $makedepends_host" +arch="all" +license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD" +source="https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz + binutils-ld-fix-static-linking.patch + gold-mips.patch + ld-bfd-mips.patch + 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch + binutils-mips-disable-assert.patch + binutils-ppc-fix-machine-options.patch + binutils-s390x-1.patch + binutils-s390x-2.patch + " +builddir="$srcdir/binutils-$pkgver" +targets="aarch64 armhf armv7 mips64 ppc64le riscv64 s390x x86 x86_64" +options="!check" +for target in $targets +do + subpackages="$subpackages binutils-$target:_$target" +done + +# secfixes: +# 2.35.2-r1: +# - CVE-2021-3487 +# 2.32-r0: +# - CVE-2018-19931 +# - CVE-2018-19932 +# - CVE-2018-20002 +# - CVE-2018-20712 +# 2.28-r1: +# - CVE-2017-7614
Jakub Jirutka <no-reply@dispatch.alpinelinux.org>A new aport cannot have any secfixes, that would be just nonsense. -- via https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35287#note_241611
+ +build() { + for target in $targets + do + local _arch_configure="" + if [ "$target" = "x86_64" ]; then + _arch_configure="--enable-targets=x86_64-pep" + fi
not sure if this is the cause, but for x86-64 on x86-64 specifically, the target has the top-level files: ``` +usr/bin/strings +usr/bin/strip +usr/include/ +usr/include/ansidecl.h ``` on all other arches for all targets it doesn't place things in /usr/include or /usr/bin- i would assume that's not intended, but maybe i'm wrong -- via https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35287#note_241557
+ + case "$target" in + mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;; + *) _hash_style_configure="--enable-default-hash-style=gnu" ;; + esac + + mkdir "$srcdir/$target" + cd "$srcdir/$target" + + local ctarget="$(arch_to_hostspec "$target")" + "$builddir"/configure \ + --build=$CBUILD \ + --host=$CHOST \ + --target=$ctarget \ + --prefix=/usr \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --disable-multilib \ + --enable-ld=default \ + --disable-gold \ + --enable-64-bit-bfd \ + --disable-plugins \ + --enable-relro \ + --enable-deterministic-archives \ + --disable-internal-libiberty \ + $_arch_configure \ + $_hash_style_configure \ + --with-pic \ + --disable-werror \ + --disable-nls \ + --with-mmap \ + --with-system-zlib + make + done +} + +package() { + pkgdesc="Tools necessary to build programs for foreign architectures" + for target in $targets + do + depends="$depends binutils-$target" + done + mkdir -p "$pkgdir" +} + +_install_target() { + local target="$1" + pkgdesc="Tools necessary to build programs for $target" + cd "$srcdir/$target" + make install DESTDIR="$subpkgdir" + rm -r "$subpkgdir"/usr/share + rm -r "$subpkgdir"/usr/lib/ +} + +_aarch64() { + _install_target aarch64 +} + +_armhf() { + _install_target armhf +} + +_armv7() { + _install_target armv7 +} + +_mips64() { + _install_target mips64 +} + +_ppc64le() { + _install_target ppc64le +} + +_riscv64() { + _install_target riscv64 +} + +_s390x() { + _install_target s390x +} + +_x86() { + _install_target x86 +} + +_x86_64() { + _install_target x86_64 +} + +sha512sums=" +8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz +ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch +f55cf2e0bf82f97583a1abe10710e4013ecf7d64f1da2ef8659a44a06d0dd8beaf58dab98a183488ea137f03e32d62efc878d95f018f836f8cec870bc448556f gold-mips.patch +314d2ef9071c89940aa6c8118e8a1e2f191a5d0a4bf596da1ad9cc84f884d8bc7dea8bd7b9fc3f8f1bddd3fd41c6eb017e1e804044b3bf084df1ed9e6e095e2d ld-bfd-mips.patch +70ec22bd72ef6dddecfd970613387dd4a8cdc8730dd3cbf03d5a0c3a7c4d839383167bb06dad21bf7c235329fd44b5dc4aefe762f68544f17155cf002bf1be4a 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch +609cd90d8b334eb309f586b17b9d335a08d3dbb6def7c3eb5c010028fcb681674031e5b9d853aa7a39a50304356a86afc184b85562b3f228f8197f4d29395c8f binutils-mips-disable-assert.patch +27ea91e0e406e2ed464fd692cf92a07e338781789f2d968c8b95d9d5545985056a6f7f500df3952e5ab42165db28b741aa33d6b717e880b11a2e41fe406b13c4 binutils-ppc-fix-machine-options.patch +a9efe2689624865f0ff33d4776a5bd295bcad6484bdd38d0ca490fea43691c4933ab33d17478851998eef12922dbf83d6c3225bb1f8faf92a1367d086390f7d3 binutils-s390x-1.patch +0e291df80ad279005265634014d0935d2c115a5ed708d25407094b7ad4ddf267d1fb7fcbcb2d9ad73bd305b4e3974628b820bd1f249f56c095e4896872434cc9 binutils-s390x-2.patch +" diff --git a/community/binutils-cross/binutils-ld-fix-static-linking.patch b/community/binutils-cross/binutils-ld-fix-static-linking.patch new file mode 100644 index 0000000000..bc5d762656 --- /dev/null +++ b/community/binutils-cross/binutils-ld-fix-static-linking.patch @@ -0,0 +1,46 @@ +This fixes static linking for our hardened toolchain +diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc +index e8126cb..9532bfb 100644 +--- a/ld/scripttempl/elf.sc ++++ b/ld/scripttempl/elf.sc +@@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" + if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then + SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))" + SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))" +- CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors" +- DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors" ++ CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors" ++ DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors" + else + SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))" + SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))" +@@ -270,15 +270,14 @@ CTOR=".ctors ${CONSTRUCTING-0} : + doesn't matter which directory crtbegin.o + is in. */ + +- KEEP (*crtbegin.o(.ctors)) +- KEEP (*crtbegin?.o(.ctors)) ++ KEEP (*crtbegin*.o(.ctors)) + + /* We don't want to include the .ctor section from + the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + +- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) ++ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ${CONSTRUCTING+${CTOR_END}} +@@ -286,9 +285,8 @@ CTOR=".ctors ${CONSTRUCTING-0} : + DTOR=".dtors ${CONSTRUCTING-0} : + { + ${CONSTRUCTING+${DTOR_START}} +- KEEP (*crtbegin.o(.dtors)) +- KEEP (*crtbegin?.o(.dtors)) +- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) ++ KEEP (*crtbegin*.o(.dtors)) ++ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ${CONSTRUCTING+${DTOR_END}} diff --git a/community/binutils-cross/binutils-mips-disable-assert.patch b/community/binutils-cross/binutils-mips-disable-assert.patch new file mode 100644 index 0000000000..1a78858033 --- /dev/null +++ b/community/binutils-cross/binutils-mips-disable-assert.patch @@ -0,0 +1,14 @@ +diff -urN binutils-2.35.2.orig/bfd/elfxx-mips.c binutils-2.35.2/bfd/elfxx-mips.c +--- binutils-2.35.2.orig/bfd/elfxx-mips.c 2021-01-30 01:38:03.000000000 -0700 ++++ binutils-2.35.2/bfd/elfxx-mips.c 2021-05-13 17:35:34.706913601 -0600 +@@ -6744,8 +6744,10 @@ + in the relocation. */ + if (h != NULL && ! SYMBOL_REFERENCES_LOCAL (info, &h->root)) + { ++#if 0 + BFD_ASSERT (htab->root.target_os == is_vxworks + || h->global_got_area != GGA_NONE); ++#endif + indx = h->root.dynindx; + if (SGI_COMPAT (output_bfd)) + defined_p = h->root.def_regular; diff --git a/community/binutils-cross/binutils-ppc-fix-machine-options.patch b/community/binutils-cross/binutils-ppc-fix-machine-options.patch new file mode 100644 index 0000000000..703ecf98a3 --- /dev/null +++ b/community/binutils-cross/binutils-ppc-fix-machine-options.patch @@ -0,0 +1,41 @@ +Fix for DARN opcode error during ppc64le compilation of rng-tools which +occurs with binutils 2.38 but not with binutils 2.37.. + +https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=cebc89b9328;hp=9cbed90ee623d75e31994e7943960c997ba565f2 + + +diff -aur a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c +--- a/gas/config/tc-ppc.c ++++ b/gas/config/tc-ppc.c +@@ -5965,7 +5965,30 @@ + 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 diff --git a/community/binutils-cross/binutils-s390x-1.patch b/community/binutils-cross/binutils-s390x-1.patch new file mode 100644 index 0000000000..fab51a2fad --- /dev/null +++ b/community/binutils-cross/binutils-s390x-1.patch @@ -0,0 +1,147 @@ +From 82a5bb730a16f8c7962568030268e784b4fb42c8 Mon Sep 17 00:00:00 2001 +From: Stefan Liebler <stli@linux.ibm.com> +Date: Thu, 28 Apr 2022 14:29:58 +0200 +Subject: [PATCH] s390: Avoid dynamic TLS relocs in PIE + +No dynamic relocs are needed for TLS defined in an executable, the +TP relative offset is known at link time. + +Fixes +FAIL: Build pr22263-1 + +bfd/ + PR ld/22263 + * elf64-s390.c (elf_s390_tls_transition): Use bfd_link_dll + instead of bfd_link_pic for TLS. + (elf_s390_check_relocs): Likewise. + (allocate_dynrelocs): Likewise. + (elf_s390_relocate_section): Likewise. + +(cherry picked from commit 26b1426577b5dcb32d149c64cca3e603b81948a9) +--- + bfd/elf64-s390.c | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c +index e780efa7181..00ee386baab 100644 +--- a/bfd/elf64-s390.c ++++ b/bfd/elf64-s390.c +@@ -774,7 +774,7 @@ elf_s390_tls_transition (struct bfd_link_info *info, + 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_entry *h, + 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) + { +@@ -2662,7 +2662,7 @@ elf_s390_relocate_section (bfd *output_bfd, + + /* 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 +2690,7 @@ elf_s390_relocate_section (bfd *output_bfd, + 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 +2801,14 @@ elf_s390_relocate_section (bfd *output_bfd, + 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 +2825,7 @@ elf_s390_relocate_section (bfd *output_bfd, + 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 +2900,7 @@ elf_s390_relocate_section (bfd *output_bfd, + 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 +2922,7 @@ elf_s390_relocate_section (bfd *output_bfd, + + 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 +2972,7 @@ elf_s390_relocate_section (bfd *output_bfd, + 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 +2991,7 @@ elf_s390_relocate_section (bfd *output_bfd, + } + else if (r_type == R_390_TLS_LDCALL) + { +- if (!bfd_link_pic (info)) ++ if (!bfd_link_dll (info)) + { + unsigned int insn0, insn1; + +-- +2.27.0 + diff --git a/community/binutils-cross/binutils-s390x-2.patch b/community/binutils-cross/binutils-s390x-2.patch new file mode 100644 index 0000000000..75d7a931a3 --- /dev/null +++ b/community/binutils-cross/binutils-s390x-2.patch @@ -0,0 +1,51 @@ +From 9a01457e02e7bb594ff9a9ac62a38c909e2e3083 Mon Sep 17 00:00:00 2001 +From: Stefan Liebler <stli@linux.ibm.com> +Date: Thu, 28 Apr 2022 14:30:55 +0200 +Subject: [PATCH] s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pie + +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. + +bfd/ + elf64-s390.c (elf_s390_size_dynamic_sections): + Enforce DT_JMPREL via htab->elf.dt_jmprel_required. + +(cherry picked from commit d942d8db12adf4c9e5c7d9ed6496a779ece7149e) +--- + bfd/elf64-s390.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c +index 00ee386baab..0b851f7ac0e 100644 +--- a/bfd/elf64-s390.c ++++ b/bfd/elf64-s390.c +@@ -1876,7 +1876,20 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + 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. */ +-- +2.27.0 + diff --git a/community/binutils-cross/gold-mips.patch b/community/binutils-cross/gold-mips.patch new file mode 100644 index 0000000000..291a2aae6a --- /dev/null +++ b/community/binutils-cross/gold-mips.patch @@ -0,0 +1,39 @@ +# DP: Fix gold on mips64 targets. + +gold/ + +2016-08-09 Aurelien Jarno <aurelien@aurel32.net> + + * configure.tgt: Add mips64el*-*-*|mips64le*-*-* and mips64*-*-*. + + +--- a/gold/configure.tgt ++++ b/gold/configure.tgt +@@ -153,6 +153,13 @@ aarch64*-*) + targ_big_endian=false + targ_extra_big_endian=true + ;; ++mips*64*el*-*-*|mips*64*le*-*-*) ++ targ_obj=mips ++ targ_machine=EM_MIPS_RS3_LE ++ targ_size=64 ++ targ_big_endian=false ++ targ_extra_big_endian=true ++ ;; + mips*el*-*-*|mips*le*-*-*) + targ_obj=mips + targ_machine=EM_MIPS_RS3_LE +@@ -160,6 +167,13 @@ mips*el*-*-*|mips*le*-*-*) + targ_big_endian=false + targ_extra_big_endian=true + ;; ++mips*64*-*-*) ++ targ_obj=mips ++ targ_machine=EM_MIPS ++ targ_size=64 ++ targ_big_endian=true ++ targ_extra_big_endian=false ++ ;; + mips*-*-*) + targ_obj=mips + targ_machine=EM_MIPS diff --git a/community/binutils-cross/ld-bfd-mips.patch b/community/binutils-cross/ld-bfd-mips.patch new file mode 100644 index 0000000000..2991c88571 --- /dev/null +++ b/community/binutils-cross/ld-bfd-mips.patch @@ -0,0 +1,19 @@ +--- ./ld/configure.tgt.orig ++++ ./ld/configure.tgt +@@ -541,12 +541,12 @@ + ;; + mips*-*-windiss) targ_emul=elf32mipswindiss + ;; +-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 +- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" ++mips64*el-*-linux-*) targ_emul=elf64ltsmip ++ targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +-mips64*-*-linux-*) targ_emul=elf32btsmipn32 +- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" ++mips64*-*-linux-*) targ_emul=elf64btsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" + targ_extra_libpath=$targ_extra_emuls + ;; + mips*el-*-linux-*) targ_emul=elf32ltsmip base-commit: 7b497064eb552ffc32da3dc2fab1acfabf4879a9 prerequisite-patch-id: 755bd398829e789dcf090d9e42d3e53a134dbbb7 prerequisite-patch-id: 592a5ada0ffb1f8b328cdb975ba2e1f1855f7e69 -- 2.36.1
Jakub Jirutka <no-reply@dispatch.alpinelinux.org>New aports should always go to the testing repository first, unless it’s needed as a dependency of some other aport already in community or main. -- via https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35287#note_241610