SHA256
1
0
forked from pool/binutils

- Update to version 2.42:

* Add support for many aarch64 extensions: SVE2.1, SME2.1, B16B16,
  RASv2, LSE128, GCS, CHK, SPECRES2, LRCPC3, THE, ITE, D128, XS and
  flags to enable them: '+fcma', '+jscvt', '+frintts', '+flagm2',
  '+rcpc2' and '+wfxt'
* Add experimantal support for GAS to synthesize call-frame-info for
  some hand-written asm (--scfi=experimental) on x86-64.
* Add support for more x86-64 extensions: APX: 32 GPRs, NDD, PUSH2/POP2,
  PUSHP/POPP; USER_MSR, AVX10.1, PBNDKB, SM4, SM3, SHA512, AVX-VNNI-INT16.
* Add support for more RISC-V extensions: T-Head v2.3.0, CORE-V v1.0,
  SiFive VCIX v1.0.
* BPF assembler: ';' separates statements now, and does not introduce
  line comments anymore (use '#' or '//' for this).
* x86-64 ld: Add '-z mark-plt/-z nomark-plt' to mark PLT entries with
  dynamic tags.
* risc-v ld: Add '--[no-]check-uleb128'.
* New linker script directive: REVERSE, to be combined with SORT_BY_NAME
  or SORT_BY_INIT_PRIORITY, reverses the generated order.
* New linker options --warn-execstack-objects (warn only about execstack
  when input object files request it), and --error-execstack plus
  --error-rxw-segments to convert the existing warnings into errors.
* objdump: Add -Z/--decompress to be used with -s/--full-contents to
  decompress section contents before displaying.
* readelf: Add --extra-sym-info to be used with --symbols (currently
  prints section name of references section index).
* objcopy: Add --set-section-flags for x86_64 to include
  SHF_X86_64_LARGE.
* s390 disassembly: add target-specific disasm option 'insndesc',
  as in "objdump -M insndesc" to display an instruction description
  as comment along with the disassembly.

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=458
This commit is contained in:
Michael Matz 2024-01-30 15:49:12 +00:00 committed by Git OBS Bridge
parent f30534e59c
commit 98284da2a0
12 changed files with 72 additions and 430 deletions

View File

@ -1,207 +0,0 @@
This is for userspace live patching, adding some space into
shared libs or executable (in the .ulp section) when one of the
input files contains a section named .ulp.track.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 101c2fdf50d..f5d9e201fdb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1487,6 +1487,10 @@ struct elf_backend_data
(const bfd *ibfd, bfd *obfd, const Elf_Internal_Shdr *isection,
Elf_Internal_Shdr *osection);
+ bool (*elf_backend_is_ulp_enabled) (bfd *abfd);
+
+ bool (*elf_backend_setup_ulp) (struct bfd_link_info *);
+
/* Used to handle bad SHF_LINK_ORDER input. */
void (*link_order_error_handler) (const char *, ...);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ce1407fa2dc..5c70bcf6c07 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -7260,6 +7260,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
s = bfd_get_linker_section (dynobj, ".gnu.version");
s->flags |= SEC_EXCLUDE;
}
+
+ if (bed->elf_backend_is_ulp_enabled != NULL
+ && bed->elf_backend_setup_ulp != NULL
+ && (*bed->elf_backend_is_ulp_enabled) (info->input_bfds))
+ {
+ (*bed->elf_backend_setup_ulp)(info);
+ }
}
return true;
}
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 4c6b1f20340..1f54509cd08 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -771,6 +771,14 @@
#define elf_backend_copy_special_section_fields _bfd_elf_copy_special_section_fields
#endif
+#ifndef elf_backend_is_ulp_enabled
+#define elf_backend_is_ulp_enabled NULL
+#endif
+
+#ifndef elf_backend_setup_ulp
+#define elf_backend_setup_ulp NULL
+#endif
+
#ifndef elf_backend_compact_eh_encoding
#define elf_backend_compact_eh_encoding NULL
#endif
@@ -904,6 +912,8 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_maybe_function_sym,
elf_backend_get_reloc_section,
elf_backend_copy_special_section_fields,
+ elf_backend_is_ulp_enabled,
+ elf_backend_setup_ulp,
elf_backend_link_order_error_handler,
elf_backend_relplt_name,
ELF_MACHINE_ALT1,
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 62d516aab8d..c0fb718d85c 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -29,6 +29,8 @@
#define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
#define ELFX32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1"
+#define ULP_ENTRY_LEN 16
+
bool
_bfd_x86_elf_mkobject (bfd *abfd)
{
@@ -984,6 +986,64 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
return valid_p;
}
+/* Check if input bfds are ulp-enabled by containing .ulp.track section */
+
+bool
+_bfd_x86_elf_is_ulp_enabled (struct bfd *input_bfd)
+{
+ while (input_bfd != NULL)
+ for (; input_bfd != NULL; input_bfd = input_bfd->link.next)
+ {
+ if (input_bfd->section_count == 0) continue;
+ if (bfd_get_section_by_name (input_bfd, ".ulp.track")) return true;
+ }
+ return false;
+}
+
+/* To be used by elf_link_hash_traverse when computing the ulp length */
+
+static bool
+bfd_x86_elf_link_compute_ulp (struct elf_link_hash_entry *h, void *data)
+{
+ unsigned long *ulp_length = (unsigned long *) data;
+
+ if (h->dynindx != -1 && h->type == STT_FUNC && !h->def_dynamic)
+ {
+ ++(*ulp_length);
+ }
+ return true;
+}
+
+/* Fill the user-space live patching section */
+
+bool
+_bfd_x86_elf_setup_ulp (struct bfd_link_info *info)
+{
+ struct elf_x86_link_hash_table *htab;
+ asection *ulp;
+ unsigned int ulp_length = 0;
+
+ htab = elf_x86_hash_table (info, X86_64_ELF_DATA);
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ bfd_x86_elf_link_compute_ulp,
+ &ulp_length);
+
+ ulp = htab->ulp;
+
+ ulp->size = ulp_length * ULP_ENTRY_LEN;
+
+ ulp->contents = (bfd_byte *) bfd_malloc (ulp->size);
+ if (ulp->contents == NULL)
+ return false;
+
+ if (!ulp->contents)
+ return false;
+
+ memset(ulp->contents, 0x00, ulp->size);
+ return true;
+}
+
/* Set the sizes of the dynamic sections. */
bool
@@ -3030,7 +3090,26 @@ _bfd_x86_elf_link_setup_gnu_properties
htab->plt_second = sec;
}
- }
+
+ /* create sections to support user-space live patching */
+ if (_bfd_x86_elf_is_ulp_enabled(info->input_bfds))
+ {
+ flagword flags = (bed->dynamic_sec_flags
+ | SEC_ALLOC
+ | SEC_CODE
+ | SEC_LOAD
+ | SEC_READONLY);
+
+ sec = bfd_make_section_anyway_with_flags (dynobj, ".ulp", flags);
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F%P: failed to create ULP section\n"));
+
+ if (!bfd_set_section_alignment (sec, plt_alignment))
+ goto error_alignment;
+
+ htab->ulp = sec;
+ }
+ }
if (!info->no_ld_generated_unwind_info)
{
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index db11327e96f..89f51382216 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -607,6 +607,7 @@ struct elf_x86_link_hash_table
asection *plt_second_eh_frame;
asection *plt_got;
asection *plt_got_eh_frame;
+ asection *ulp;
sframe_encoder_ctx *plt_cfe_ctx;
asection *plt_sframe;
@@ -694,6 +695,12 @@ extern void _bfd_x86_elf_link_report_relative_reloc
(struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
Elf_Internal_Sym *, const char *, const void *);
+extern bool _bfd_x86_elf_is_ulp_enabled
+ (struct bfd *);
+
+extern bool _bfd_x86_elf_setup_ulp
+ (struct bfd_link_info *);
+
#define bfd_elf64_mkobject \
_bfd_x86_elf_mkobject
#define bfd_elf32_mkobject \
@@ -907,6 +914,10 @@ extern void _bfd_x86_elf_link_report_relative_reloc
_bfd_elf_x86_size_relative_relocs
#define elf_backend_finish_relative_relocs \
_bfd_elf_x86_finish_relative_relocs
+#define elf_backend_is_ulp_enabled \
+ _bfd_x86_elf_is_ulp_enabled
+#define elf_backend_setup_ulp \
+ _bfd_x86_elf_setup_ulp
#define ELF_P_ALIGN ELF_MINPAGESIZE

BIN
binutils-2.41-branch.diff.gz (Stored with Git LFS)

Binary file not shown.

BIN
binutils-2.41.tar.bz2 (Stored with Git LFS)

Binary file not shown.

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEOiS8Ho+0CfqfFDcYE/zvid2ePE8FAmTGcUQACgkQE/zvid2e
PE94TRAAsAGH/rarx1cyAxa8x0yKjcQxERag3KE3NXN+OnRvw2bCOfVx62UA68Dt
nTCsJ46MTSECdMnMj+b6wGNXr4JDv57r4lkJxJN8TjAS+gWrouqbjvaTPOkros3L
1uElw3JLBznDktYvv2aJxBTLSPRXxaD2gMSjVYSZ5X43/ITbNx8mSToevZf2erXB
ev+FY5ROyjPwFZyXTEYqqbbdJ4A6+Fkp1UO9UiQv3leZde29ZSiBbNZUU4u5FH3x
qNq9zTd4Wlk72X1IEK/HFIVAcFbV2bV38V/r64tw5WRndYReXejtEQMm4kvzFZP4
tcgzlTNViTN8FmVNI3P3pByFxC4VmNEbnNCGTDzltuC/RxypqMHWdkBIFU2Zpk4p
oAuRMx+7MJ0MqbZjV+VklZAqbl71oDAtUEi7gwKL/UFsRnmUbjRV00YQrXv1kmm8
FAuK3UJbfX95MkMV9RSB4kwAdGTLv9CpWix+NGIQs17bnYXyuZPQ0OFuYM6xBDlo
IXTS3kvAgKLRni7EQ0xAh3CqQaE5vsLHf7WwTYvi4rWdt0B1hVpFJtpkAhWRrF/N
5Hey/pJgOaS2CqEpbijkfG6mGh/xNYK0T8HnHse1pKjl1U1QEgOtluVI3UF2C/H/
FkrlClxbExTt9+UmuF/wdvttVj7hDooI7Hh11uvOVBabtlUc66E=
=6jCW
-----END PGP SIGNATURE-----

BIN
binutils-2.42-branch.diff.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
binutils-2.42.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

16
binutils-2.42.tar.bz2.sig Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEOiS8Ho+0CfqfFDcYE/zvid2ePE8FAmW3wiYACgkQE/zvid2e
PE+HQBAAgC3yZJvJBx/0EtNESazNRpUG8G4pnd0505QYiibf+5243xXusDySXVu3
iBt2UltDPauPu6eIUC7qY0xaZHhPuxqPHp6oSrB73iHZ7ovTdbZUX2060Ro8KXha
xN6+SPBHQGxP8XZw+ezexYNpwHBGM8CUos7UeeLpskuSBRGQC4bEhCOR8wuvU1w9
gHTFuOY5zKgzzNMr1fPp/tRqUqZr8A7R1HN6tAs+4N2QWLk9Z/oF7h7Rkrzqe8gY
vmaakulfBTiqNIZJyTQhbhPiWrtLdElKyohBa/enqtTrktXoX/gwX21+LMqU+Oh3
qE7CicjEZKGK/e8gl0BjcwgMeuUYYpZRUI1+A++YAu+YPSzLQL9iPy1FUovrYhHO
Fr/qV156MtnhkoaI7RVDLKl2s3CP451yjHSDcAsB51wq+QophC3z6yoTXKuKW8h6
v2yW5ZaG5GfiPmRw+E46qsZWeb2pOUaGVU8ovaYWfLjrZ20WFZwZKLn55ZwZ35eW
g3RSff4f0lqr8x7jWDkf+KQMC2K0O6Sl0sgFoFE6PMPFcGe4r6oSIekNygaFgxBv
DrL0IA8y1prpmpnJrGbIg1+ciguAJKEBfcV9pNyq1IAHWu3aOMbWKb5pF0ukb0PY
OueuuH06uaBa7vgZxvbTiw0j5+PuTlGHa3Bsf4rlkChK2N/6deQ=
=5bYR
-----END PGP SIGNATURE-----

View File

@ -1,131 +0,0 @@
We need this for libQt5WebEngine on i586. (bsc#1216908)
From 836654b1177ab305c36fe7319f08f0ad5d4fac1b Mon Sep 17 00:00:00 2001
From: Michael Matz <matz@suse.de>
Date: Tue, 7 Nov 2023 16:54:44 +0100
Subject: ld: Avoid overflows in string merging
To: binutils@sourceware.org
as the bug report shows we had an overflow in the test if
hash table resizing is needed. Reorder the expression to avoid
that. There's still a bug somewhere in gracefully handling
failure in resizing (e.g. out of memory), but this pushes the
boundary for that occurring somewhen into the future and
immediately helps the reporter.
bfd/
PR ld/31009
* merge.c (NEEDS_RESIZE): New macro avoiding overflow.
(sec_merge_maybe_resize): Use it.
(sec_merge_hash_insert): Ditto.
---
bfd/merge.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/bfd/merge.c b/bfd/merge.c
index 722e6659486..61ffab4d706 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -94,6 +94,10 @@ struct sec_merge_hash
struct sec_merge_hash_entry **values;
};
+/* True when given NEWCOUNT and NBUCKETS indicate that the hash table needs
+ resizing. */
+#define NEEDS_RESIZE(newcount, nbuckets) ((newcount) > (nbuckets) / 3 * 2)
+
struct sec_merge_sec_info;
/* Information per merged blob. This is the unit of merging and is
@@ -167,7 +171,7 @@ static bool
sec_merge_maybe_resize (struct sec_merge_hash *table, unsigned added)
{
struct bfd_hash_table *bfdtab = &table->table;
- if (bfdtab->count + added > table->nbuckets * 2 / 3)
+ if (NEEDS_RESIZE (bfdtab->count + added, table->nbuckets))
{
unsigned i;
unsigned long newnb = table->nbuckets * 2;
@@ -175,7 +179,7 @@ sec_merge_maybe_resize (struct sec_merge_hash *table, unsigned added)
uint64_t *newl;
unsigned long alloc;
- while (bfdtab->count + added > newnb * 2 / 3)
+ while (NEEDS_RESIZE (bfdtab->count + added, newnb))
{
newnb *= 2;
if (!newnb)
@@ -239,8 +243,8 @@ sec_merge_hash_insert (struct sec_merge_hash *table,
hashp->alignment = 0;
hashp->u.suffix = NULL;
hashp->next = NULL;
- // We must not need resizing, otherwise _index is wrong
- BFD_ASSERT (bfdtab->count + 1 <= table->nbuckets * 2 / 3);
+ // We must not need resizing, otherwise the estimation was wrong
+ BFD_ASSERT (!NEEDS_RESIZE (bfdtab->count + 1, table->nbuckets));
bfdtab->count++;
table->key_lens[_index] = (hash << 32) | (uint32_t)len;
table->values[_index] = hashp;
--
2.42.0
From 21160d8a18dc21aafb8ab1026e13e5c524954a46 Mon Sep 17 00:00:00 2001
From: Michael Matz <matz@suse.de>
Date: Tue, 7 Nov 2023 17:12:46 +0100
Subject: bfd: use less memory in string merging
To: binutils@sourceware.org
the offset-to-entry mappings are allocated in blocks, which may
become a bit wasteful in case there are extremely many small
input files or sections. This made it so that a large project
(Qt5WebEngine) didn't build anymore on x86 32bit due to address
space limits. It barely fit into address space before the new
string merging, and then got pushed over the limit by this.
So instead of leaving the waste reallocate the maps to their final
size once known. Now the link barely fits again.
bfd/
* merge.c (record_section): Reallocate offset maps to their
final size.
---
bfd/merge.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/bfd/merge.c b/bfd/merge.c
index 61ffab4d706..eeaa1a01fe3 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -711,6 +711,7 @@ record_section (struct sec_merge_info *sinfo,
unsigned int align;
bfd_size_type amt;
bfd_byte *contents;
+ void *tmpptr;
amt = sec->size;
if (sec->flags & SEC_STRINGS)
@@ -771,6 +772,19 @@ record_section (struct sec_merge_info *sinfo,
free (contents);
contents = NULL;
+
+ /* We allocate the ofsmap arrays in blocks of 2048 elements.
+ In case we have very many small input files/sections,
+ this might waste large amounts of memory, so reallocate these
+ arrays here to their true size. */
+ amt = secinfo->noffsetmap + 1;
+ tmpptr = bfd_realloc (secinfo->map, amt * sizeof(secinfo->map[0]));
+ if (tmpptr)
+ secinfo->map = tmpptr;
+ tmpptr = bfd_realloc (secinfo->map_ofs, amt * sizeof(secinfo->map_ofs[0]));
+ if (tmpptr)
+ secinfo->map_ofs = tmpptr;
+
/*printf ("ZZZ %s:%s %u entries\n", sec->owner->filename, sec->name,
(unsigned)secinfo->noffsetmap);*/
--
2.42.0

View File

@ -1,3 +1,45 @@
-------------------------------------------------------------------
Tue Jan 30 13:52:11 UTC 2024 - Michael Matz <matz@suse.com>
- Update to version 2.42:
* Add support for many aarch64 extensions: SVE2.1, SME2.1, B16B16,
RASv2, LSE128, GCS, CHK, SPECRES2, LRCPC3, THE, ITE, D128, XS and
flags to enable them: '+fcma', '+jscvt', '+frintts', '+flagm2',
'+rcpc2' and '+wfxt'
* Add experimantal support for GAS to synthesize call-frame-info for
some hand-written asm (--scfi=experimental) on x86-64.
* Add support for more x86-64 extensions: APX: 32 GPRs, NDD, PUSH2/POP2,
PUSHP/POPP; USER_MSR, AVX10.1, PBNDKB, SM4, SM3, SHA512, AVX-VNNI-INT16.
* Add support for more RISC-V extensions: T-Head v2.3.0, CORE-V v1.0,
SiFive VCIX v1.0.
* BPF assembler: ';' separates statements now, and does not introduce
line comments anymore (use '#' or '//' for this).
* x86-64 ld: Add '-z mark-plt/-z nomark-plt' to mark PLT entries with
dynamic tags.
* risc-v ld: Add '--[no-]check-uleb128'.
* New linker script directive: REVERSE, to be combined with SORT_BY_NAME
or SORT_BY_INIT_PRIORITY, reverses the generated order.
* New linker options --warn-execstack-objects (warn only about execstack
when input object files request it), and --error-execstack plus
--error-rxw-segments to convert the existing warnings into errors.
* objdump: Add -Z/--decompress to be used with -s/--full-contents to
decompress section contents before displaying.
* readelf: Add --extra-sym-info to be used with --symbols (currently
prints section name of references section index).
* objcopy: Add --set-section-flags for x86_64 to include
SHF_X86_64_LARGE.
* s390 disassembly: add target-specific disasm option 'insndesc',
as in "objdump -M insndesc" to display an instruction description
as comment along with the disassembly.
- Add binutils-2.42-branch.diff.gz.
- Rebased s390-biarch.diff.
- Removed binutils-2.41-branch.diff.gz, binutils-2.41.tar.bz2,
binutils-2.41-branch.diff.gz.
- Removed binutils-use-less-memory.diff and riscv-relro.patch
(both upstreamed).
- Removed add-ulp-section.diff, we use a different mechanism
for live patching since a long time.
-------------------------------------------------------------------
Thu Nov 9 16:51:13 UTC 2023 - Michael Matz <matz@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package binutils
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -64,7 +64,7 @@ BuildRequires: zlib-devel
%if %{suse_version} > 1500
BuildRequires: libzstd-devel
%endif
Version: 2.41
Version: 2.42
Release: 0
# disable libalternatives for now until it's changed to not
@ -131,7 +131,7 @@ Source: binutils-%{version}.tar.bz2
Source2: binutils-%{version}.tar.bz2.sig
Source3: binutils.keyring
Source4: baselibs.conf
Patch1: binutils-2.41-branch.diff.gz
Patch1: binutils-2.42-branch.diff.gz
Patch3: binutils-skip-rpaths.patch
Patch4: s390-biarch.diff
Patch5: x86-64-biarch.patch
@ -154,9 +154,6 @@ Patch42: binutils-compat-old-behaviour.diff
Patch43: binutils-revert-hlasm-insns.diff
Patch44: binutils-revert-rela.diff
Patch45: binutils-old-makeinfo.diff
Patch46: riscv-relro.patch
Patch47: binutils-use-less-memory.diff
Patch100: add-ulp-section.diff
Patch90: cross-avr-nesc-as.patch
Patch92: cross-avr-omit_section_dynsym.patch
Patch93: cross-avr-size.patch
@ -285,9 +282,6 @@ cp ld/ldgram.y ld/ldgram.y.orig
%if %{suse_version} < 1500
%patch45 -p1
%endif
%patch46 -p1
%patch47 -p1
%patch100 -p1
%if "%{TARGET}" == "avr"
cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
%patch90
@ -543,6 +537,7 @@ rm -rf %{buildroot}%{_prefix}/%{HOST}/bin
mkdir -p %{buildroot}%{_prefix}/%{HOST}/bin
ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} %{buildroot}%{_prefix}/%{HOST}/bin
mv %{buildroot}%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
rm -f $RPM_BUILD_ROOT%{_libdir}/ldscripts/stamp
ln -sf ../../%{_lib}/ldscripts %{buildroot}%{_prefix}/%{HOST}/lib/ldscripts
# Install header files
make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=%{buildroot}

View File

@ -1,57 +0,0 @@
From 7345d05aafde53a48d5a587a6d9c1778db78e0f3 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 21 Sep 2023 16:49:41 +0200
Subject: [PATCH] RISC-V: Protect .got with relro
Move .got before .data so that it can be protected with -zrelro. Also
separate .got.plt from .got if -znow is not in effect; the first two words
of .got.plt are placed within the relro region.
ld:
PR ld/30877
* emulparams/elf32lriscv-defs.sh (DATA_GOT, SEPARATE_GOTPLT):
Define.
* emulparams/elf64lriscv-defs.sh (SEPARATE_GOTPLT): Define.
* testsuite/ld-elf/binutils.exp (binutils_test): Remove riscv*-*-*
from relro_got expression.
---
ld/emulparams/elf32lriscv-defs.sh | 4 ++++
ld/emulparams/elf64lriscv-defs.sh | 1 +
ld/testsuite/ld-elf/binutils.exp | 1 -
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ld/emulparams/elf32lriscv-defs.sh b/ld/emulparams/elf32lriscv-defs.sh
index b823cedacab..016556168c3 100644
--- a/ld/emulparams/elf32lriscv-defs.sh
+++ b/ld/emulparams/elf32lriscv-defs.sh
@@ -47,3 +47,7 @@ INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIO
OTHER_END_SYMBOLS="${CREATE_SHLIB-__BSS_END__ = .;
__global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800,
MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ - 0x800));}"
+
+# Put .got before .data
+DATA_GOT=" "
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 8 ? 8 : 0"
diff --git a/ld/emulparams/elf64lriscv-defs.sh b/ld/emulparams/elf64lriscv-defs.sh
index 84a700a5f58..ca15338428f 100644
--- a/ld/emulparams/elf64lriscv-defs.sh
+++ b/ld/emulparams/elf64lriscv-defs.sh
@@ -1,2 +1,3 @@
source_sh ${srcdir}/emulparams/elf32lriscv-defs.sh
ELFSIZE=64
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 16 ? 16 : 0"
diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp
index 674e8e9a575..b38e29ed6fb 100644
--- a/ld/testsuite/ld-elf/binutils.exp
+++ b/ld/testsuite/ld-elf/binutils.exp
@@ -95,7 +95,6 @@ proc binutils_test { prog_name ld_options test {test_name ""} {readelf_options "
|| [istarget "mips*-*-*"] \
|| [istarget "nios2*-*-*"] \
|| [istarget "or1k-*-*"] \
- || [istarget "riscv*-*-*"] \
|| [istarget "sh*-*-*"] \
|| [istarget "x86_64-*-rdos*"])]
# Check if GNU_RELRO segment is generated.
--
2.42.0

View File

@ -1,11 +1,11 @@
Index: ld/emulparams/elf_s390.sh
===================================================================
--- ld/emulparams/elf_s390.sh.orig 2019-09-09 18:48:59.000000000 +0200
+++ ld/emulparams/elf_s390.sh 2019-09-09 18:49:02.000000000 +0200
@@ -12,3 +12,18 @@ GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
--- ld/emulparams/elf_s390.sh.orig 2024-01-29 01:00:00.000000000 +0100
+++ ld/emulparams/elf_s390.sh 2024-01-30 14:45:36.996853073 +0100
@@ -13,3 +13,18 @@ GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
IREL_IN_PLT=
SYMBOL_ABI_ALIGNMENT=2
+
+# Treat a host that matches the target with the possible exception of "x"
+# in the name as if it were native.