aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/m68hc1xelf.em
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl/m68hc1xelf.em')
-rw-r--r--ld/emultempl/m68hc1xelf.em38
1 files changed, 25 insertions, 13 deletions
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index bfe88d6..f7337da 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -66,6 +66,9 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
gld${EMULATION_NAME}_before_allocation ();
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
+ return;
+
/* If generating a relocatable output file, then we don't
have to generate the trampolines. */
if (bfd_link_relocatable (&link_info))
@@ -141,6 +144,12 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
static void
m68hc11elf_create_output_section_statements (void)
{
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
+ {
+ einfo ("%X%P: changing output format whilst linking is not supported\n");
+ return;
+ }
+
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
@@ -286,22 +295,25 @@ m68hc11elf_add_stub_section (const char *stub_sec_name,
static void
m68hc11elf_after_allocation (void)
{
- /* Now build the linker stubs. */
- if (stub_file->the_bfd->sections != NULL)
+ if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour)
{
- /* Call again the trampoline analyzer to initialize the trampoline
- stubs with the correct symbol addresses. Since there could have
- been relaxation, the symbol addresses that were found during
- first call may no longer be correct. */
- if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
- stub_file->the_bfd,
- &link_info, 0))
+ /* Now build the linker stubs. */
+ if (stub_file->the_bfd->sections != NULL)
{
- einfo ("%X%P: can not size stub section: %E\n");
- return;
+ /* Call again the trampoline analyzer to initialize the trampoline
+ stubs with the correct symbol addresses. Since there could have
+ been relaxation, the symbol addresses that were found during
+ first call may no longer be correct. */
+ if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
+ stub_file->the_bfd,
+ &link_info, 0))
+ {
+ einfo ("%X%P: can not size stub section: %E\n");
+ return;
+ }
+ if (!elf32_m68hc11_build_stubs (link_info.output_bfd, &link_info))
+ einfo ("%X%P: can not build stubs: %E\n");
}
- if (!elf32_m68hc11_build_stubs (link_info.output_bfd, &link_info))
- einfo ("%X%P: can not build stubs: %E\n");
}
gld${EMULATION_NAME}_after_allocation ();