aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b0a62b4..679211b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (elf_link_add_object_symbols): Warn alternate ELF
+ machine code.
+
2009-04-07 DJ Delorie <dj@redhat.com>
* archures.c: Add bfd_mach_mep_c5.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b699b92..3f70d91 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3425,6 +3425,7 @@ _bfd_elf_relocs_compatible (const bfd_target *input,
static bfd_boolean
elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
+ Elf_Internal_Ehdr *ehdr;
Elf_Internal_Shdr *hdr;
bfd_size_type symcount;
bfd_size_type extsymcount;
@@ -3480,6 +3481,17 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
+ ehdr = elf_elfheader (abfd);
+ if (info->warn_alternate_em
+ && bed->elf_machine_code != ehdr->e_machine
+ && ((bed->elf_machine_alt1 != 0
+ && ehdr->e_machine == bed->elf_machine_alt1)
+ || (bed->elf_machine_alt2 != 0
+ && ehdr->e_machine == bed->elf_machine_alt2)))
+ info->callbacks->einfo
+ (_("%P: alternate ELF machine code found (%d) in %B, expecting %d\n"),
+ ehdr->e_machine, abfd, bed->elf_machine_code);
+
/* As a GNU extension, any input sections which are named
.gnu.warning.SYMBOL are treated as warning symbols for the given
symbol. This differs from .gnu.warning sections, which generate