aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-09-30 08:13:56 +0800
committerH.J. Lu <hjl.tools@gmail.com>2025-10-03 06:08:42 +0800
commitb6ac5a8a5b82f0ae6a4642c8d7149b325f4cc60a (patch)
tree9ede5cac7c3f975c25db741a5c09032cbc99ab78
parent6b21c8b2ecfef5c95142cbc2c32f185cb1c26ab0 (diff)
downloadbinutils-b6ac5a8a5b82f0ae6a4642c8d7149b325f4cc60a.zip
binutils-b6ac5a8a5b82f0ae6a4642c8d7149b325f4cc60a.tar.gz
binutils-b6ac5a8a5b82f0ae6a4642c8d7149b325f4cc60a.tar.bz2
x86: Keep _GLOBAL_OFFSET_TABLE_ for .eh_frame
Since x86 .eh_frame section may reference _GLOBAL_OFFSET_TABLE_, keep _GLOBAL_OFFSET_TABLE_ if there is dynamic section and the output .eh_frame section is non-empty. PR ld/33499 * elfxx-x86.c (_bfd_x86_elf_late_size_sections): Keep _GLOBAL_OFFSET_TABLE_ if there is dynamic section and the output .eh_frame section is non-empty. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
-rw-r--r--bfd/elfxx-x86.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index d8c653a..140e868 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -2456,6 +2456,8 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd,
if (htab->elf.sgotplt)
{
+ asection *eh_frame;
+
/* Don't allocate .got.plt section if there are no GOT nor PLT
entries and there is no reference to _GLOBAL_OFFSET_TABLE_. */
if ((htab->elf.hgot == NULL
@@ -2468,7 +2470,11 @@ _bfd_x86_elf_late_size_sections (bfd *output_bfd,
&& (htab->elf.iplt == NULL
|| htab->elf.iplt->size == 0)
&& (htab->elf.igotplt == NULL
- || htab->elf.igotplt->size == 0))
+ || htab->elf.igotplt->size == 0)
+ && (!htab->elf.dynamic_sections_created
+ || (eh_frame = bfd_get_section_by_name (output_bfd,
+ ".eh_frame")) == NULL
+ || eh_frame->rawsize == 0))
{
htab->elf.sgotplt->size = 0;
/* Solaris requires to keep _GLOBAL_OFFSET_TABLE_ even if it