#define ELF_TARGET_ID I386_ELF_DATA
#define ELF_MACHINE_CODE EM_386
#define ELF_MAXPAGESIZE 0x1000
+#define ELF_OSABI ELFOSABI_GNU
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
#undef ELF_TARGET_OS
#define ELF_TARGET_OS is_solaris
-/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE
- objects won't be recognized. */
#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_SOLARIS
#undef ELF_OSABI_EXACT
#undef elf32_bed
#undef ELF_TARGET_OS
#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_GNU
#undef ELF_OSABI_EXACT
#undef elf32_bed
#define ELF_TARGET_ID SPARC_ELF_DATA
#define ELF_MACHINE_CODE EM_SPARC
#define ELF_MACHINE_ALT1 EM_SPARC32PLUS
+#define ELF_OSABI ELFOSABI_GNU
#define ELF_MAXPAGESIZE 0x10000
#define ELF_COMMONPAGESIZE 0x2000
#undef ELF_TARGET_OS
#define ELF_TARGET_OS is_solaris
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_SOLARIS
+#undef ELF_OSABI_EXACT
#undef elf32_bed
#define elf32_bed elf32_sparc_sol2_bed
#undef ELF_TARGET_OS
#define ELF_TARGET_OS is_vxworks
+#undef ELF_OSABI
+#undef ELF_OSABI_EXACT
#undef elf_backend_want_got_plt
#define elf_backend_want_got_plt 1
#define TARGET_BIG_NAME "elf64-sparc"
#define ELF_ARCH bfd_arch_sparc
#define ELF_TARGET_ID SPARC_ELF_DATA
+#define ELF_OSABI ELFOSABI_GNU
#define ELF_MAXPAGESIZE 0x100000
#define ELF_COMMONPAGESIZE 0x2000
#undef ELF_TARGET_OS
#define ELF_TARGET_OS is_solaris
-
-/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE
- objects won't be recognized. */
#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_SOLARIS
#undef ELF_OSABI_EXACT
#undef elf64_bed
#define ELF_ARCH bfd_arch_i386
#define ELF_TARGET_ID X86_64_ELF_DATA
#define ELF_MACHINE_CODE EM_X86_64
+#define ELF_OSABI ELFOSABI_GNU
#define ELF_MAXPAGESIZE 0x1000
#define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE
#undef ELF_TARGET_OS
#define ELF_TARGET_OS is_solaris
-/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE
- objects won't be recognized. */
#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_SOLARIS
#undef ELF_OSABI_EXACT
#undef elf64_bed
#undef ELF_TARGET_OS
#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_GNU
#undef ELF_OSABI_EXACT
#define bfd_elf32_bfd_copy_private_section_data \
#include "bfd.h"
#include "libbfd.h"
#include "plugin.h"
+#include "elf-bfd.h"
/* IMPORT from targets.c. */
extern const size_t _bfd_target_vector_entries;
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (cleanup)
{
- int match_priority = abfd->xvec->match_priority;
-
if (abfd->format != bfd_archive
|| (bfd_has_map (abfd)
&& bfd_get_error () != bfd_error_wrong_object_format))
matching_vector[match_count] = abfd->xvec;
match_count++;
+ int match_priority = abfd->xvec->match_priority;
+ if (match_priority == 1
+ && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ {
+ /* If the object e_ident matches the hint elf_osabi,
+ bump priority up. */
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+ elf_backend_data *bed = get_elf_backend_data (abfd);
+ if (bed->elf_osabi != ELFOSABI_NONE
+ && i_ehdrp->e_ident[EI_OSABI] == bed->elf_osabi)
+ match_priority = 0;
+ }
if (match_priority < best_match)
{
best_match = match_priority;
# PR 22967
# Test nm --ifunc-chars on a indirect symbols.
- # The following targets are known to not support ifuncs.
- setup_xfail "alpha*-*-*"
- setup_xfail "arm*-elf" "arm*-*-nto*" "arm*-*-netbsd*"
- setup_xfail "*-*-hpux*"
- setup_xfail "mips*-*-*" "tx39*-*-*"
- setup_xfail "msp430*-*-*"
- setup_xfail "kvx*-*-*"
- setup_xfail "visium*-*-*"
-
set testname "nm --ifunc-chars"
- if {![binutils_assemble $srcdir/$subdir/ifunc.s tmpdir/ifunc.o]} then {
+ if { ![supports_gnu_osabi] \
+ || [istarget "alpha*-*-*"] \
+ || [istarget "kvx-*-*"] \
+ || [istarget "mips*-*-*"] } {
+ unsupported $testname
+ } elseif { ![binutils_assemble $srcdir/$subdir/ifunc.s tmpdir/ifunc.o] } {
fail "$testname (assembly)"
} else {
if [is_remote host] {
#name: mbind sections without SHF_ALLOC
#error_output: section13.l
-#xfail: msp430-*-* visium-*-*
-#xfail: *-*-hpux*
+#target: [supports_gnu_osabi]