cross/binutils-*: upgrade to 2.39-r1 (MR 3381)
Generated with modernized aportgen binutils code in pmbootstrap MR 2199.
This commit is contained in:
parent
15f87fa497
commit
452f12bc2c
18 changed files with 273 additions and 4587 deletions
|
@ -2,30 +2,32 @@
|
|||
# Generator: pmbootstrap aportgen binutils-aarch64
|
||||
# Based on: main/binutils
|
||||
|
||||
|
||||
CTARGET_ARCH=aarch64
|
||||
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-aarch64
|
||||
pkgver=2.38
|
||||
pkgrel=4
|
||||
pkgver=2.39
|
||||
pkgrel=1
|
||||
pkgdesc="Tools necessary to build programs for aarch64 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends="gettext libtool autoconf automake bison texinfo"
|
||||
makedepends_build="bison flex texinfo"
|
||||
makedepends_host="zlib-dev"
|
||||
makedepends="$makedepends_build $makedepends_host"
|
||||
arch="x86_64"
|
||||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages="binutils-dev binutils-doc"
|
||||
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
|
||||
binutils-ppc64le-assertion.patch
|
||||
binutils-clang-dwarf-5.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
subpackages=""
|
||||
subpackages="$subpackages binutils-gold"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
|
@ -46,45 +48,102 @@ fi
|
|||
# - CVE-2017-7614
|
||||
|
||||
build() {
|
||||
_target="$(arch_to_hostspec aarch64)"
|
||||
"$builddir"/configure \
|
||||
--build="$CBUILD" \
|
||||
--target=$_target \
|
||||
--with-lib-path=/usr/lib \
|
||||
local _sysroot=/
|
||||
local _cross_configure="--enable-install-libiberty --enable-shared"
|
||||
local _arch_configure=""
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
_plugin_configure="--disable-plugins"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
_gold_configure="--enable-gold"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "x86_64" ]; then
|
||||
_arch_configure="--enable-targets=x86_64-pep"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "riscv64" ]; then
|
||||
_gold_configure="--disable-gold"
|
||||
fi
|
||||
|
||||
case "$CTARGET_ARCH" in
|
||||
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
|
||||
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
|
||||
esac
|
||||
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--target=$CTARGET \
|
||||
--with-build-sysroot="$CBUILDROOT" \
|
||||
--with-sysroot=$_sysroot \
|
||||
--prefix=/usr \
|
||||
--with-sysroot=/usr/$_target \
|
||||
--enable-ld=default \
|
||||
--enable-gold=yes \
|
||||
--enable-plugins \
|
||||
--enable-deterministic-archives \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--disable-multilib \
|
||||
--disable-gprofng \
|
||||
--enable-ld=default \
|
||||
$_gold_configure \
|
||||
--enable-64-bit-bfd \
|
||||
$_plugin_configure \
|
||||
--enable-relro \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-execstack=no \
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls
|
||||
--disable-nls \
|
||||
--with-mmap \
|
||||
--with-system-zlib
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make install DESTDIR="$pkgdir"
|
||||
|
||||
# remove man, info folders
|
||||
rm -rf "$pkgdir"/usr/share
|
||||
|
||||
# remove files that conflict with non-cross binutils
|
||||
rm -rf "$pkgdir"/usr/lib/bfd-plugins
|
||||
if [ -d "$pkgdir"/usr/lib64 ]; then
|
||||
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
|
||||
rmdir "$pkgdir"/usr/lib64
|
||||
fi
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# creating cross tools: remove any files that would conflict
|
||||
# with the native tools, or other cross tools
|
||||
rm -r "${pkgdir:?}"/usr/share
|
||||
rm -f "$pkgdir"/usr/lib/libiberty.a
|
||||
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
|
||||
fi
|
||||
}
|
||||
|
||||
libs() {
|
||||
pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gold() {
|
||||
pkgdesc="GNU binutils - gold linker"
|
||||
|
||||
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
|
||||
fi
|
||||
mkdir -p "$subpkgdir"/usr/$CTARGET/bin
|
||||
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
|
||||
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.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
|
||||
63e58f45df3570279cb1ee5215ba3de77de012cac20da9cdd23f86a93890056e1efa397521559cfd0716d5239604607c440d8f4d089d83c98b8fbc1b5c5305f8 binutils-ppc64le-assertion.patch
|
||||
d76e998cdb68e6beb56ebb5856b1617acb09478596f7a114257e0d027d72be7e408468f83ea023d8cc93e400d9b4e7da0a21b046db70b76fdfeffd4b020a386d binutils-clang-dwarf-5.patch
|
||||
"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,41 +0,0 @@
|
|||
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
|
|
@ -1,32 +0,0 @@
|
|||
From 97dd8079feb35456d7b387a594b5e00f7654b3b8 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 23 Jun 2022 17:50:30 +0930
|
||||
Subject: [PATCH] PowerPC64: fix assertion in ppc_build_one_stub with -Os code
|
||||
|
||||
save_res stubs aren't written in ppc_build_one_stub, their offsets
|
||||
(which are zero) should not be checked.
|
||||
|
||||
* elf64-ppc.c (ppc_build_one_stub): Don't check save_res offsets.
|
||||
|
||||
(cherry picked from commit 570e911f4e533fad33ad5e4e1102929cf7e80bd7)
|
||||
---
|
||||
bfd/elf64-ppc.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
|
||||
index cb12ed476d8..df503341fe9 100644
|
||||
--- a/bfd/elf64-ppc.c
|
||||
+++ b/bfd/elf64-ppc.c
|
||||
@@ -11700,7 +11700,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (htab == NULL)
|
||||
return false;
|
||||
|
||||
- BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
|
||||
+ BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size
|
||||
+ || stub_entry->type.main == ppc_stub_save_res);
|
||||
loc = stub_entry->group->stub_sec->contents + stub_entry->stub_offset;
|
||||
|
||||
htab->stub_count[stub_entry->type.main - 1] += 1;
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
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
|
||||
|
|
@ -2,30 +2,32 @@
|
|||
# Generator: pmbootstrap aportgen binutils-armhf
|
||||
# Based on: main/binutils
|
||||
|
||||
|
||||
CTARGET_ARCH=armhf
|
||||
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-armhf
|
||||
pkgver=2.38
|
||||
pkgrel=4
|
||||
pkgver=2.39
|
||||
pkgrel=1
|
||||
pkgdesc="Tools necessary to build programs for armhf targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends="gettext libtool autoconf automake bison texinfo"
|
||||
makedepends_build="bison flex texinfo"
|
||||
makedepends_host="zlib-dev"
|
||||
makedepends="$makedepends_build $makedepends_host"
|
||||
arch="x86_64"
|
||||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages="binutils-dev binutils-doc"
|
||||
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
|
||||
binutils-ppc64le-assertion.patch
|
||||
binutils-clang-dwarf-5.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
subpackages=""
|
||||
subpackages="$subpackages binutils-gold"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
|
@ -46,45 +48,102 @@ fi
|
|||
# - CVE-2017-7614
|
||||
|
||||
build() {
|
||||
_target="$(arch_to_hostspec armhf)"
|
||||
"$builddir"/configure \
|
||||
--build="$CBUILD" \
|
||||
--target=$_target \
|
||||
--with-lib-path=/usr/lib \
|
||||
local _sysroot=/
|
||||
local _cross_configure="--enable-install-libiberty --enable-shared"
|
||||
local _arch_configure=""
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
_plugin_configure="--disable-plugins"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
_gold_configure="--enable-gold"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "x86_64" ]; then
|
||||
_arch_configure="--enable-targets=x86_64-pep"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "riscv64" ]; then
|
||||
_gold_configure="--disable-gold"
|
||||
fi
|
||||
|
||||
case "$CTARGET_ARCH" in
|
||||
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
|
||||
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
|
||||
esac
|
||||
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--target=$CTARGET \
|
||||
--with-build-sysroot="$CBUILDROOT" \
|
||||
--with-sysroot=$_sysroot \
|
||||
--prefix=/usr \
|
||||
--with-sysroot=/usr/$_target \
|
||||
--enable-ld=default \
|
||||
--enable-gold=yes \
|
||||
--enable-plugins \
|
||||
--enable-deterministic-archives \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--disable-multilib \
|
||||
--disable-gprofng \
|
||||
--enable-ld=default \
|
||||
$_gold_configure \
|
||||
--enable-64-bit-bfd \
|
||||
$_plugin_configure \
|
||||
--enable-relro \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-execstack=no \
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls
|
||||
--disable-nls \
|
||||
--with-mmap \
|
||||
--with-system-zlib
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make install DESTDIR="$pkgdir"
|
||||
|
||||
# remove man, info folders
|
||||
rm -rf "$pkgdir"/usr/share
|
||||
|
||||
# remove files that conflict with non-cross binutils
|
||||
rm -rf "$pkgdir"/usr/lib/bfd-plugins
|
||||
if [ -d "$pkgdir"/usr/lib64 ]; then
|
||||
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
|
||||
rmdir "$pkgdir"/usr/lib64
|
||||
fi
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# creating cross tools: remove any files that would conflict
|
||||
# with the native tools, or other cross tools
|
||||
rm -r "${pkgdir:?}"/usr/share
|
||||
rm -f "$pkgdir"/usr/lib/libiberty.a
|
||||
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
|
||||
fi
|
||||
}
|
||||
|
||||
libs() {
|
||||
pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gold() {
|
||||
pkgdesc="GNU binutils - gold linker"
|
||||
|
||||
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
|
||||
fi
|
||||
mkdir -p "$subpkgdir"/usr/$CTARGET/bin
|
||||
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
|
||||
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.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
|
||||
63e58f45df3570279cb1ee5215ba3de77de012cac20da9cdd23f86a93890056e1efa397521559cfd0716d5239604607c440d8f4d089d83c98b8fbc1b5c5305f8 binutils-ppc64le-assertion.patch
|
||||
d76e998cdb68e6beb56ebb5856b1617acb09478596f7a114257e0d027d72be7e408468f83ea023d8cc93e400d9b4e7da0a21b046db70b76fdfeffd4b020a386d binutils-clang-dwarf-5.patch
|
||||
"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,41 +0,0 @@
|
|||
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
|
|
@ -1,32 +0,0 @@
|
|||
From 97dd8079feb35456d7b387a594b5e00f7654b3b8 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 23 Jun 2022 17:50:30 +0930
|
||||
Subject: [PATCH] PowerPC64: fix assertion in ppc_build_one_stub with -Os code
|
||||
|
||||
save_res stubs aren't written in ppc_build_one_stub, their offsets
|
||||
(which are zero) should not be checked.
|
||||
|
||||
* elf64-ppc.c (ppc_build_one_stub): Don't check save_res offsets.
|
||||
|
||||
(cherry picked from commit 570e911f4e533fad33ad5e4e1102929cf7e80bd7)
|
||||
---
|
||||
bfd/elf64-ppc.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
|
||||
index cb12ed476d8..df503341fe9 100644
|
||||
--- a/bfd/elf64-ppc.c
|
||||
+++ b/bfd/elf64-ppc.c
|
||||
@@ -11700,7 +11700,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (htab == NULL)
|
||||
return false;
|
||||
|
||||
- BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
|
||||
+ BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size
|
||||
+ || stub_entry->type.main == ppc_stub_save_res);
|
||||
loc = stub_entry->group->stub_sec->contents + stub_entry->stub_offset;
|
||||
|
||||
htab->stub_count[stub_entry->type.main - 1] += 1;
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
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
|
||||
|
|
@ -2,30 +2,32 @@
|
|||
# Generator: pmbootstrap aportgen binutils-armv7
|
||||
# Based on: main/binutils
|
||||
|
||||
|
||||
CTARGET_ARCH=armv7
|
||||
CTARGET="$(arch_to_hostspec $CTARGET_ARCH)"
|
||||
|
||||
pkgname=binutils-armv7
|
||||
pkgver=2.38
|
||||
pkgrel=4
|
||||
pkgver=2.39
|
||||
pkgrel=1
|
||||
pkgdesc="Tools necessary to build programs for armv7 targets"
|
||||
url="https://www.gnu.org/software/binutils/"
|
||||
makedepends="gettext libtool autoconf automake bison texinfo"
|
||||
makedepends_build="bison flex texinfo"
|
||||
makedepends_host="zlib-dev"
|
||||
makedepends="$makedepends_build $makedepends_host"
|
||||
arch="x86_64"
|
||||
license="GPL-2.0 GPL-3.0-or-later LGPL-2.0 BSD"
|
||||
subpackages="binutils-dev binutils-doc"
|
||||
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
|
||||
binutils-ppc64le-assertion.patch
|
||||
binutils-clang-dwarf-5.patch
|
||||
"
|
||||
builddir="$srcdir/binutils-$pkgver"
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
subpackages=""
|
||||
subpackages="$subpackages binutils-gold"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
|
@ -46,45 +48,102 @@ fi
|
|||
# - CVE-2017-7614
|
||||
|
||||
build() {
|
||||
_target="$(arch_to_hostspec armv7)"
|
||||
"$builddir"/configure \
|
||||
--build="$CBUILD" \
|
||||
--target=$_target \
|
||||
--with-lib-path=/usr/lib \
|
||||
local _sysroot=/
|
||||
local _cross_configure="--enable-install-libiberty --enable-shared"
|
||||
local _arch_configure=""
|
||||
local _gold_configure="--disable-gold"
|
||||
local _plugin_configure="--enable-plugins"
|
||||
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
_sysroot="$CBUILDROOT"
|
||||
_cross_configure="--disable-install-libiberty"
|
||||
_plugin_configure="--disable-plugins"
|
||||
fi
|
||||
|
||||
if [ "$CHOST" = "$CBUILD" ] && [ "$CBUILD" = "$CTARGET" ] && [ "$CTARGET_ARCH" != "riscv64" ]; then
|
||||
_gold_configure="--enable-gold"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "x86_64" ]; then
|
||||
_arch_configure="--enable-targets=x86_64-pep"
|
||||
fi
|
||||
|
||||
if [ "$CTARGET_ARCH" = "riscv64" ]; then
|
||||
_gold_configure="--disable-gold"
|
||||
fi
|
||||
|
||||
case "$CTARGET_ARCH" in
|
||||
mips*) _hash_style_configure="--enable-default-hash-style=sysv" ;;
|
||||
*) _hash_style_configure="--enable-default-hash-style=gnu" ;;
|
||||
esac
|
||||
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--target=$CTARGET \
|
||||
--with-build-sysroot="$CBUILDROOT" \
|
||||
--with-sysroot=$_sysroot \
|
||||
--prefix=/usr \
|
||||
--with-sysroot=/usr/$_target \
|
||||
--enable-ld=default \
|
||||
--enable-gold=yes \
|
||||
--enable-plugins \
|
||||
--enable-deterministic-archives \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--disable-multilib \
|
||||
--disable-gprofng \
|
||||
--enable-ld=default \
|
||||
$_gold_configure \
|
||||
--enable-64-bit-bfd \
|
||||
$_plugin_configure \
|
||||
--enable-relro \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-execstack=no \
|
||||
$_cross_configure \
|
||||
$_arch_configure \
|
||||
$_hash_style_configure \
|
||||
--with-pic \
|
||||
--disable-werror \
|
||||
--disable-nls
|
||||
--disable-nls \
|
||||
--with-mmap \
|
||||
--with-system-zlib
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make install DESTDIR="$pkgdir"
|
||||
|
||||
# remove man, info folders
|
||||
rm -rf "$pkgdir"/usr/share
|
||||
|
||||
# remove files that conflict with non-cross binutils
|
||||
rm -rf "$pkgdir"/usr/lib/bfd-plugins
|
||||
if [ -d "$pkgdir"/usr/lib64 ]; then
|
||||
mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
|
||||
rmdir "$pkgdir"/usr/lib64
|
||||
fi
|
||||
if [ "$CHOST" != "$CTARGET" ]; then
|
||||
# creating cross tools: remove any files that would conflict
|
||||
# with the native tools, or other cross tools
|
||||
rm -r "${pkgdir:?}"/usr/share
|
||||
rm -f "$pkgdir"/usr/lib/libiberty.a
|
||||
rm -r "${pkgdir:?}"/usr/lib/bfd-plugins
|
||||
fi
|
||||
}
|
||||
|
||||
libs() {
|
||||
pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/lib
|
||||
mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/
|
||||
}
|
||||
|
||||
gold() {
|
||||
pkgdesc="GNU binutils - gold linker"
|
||||
|
||||
if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
|
||||
fi
|
||||
mkdir -p "$subpkgdir"/usr/$CTARGET/bin
|
||||
mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
|
||||
68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.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
|
||||
63e58f45df3570279cb1ee5215ba3de77de012cac20da9cdd23f86a93890056e1efa397521559cfd0716d5239604607c440d8f4d089d83c98b8fbc1b5c5305f8 binutils-ppc64le-assertion.patch
|
||||
d76e998cdb68e6beb56ebb5856b1617acb09478596f7a114257e0d027d72be7e408468f83ea023d8cc93e400d9b4e7da0a21b046db70b76fdfeffd4b020a386d binutils-clang-dwarf-5.patch
|
||||
"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,41 +0,0 @@
|
|||
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
|
|
@ -1,32 +0,0 @@
|
|||
From 97dd8079feb35456d7b387a594b5e00f7654b3b8 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 23 Jun 2022 17:50:30 +0930
|
||||
Subject: [PATCH] PowerPC64: fix assertion in ppc_build_one_stub with -Os code
|
||||
|
||||
save_res stubs aren't written in ppc_build_one_stub, their offsets
|
||||
(which are zero) should not be checked.
|
||||
|
||||
* elf64-ppc.c (ppc_build_one_stub): Don't check save_res offsets.
|
||||
|
||||
(cherry picked from commit 570e911f4e533fad33ad5e4e1102929cf7e80bd7)
|
||||
---
|
||||
bfd/elf64-ppc.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
|
||||
index cb12ed476d8..df503341fe9 100644
|
||||
--- a/bfd/elf64-ppc.c
|
||||
+++ b/bfd/elf64-ppc.c
|
||||
@@ -11700,7 +11700,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (htab == NULL)
|
||||
return false;
|
||||
|
||||
- BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
|
||||
+ BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size
|
||||
+ || stub_entry->type.main == ppc_stub_save_res);
|
||||
loc = stub_entry->group->stub_sec->contents + stub_entry->stub_offset;
|
||||
|
||||
htab->stub_count[stub_entry->type.main - 1] += 1;
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
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
|
||||
|
Loading…
Reference in a new issue