summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2009-04-08 16:04:50 +0000
committerH.J. Lu <hjl.tools@gmail.com>2009-04-08 16:04:50 +0000
commita0c402a5641d9229b552066d526190252b0ee968 (patch)
treee2d2a23e62ddb2914cab9349e07ef2f0b52ea700 /bfd
parent143260c9bf2058b768d4d04cd4518054104dafd4 (diff)
downloadbinutils-gdb-a0c402a5641d9229b552066d526190252b0ee968.tar.gz
bfd/
2009-04-08 H.J. Lu <hongjiu.lu@intel.com> * elflink.c (elf_link_add_object_symbols): Warn alternate ELF machine code. include/ 2009-04-08 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_link_info): Add warn_alternate_em. ld/ 2009-04-08 H.J. Lu <hongjiu.lu@intel.com> * lexsup.c (option_values): Add OPTION_WARN_ALTERNATE_EM. (ld_options): Likewise. (parse_args): Likewise. * ld.texinfo: Document --warn-alternate-em. * NEWS: Mention --warn-alternate-em.
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 b0a62b4be5c..679211b1b87 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 b699b922f6d..3f70d915fc9 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