This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR23653, ld SIGSEGVs when attempts to link sparc object with x86_64 library
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 17 Oct 2018 14:38:29 +1030
- Subject: PR23653, ld SIGSEGVs when attempts to link sparc object with x86_64 library
>From 4de5434b694fc260d02610e8e7fec21b2923600a Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 17 Oct 2018 09:17:30 +1030
Subject: [PATCH 1/3]
This patch improves dynobj selection. This allows the testcase in the
PR to proceed further before segfaulting due to other bugs in the
sparc backend.
../ld/ld-new --eh-frame-hdr -m elf_x86_64 -shared -o bug.so.5 bug.o ./libc.so.6 ./crtendS.o
../ld/ld-new: sparc architecture of input file `bug.o' is incompatible with i386:x86-64 output
../ld/ld-new: bug.o: in function `a':
bug.c:(.text+0x4): undefined reference to `_GLOBAL_OFFSET_TABLE_'
../ld/ld-new: bug.c:(.text+0x8): undefined reference to `_GLOBAL_OFFSET_TABLE_'
Segmentation fault
PR 23653
* elflink.c (_bfd_elf_link_create_dynstrtab): Match elf_object_id
too when choosing dynobj.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 78d8c54341..c3876cbf3e 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -223,6 +223,7 @@ _bfd_elf_link_create_dynstrtab (bfd *abfd, struct bfd_link_info *info)
if ((ibfd->flags
& (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0
&& bfd_get_flavour (ibfd) == bfd_target_elf_flavour
+ && elf_object_id (ibfd) == elf_hash_table_id (hash_table)
&& !((s = ibfd->sections) != NULL
&& s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS))
{
--
Alan Modra
Australia Development Lab, IBM