This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Prevent the linker from crashing.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: binutils at sourceware dot org
- Cc: dan at codesourcery dot com
- Cc: joseph at codesourcery dot com
- Date: Fri, 8 Sep 2006 11:45:12 -0700
- Subject: [patch] Prevent the linker from crashing.
Hi,
Attached is a patch to prevent the linker from crashing. References
to TLS symbols are discarded from the --just-syms file; other
references should resolve normally.
Tested on powerpc. OK to apply?
Kazu Hirata
2006-09-08 Daniel Jacobowitz <dan@codesourcery.com>
* elflink.c (_bfd_elf_merge_symbol): Discard references to TLS
symbols from the --just-syms file.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.228
diff -u -r1.228 elflink.c
--- bfd/elflink.c 7 Sep 2006 17:16:31 -0000 1.228
+++ bfd/elflink.c 8 Sep 2006 18:36:07 -0000
@@ -832,6 +832,15 @@
sec = *psec;
bind = ELF_ST_BIND (sym->st_info);
+ /* Silently discard TLS symbols from --just-syms. There's no way to
+ combine a static TLS block with a new TLS block for this executable. */
+ if (ELF_ST_TYPE (sym->st_info) == STT_TLS
+ && sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ {
+ *skip = TRUE;
+ return TRUE;
+ }
+
if (! bfd_is_und_section (sec))
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
else