aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-06-26 09:10:22 +0930
committerAlan Modra <amodra@gmail.com>2017-06-26 09:10:22 +0930
commit57963c05b9911c3555add356a7cd9952d391dfe4 (patch)
tree2a15f546eac184b349e54b5a30cd4875cda2b2ac /ld/emultempl
parentcc75e0fdaeb179efc66ddd1cb1b6da40e6adacc1 (diff)
downloadgdb-57963c05b9911c3555add356a7cd9952d391dfe4.zip
gdb-57963c05b9911c3555add356a7cd9952d391dfe4.tar.gz
gdb-57963c05b9911c3555add356a7cd9952d391dfe4.tar.bz2
Don't attach linker created section to --just-syms bfd
All sections on a --just-syms bfd are discarded from the output, so attaching linker created sections to such a bfd results in errors. In other cases, like the .note.GNU-stack check, it's wrong to have a --just-syms object potentially affect the output. bfd/ * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj a --just-syms bfd. (_bfd_elf_size_group_sections): Skip --just-syms bfds. (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and .preinit_array on --just-syms bfds. (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds. (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise. (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Skip --just-syms bfds when looking for a place to attach .note.gnu.build-id and .eh_frame_hdr sections. Delete dead code.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/elf32.em10
1 files changed, 6 insertions, 4 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 325d847..d2551b6 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1245,7 +1245,8 @@ gld${EMULATION_NAME}_after_open (void)
for (abfd = link_info.input_bfds;
abfd != (bfd *) NULL; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_count_sections (abfd) != 0)
+ && bfd_count_sections (abfd) != 0
+ && !((lang_input_statement_type *) abfd->usrdata)->flags.just_syms)
break;
/* PR 10555: If there are no ELF input files do not try to
@@ -1285,6 +1286,10 @@ gld${EMULATION_NAME}_after_open (void)
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
{
int type = 0;
+
+ if (((lang_input_statement_type *) abfd->usrdata)->flags.just_syms)
+ continue;
+
for (s = abfd->sections; s && type < COMPACT_EH_HDR; s = s->next)
{
const char *name = bfd_get_section_name (abfd, s);
@@ -1323,9 +1328,6 @@ gld${EMULATION_NAME}_after_open (void)
if (seen_type == COMPACT_EH_HDR)
link_info.eh_frame_hdr_type = COMPACT_EH_HDR;
-
- if (bfd_count_sections (abfd) == 0)
- continue;
}
if (elfbfd)
{