summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-08-15 06:03:11 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-08-15 06:03:11 +0000
commit15d4557fa5cc1577076b3987ff8d4273f79d71c7 (patch)
tree3ac86817f34aacbee4ae610a42c75b59560a19d6
parentfe08f5009ed8600aedf07f5b95f8830787d98744 (diff)
downloadbinutils-redhat-15d4557fa5cc1577076b3987ff8d4273f79d71c7.tar.gz
PR 4923
* emultempl/elf32.em (after_open): Return immediately when non-ELF output.
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emultempl/elf32.em65
2 files changed, 38 insertions, 33 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8c53dcf963..78295444ad 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR 4923
+ * emultempl/elf32.em (after_open): Return immediately when
+ non-ELF output.
+
2007-08-12 Daniel Jacobowitz <dan@codesourcery.com>
* configure.in (ALL_LINGUAS): Add fi.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index b82e087b44..d60d4ddeec 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1032,6 +1032,11 @@ static void
gld${EMULATION_NAME}_after_open (void)
{
struct bfd_link_needed_list *needed, *l;
+ struct elf_link_hash_table *htab;
+
+ htab = elf_hash_table (&link_info);
+ if (!is_elf_hash_table (htab))
+ return;
if (link_info.emit_note_gnu_build_id)
{
@@ -1076,46 +1081,38 @@ gld${EMULATION_NAME}_after_open (void)
}
}
+ if (link_info.relocatable)
+ return;
+
if (link_info.eh_frame_hdr
- && ! link_info.traditional_format
- && ! link_info.relocatable)
+ && !link_info.traditional_format)
{
- struct elf_link_hash_table *htab;
+ bfd *abfd;
+ asection *s;
- htab = elf_hash_table (&link_info);
- if (is_elf_hash_table (htab))
+ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
{
- bfd *abfd;
- asection *s;
-
- for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
- {
- s = bfd_get_section_by_name (abfd, ".eh_frame");
- if (s && s->size > 8 && !bfd_is_abs_section (s->output_section))
- break;
- }
- if (abfd)
- {
- const struct elf_backend_data *bed;
-
- bed = get_elf_backend_data (abfd);
- s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr",
- bed->dynamic_sec_flags
- | SEC_READONLY);
- if (s != NULL
- && bfd_set_section_alignment (abfd, s, 2))
- htab->eh_info.hdr_sec = s;
- else
- einfo ("%P: warning: Cannot create .eh_frame_hdr section,"
- " --eh-frame-hdr ignored.\n");
- }
+ s = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (s && s->size > 8 && !bfd_is_abs_section (s->output_section))
+ break;
+ }
+ if (abfd)
+ {
+ const struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (abfd);
+ s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr",
+ bed->dynamic_sec_flags
+ | SEC_READONLY);
+ if (s != NULL
+ && bfd_set_section_alignment (abfd, s, 2))
+ htab->eh_info.hdr_sec = s;
+ else
+ einfo ("%P: warning: Cannot create .eh_frame_hdr section,"
+ " --eh-frame-hdr ignored.\n");
}
}
- /* We only need to worry about this when doing a final link. */
- if (link_info.relocatable || !link_info.executable)
- return;
-
/* Get the list of files which appear in DT_NEEDED entries in
dynamic objects included in the link (often there will be none).
For each such file, we want to track down the corresponding
@@ -1125,6 +1122,8 @@ gld${EMULATION_NAME}_after_open (void)
special action by the person doing the link. Note that the
needed list can actually grow while we are stepping through this
loop. */
+ if (!link_info.executable)
+ return;
needed = bfd_elf_get_needed_list (output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{