From 35f82954b5e46ef5f56653d4f3aa0d1236f558da Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 14 Feb 2015 20:17:28 -0800 Subject: Properly place the NULL STT_FILE symbol We output a NULL STT_FILE symbol for forced local symbols so that they are not associated with the STT_FILE symbol for real local symbols. This patch makes sure that the NULL STT_FILE symbol is placed before forced local symbols. bfd/ PR ld/17975 * elflink.c (elf_link_output_extsym): Only check filesym_count when outputting a NULL FILE symbol. Set second_pass_sym to h->forced_local && !h->root.linker_def. ld/testsuite/ PR ld/17975 * ld-i386/tlsbin-nacl.rd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbindesc-nacl.rd: Likewise. * ld-i386/tlsbindesc.rd: Likewise. * ld-i386/tlsdesc-nacl.rd: Likewise. * ld-i386/tlsdesc.rd: Likewise. * ld-i386/tlsnopic-nacl.rd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlspic-nacl.rd: Likewise. * ld-i386/tlspic.rd: Likewise. * ld-x86-64/tlsbin-nacl.rd: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-x86-64/tlsbindesc-nacl.rd: Likewise. * ld-x86-64/tlsbindesc.rd: Likewise. * ld-x86-64/tlsdesc-nacl.rd: Likewise. * ld-x86-64/tlsdesc.rd: Likewise. * ld-x86-64/tlspic-nacl.rd: Likewise. * ld-x86-64/tlspic.rd: Likewise. --- bfd/elflink.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'bfd') diff --git a/bfd/elflink.c b/bfd/elflink.c index bf28885..541129a 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -8827,9 +8827,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) && h->root.u.def.section->output_section != NULL)) return TRUE; - if (!eoinfo->file_sym_done - && (eoinfo->second_pass ? eoinfo->flinfo->filesym_count == 1 - : eoinfo->flinfo->filesym_count > 1)) + if (!eoinfo->file_sym_done && eoinfo->flinfo->filesym_count) { /* Output a FILE symbol so that following locals are not associated with the wrong input file. */ @@ -9006,10 +9004,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) if (eoinfo->localsyms && flinfo->filesym_count == 1) { bfd_boolean second_pass_sym - = (input_sec->owner == flinfo->output_bfd - || input_sec->owner == NULL - || (input_sec->flags & SEC_LINKER_CREATED) != 0 - || (input_sec->owner->flags & BFD_LINKER_CREATED) != 0); + = h->forced_local && !h->root.linker_def; eoinfo->need_second_pass |= second_pass_sym; if (eoinfo->second_pass != second_pass_sym) -- cgit v1.1