From 8059fb196eecc90ab0dc7ecabd913690d08baee9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 16 Mar 2012 23:19:47 +0000 Subject: [PATCH] bfd/ 2012-03-16 Roland McGrath * config.bfd: Handle x86_64-*-nacl*. * elf64-x86-64.c (bfd_elf64_x86_64_nacl_vec): New backend vector stanza. (bfd_elf32_x86_64_nacl_vec): Likewise. * targets.c: Support them. * configure.in: Likewise. * configure: Regenerated. gas/ 2012-03-16 Roland McGrath * config/tc-i386.h [TE_NACL] (ELF_TARGET_FORMAT32, ELF_TARGET_FORMAT64): Define for this case. * configure.tgt (i386-*-nacl*): If ${cpu} is x86_64*, default to x32. --- bfd/ChangeLog | 9 ++ bfd/config.bfd | 6 ++ bfd/configure | 3 +- bfd/configure.in | 11 ++- bfd/elf64-x86-64.c | 222 ++++++++++++++++++++++++++++++++++++++----- bfd/targets.c | 6 +- gas/ChangeLog | 6 ++ gas/config/tc-i386.h | 2 + gas/configure.tgt | 5 +- 9 files changed, 236 insertions(+), 34 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 15819e6351..b9849f8f50 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2012-03-16 Roland McGrath + + * config.bfd: Handle x86_64-*-nacl*. + * elf64-x86-64.c (bfd_elf64_x86_64_nacl_vec): New backend vector stanza. + (bfd_elf32_x86_64_nacl_vec): Likewise. + * targets.c: Support them. + * configure.in: Likewise. + * configure: Regenerated. + 2012-03-16 Matthew Gretton-Dann * elf32-arm.c (elf32_arm_attributes_accept_div): New function. diff --git a/bfd/config.bfd b/bfd/config.bfd index 2cf89edb20..e84ba58531 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -574,6 +574,7 @@ case "${targ}" in i[3-7]86-*-nacl*) targ_defvec=bfd_elf32_i386_nacl_vec targ_selvecs="bfd_elf32_i386_vec" + targ64_selvecs="bfd_elf64_x86_64_nacl_vec bfd_elf32_x86_64_nacl_vec" ;; #ifdef BFD64 x86_64-*-darwin*) @@ -612,6 +613,11 @@ case "${targ}" in targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec" want64=true ;; + x86_64-*-nacl*) + targ_defvec=bfd_elf32_x86_64_nacl_vec + targ_selvecs="bfd_elf32_i386_nacl_vec bfd_elf64_x86_64_nacl_vec" + want64=true + ;; x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep) targ_defvec=x86_64pe_vec targ_selvecs="x86_64pe_vec x86_64pei_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec i386pe_vec i386pei_vec bfd_elf32_i386_vec" diff --git a/bfd/configure b/bfd/configure index dc2a63c8f3..cff9b265f1 100755 --- a/bfd/configure +++ b/bfd/configure @@ -15349,9 +15349,11 @@ do bfd_elf64_tradlittlemips_vec | bfd_elf64_tradlittlemips_freebsd_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf32_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo elf32.lo $elf"; target_size=64 ;; + bfd_elf32_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo elf32.lo $elf"; target_size=64 ;; bfd_elf64_l1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_l1om_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_k1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; @@ -18750,4 +18752,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/bfd/configure.in b/bfd/configure.in index d6f3fe3835..c40c825438 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -109,7 +109,7 @@ if test $want_elf_stt_common = true; then AC_DEFINE(USE_STT_COMMON, 1, [Define if we may generate symbols with ELF's STT_COMMON type]) fi - + ACX_PKGVERSION([GNU Binutils]) ACX_BUGURL([http://www.sourceware.org/bugzilla/]) @@ -684,9 +684,9 @@ do bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; - bfd_elf32_bigarm_symbian_vec) + bfd_elf32_bigarm_symbian_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; - bfd_elf32_bigarm_vxworks_vec) + bfd_elf32_bigarm_vxworks_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_bigmips_vxworks_vec) @@ -694,7 +694,7 @@ do bfd_elf32_cr16_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;; bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; - bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; + bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; @@ -848,9 +848,11 @@ do bfd_elf64_tradlittlemips_vec | bfd_elf64_tradlittlemips_freebsd_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf32_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo elf32.lo $elf"; target_size=64 ;; + bfd_elf32_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo elf32.lo $elf"; target_size=64 ;; bfd_elf64_l1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_l1om_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_k1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; @@ -1150,4 +1152,3 @@ AC_SUBST(htmldir) AC_SUBST(pdfdir) AC_OUTPUT - diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 51204a5cf8..f2f803a54b 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -982,7 +982,7 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj, && htab->elf.splt != NULL) { const struct elf_x86_64_backend_data *const abed - = get_elf_x86_64_backend_data (dynobj); + = get_elf_x86_64_backend_data (dynobj); flagword flags = get_elf_backend_data (dynobj)->dynamic_sec_flags; htab->plt_eh_frame = bfd_make_section_with_flags (dynobj, ".eh_frame", @@ -993,9 +993,9 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj, htab->plt_eh_frame->size = abed->eh_frame_plt_size; htab->plt_eh_frame->contents - = bfd_alloc (dynobj, htab->plt_eh_frame->size); + = bfd_alloc (dynobj, htab->plt_eh_frame->size); memcpy (htab->plt_eh_frame->contents, - abed->eh_frame_plt, abed->eh_frame_plt_size); + abed->eh_frame_plt, abed->eh_frame_plt_size); } return TRUE; } @@ -1075,6 +1075,14 @@ elf64_x86_64_elf_object_p (bfd *abfd) return TRUE; } +static bfd_boolean +elf32_x86_64_elf_object_p (bfd *abfd) +{ + /* Set the right machine number for an x86-64 elf32 file. */ + bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x64_32); + return TRUE; +} + /* Return TRUE if the TLS access code sequence support transition from R_TYPE. */ @@ -5087,6 +5095,179 @@ static const struct bfd_elf_special_section #include "elf64-target.h" +/* Native Client support. */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf64_x86_64_nacl_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf64-x86-64-nacl" +#undef elf64_bed +#define elf64_bed elf64_x86_64_nacl_bed + +#undef ELF_MAXPAGESIZE +#undef ELF_MINPAGESIZE +#undef ELF_COMMONPAGESIZE +#define ELF_MAXPAGESIZE 0x10000 +#define ELF_MINPAGESIZE 0x10000 +#define ELF_COMMONPAGESIZE 0x10000 + +/* Restore defaults. */ +#undef ELF_OSABI +#undef elf_backend_static_tls_alignment +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 0 + +/* NaCl uses substantially different PLT entries for the same effects. */ + +#undef elf_backend_plt_alignment +#define elf_backend_plt_alignment 5 +#define NACL_PLT_ENTRY_SIZE 64 +#define NACLMASK 0xe0 /* 32-byte alignment mask. */ + +static const bfd_byte elf_x86_64_nacl_plt0_entry[NACL_PLT_ENTRY_SIZE] = + { + 0xff, 0x35, 8, 0, 0, 0, /* pushq GOT+8(%rip) */ + 0x4c, 0x8b, 0x1d, 16, 0, 0, 0, /* mov GOT+16(%rip), %r11 */ + 0x41, 0x83, 0xe3, NACLMASK, /* and $-32, %r11d */ + 0x4d, 0x01, 0xfb, /* add %r15, %r11 */ + 0x41, 0xff, 0xe3, /* jmpq *%r11 */ + + /* 41 bytes of nop to pad out to the standard size. */ + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, /* excess data32 prefixes */ + 0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw %cs:0x0(%rax,%rax,1) */ + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, /* excess data32 prefixes */ + 0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw %cs:0x0(%rax,%rax,1) */ + 0x66, 0x66, /* excess data32 prefixes */ + 0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw %cs:0x0(%rax,%rax,1) */ + }; + +static const bfd_byte elf_x86_64_nacl_plt_entry[NACL_PLT_ENTRY_SIZE] = + { + 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, /* mov name@GOTPCREL(%rip),%r11 */ + 0x41, 0x83, 0xe3, NACLMASK, /* and $-32, %r11d */ + 0x4d, 0x01, 0xfb, /* add %r15, %r11 */ + 0x41, 0xff, 0xe3, /* jmpq *%r11 */ + + /* 15-byte nop sequence to pad out to the next 32-byte boundary. */ + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, /* excess data32 prefixes */ + 0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw %cs:0x0(%rax,%rax,1) */ + + /* Lazy GOT entries point here (32-byte aligned). */ + 0x68, /* pushq immediate */ + 0, 0, 0, 0, /* replaced with index into relocation table. */ + 0xe9, /* jmp relative */ + 0, 0, 0, 0, /* replaced with offset to start of .plt0. */ + + /* 22 bytes of nop to pad out to the standard size. */ + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, /* excess data32 prefixes */ + 0x2e, 0x0f, 0x1f, 0x84, 0, 0, 0, 0, 0, /* nopw %cs:0x0(%rax,%rax,1) */ + 0x0f, 0x1f, 0x80, 0, 0, 0, 0, /* nopl 0x0(%rax) */ + }; + +/* .eh_frame covering the .plt section. */ + +static const bfd_byte elf_x86_64_nacl_eh_frame_plt[] = + { +#if (PLT_CIE_LENGTH != 20 \ + || PLT_FDE_LENGTH != 36 \ + || PLT_FDE_START_OFFSET != 4 + PLT_CIE_LENGTH + 8 \ + || PLT_FDE_LEN_OFFSET != 4 + PLT_CIE_LENGTH + 12) +# error "Need elf_x86_64_backend_data parameters for eh_frame_plt offsets!" +#endif + PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */ + 0, 0, 0, 0, /* CIE ID */ + 1, /* CIE version */ + 'z', 'R', 0, /* Augmentation string */ + 1, /* Code alignment factor */ + 0x78, /* Data alignment factor */ + 16, /* Return address column */ + 1, /* Augmentation size */ + DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */ + DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */ + DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */ + DW_CFA_nop, DW_CFA_nop, + + PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */ + PLT_CIE_LENGTH + 8, 0, 0, 0,/* CIE pointer */ + 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */ + 0, 0, 0, 0, /* .plt size goes here */ + 0, /* Augmentation size */ + DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */ + DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */ + DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */ + DW_CFA_advance_loc + 58, /* DW_CFA_advance_loc: 58 to __PLT__+64 */ + DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */ + 13, /* Block length */ + DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */ + DW_OP_breg16, 0, /* DW_OP_breg16 (rip): 0 */ + DW_OP_const1u, 63, DW_OP_and, DW_OP_const1u, 37, DW_OP_ge, + DW_OP_lit3, DW_OP_shl, DW_OP_plus, + DW_CFA_nop, DW_CFA_nop + }; + +static const struct elf_x86_64_backend_data elf_x86_64_nacl_arch_bed = + { + elf_x86_64_nacl_plt0_entry, /* plt0_entry */ + elf_x86_64_nacl_plt_entry, /* plt_entry */ + NACL_PLT_ENTRY_SIZE, /* plt_entry_size */ + 2, /* plt0_got1_offset */ + 9, /* plt0_got2_offset */ + 13, /* plt0_got2_insn_end */ + 3, /* plt_got_offset */ + 33, /* plt_reloc_offset */ + 38, /* plt_plt_offset */ + 7, /* plt_got_insn_size */ + 42, /* plt_plt_insn_end */ + 32, /* plt_lazy_offset */ + elf_x86_64_nacl_eh_frame_plt, /* eh_frame_plt */ + sizeof (elf_x86_64_nacl_eh_frame_plt), /* eh_frame_plt_size */ + }; + +#undef elf_backend_arch_data +#define elf_backend_arch_data &elf_x86_64_nacl_arch_bed + +#include "elf64-target.h" + +/* Native Client x32 support. */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_x86_64_nacl_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-x86-64-nacl" +#undef elf32_bed +#define elf32_bed elf32_x86_64_nacl_bed + +#define bfd_elf32_bfd_link_hash_table_create \ + elf_x86_64_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + elf_x86_64_link_hash_table_free +#define bfd_elf32_bfd_reloc_type_lookup \ + elf_x86_64_reloc_type_lookup +#define bfd_elf32_bfd_reloc_name_lookup \ + elf_x86_64_reloc_name_lookup +#define bfd_elf32_mkobject \ + elf_x86_64_mkobject + +#undef elf_backend_object_p +#define elf_backend_object_p \ + elf32_x86_64_elf_object_p + +#undef elf_backend_bfd_from_remote_memory +#define elf_backend_bfd_from_remote_memory \ + _bfd_elf32_bfd_from_remote_memory + +#undef elf_backend_size_info +#define elf_backend_size_info \ + _bfd_elf32_size_info + +#include "elf32-target.h" + +/* Restore defaults. */ +#undef elf_backend_object_p +#define elf_backend_object_p elf64_x86_64_elf_object_p +#undef elf_backend_bfd_from_remote_memory +#undef elf_backend_size_info + /* Intel L1OM support. */ static bfd_boolean @@ -5115,10 +5296,17 @@ elf64_l1om_elf_object_p (bfd *abfd) #undef elf_backend_object_p #define elf_backend_object_p elf64_l1om_elf_object_p -#undef elf_backend_static_tls_alignment - -#undef elf_backend_want_plt_sym -#define elf_backend_want_plt_sym 0 +/* Restore defaults. */ +#undef ELF_MAXPAGESIZE +#undef ELF_MINPAGESIZE +#undef ELF_COMMONPAGESIZE +#define ELF_MAXPAGESIZE 0x200000 +#define ELF_MINPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 +#undef elf_backend_plt_alignment +#define elf_backend_plt_alignment 4 +#undef elf_backend_arch_data +#define elf_backend_arch_data &elf_x86_64_arch_bed #include "elf64-target.h" @@ -5189,18 +5377,11 @@ elf64_k1om_elf_object_p (bfd *abfd) /* 32bit x86-64 support. */ -static bfd_boolean -elf32_x86_64_elf_object_p (bfd *abfd) -{ - /* Set the right machine number for an x86-64 elf32 file. */ - bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x64_32); - return TRUE; -} - #undef TARGET_LITTLE_SYM #define TARGET_LITTLE_SYM bfd_elf32_x86_64_vec #undef TARGET_LITTLE_NAME #define TARGET_LITTLE_NAME "elf32-x86-64" +#undef elf32_bed #undef ELF_ARCH #define ELF_ARCH bfd_arch_i386 @@ -5208,17 +5389,6 @@ elf32_x86_64_elf_object_p (bfd *abfd) #undef ELF_MACHINE_CODE #define ELF_MACHINE_CODE EM_X86_64 -#define bfd_elf32_bfd_link_hash_table_create \ - elf_x86_64_link_hash_table_create -#define bfd_elf32_bfd_link_hash_table_free \ - elf_x86_64_link_hash_table_free -#define bfd_elf32_bfd_reloc_type_lookup \ - elf_x86_64_reloc_type_lookup -#define bfd_elf32_bfd_reloc_name_lookup \ - elf_x86_64_reloc_name_lookup -#define bfd_elf32_mkobject \ - elf_x86_64_mkobject - #undef ELF_OSABI #undef elf_backend_object_p diff --git a/bfd/targets.c b/bfd/targets.c index e5d08afef7..112ac12552 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1,6 +1,6 @@ /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Written by Cygnus Support. @@ -751,8 +751,10 @@ extern const bfd_target bfd_elf64_tradlittlemips_vec; extern const bfd_target bfd_elf64_tradbigmips_freebsd_vec; extern const bfd_target bfd_elf64_tradlittlemips_freebsd_vec; extern const bfd_target bfd_elf64_x86_64_freebsd_vec; +extern const bfd_target bfd_elf64_x86_64_nacl_vec; extern const bfd_target bfd_elf64_x86_64_sol2_vec; extern const bfd_target bfd_elf64_x86_64_vec; +extern const bfd_target bfd_elf32_x86_64_nacl_vec; extern const bfd_target bfd_elf32_x86_64_vec; extern const bfd_target bfd_elf64_l1om_freebsd_vec; extern const bfd_target bfd_elf64_l1om_vec; @@ -1123,8 +1125,10 @@ static const bfd_target * const _bfd_target_vector[] = &bfd_elf64_tradbigmips_freebsd_vec, &bfd_elf64_tradlittlemips_freebsd_vec, &bfd_elf64_x86_64_freebsd_vec, + &bfd_elf64_x86_64_nacl_vec, &bfd_elf64_x86_64_sol2_vec, &bfd_elf64_x86_64_vec, + &bfd_elf32_x86_64_nacl_vec, &bfd_elf32_x86_64_vec, &bfd_elf64_l1om_freebsd_vec, &bfd_elf64_l1om_vec, diff --git a/gas/ChangeLog b/gas/ChangeLog index 12382554f8..9209d4ded2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2012-03-16 Roland McGrath + + * config/tc-i386.h [TE_NACL] (ELF_TARGET_FORMAT32, ELF_TARGET_FORMAT64): + Define for this case. + * configure.tgt (i386-*-nacl*): If ${cpu} is x86_64*, default to x32. + 2012-03-16 Matthew Gretton-Dann * config/tc-arm.c (aeabi_set_public_attributes): Correct diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 599d0bf516..51c6cb6382 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -63,6 +63,8 @@ extern unsigned long i386_mach (void); #define ELF_TARGET_FORMAT "elf32-i386-vxworks" #elif defined (TE_NACL) #define ELF_TARGET_FORMAT "elf32-i386-nacl" +#define ELF_TARGET_FORMAT32 "elf32-x86-64-nacl" +#define ELF_TARGET_FORMAT64 "elf64-x86-64-nacl" #endif #ifdef TE_SOLARIS diff --git a/gas/configure.tgt b/gas/configure.tgt index 06fb6ca5cd..99a276fcc0 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -183,7 +183,10 @@ case ${generic_target} in i386-*-elf) fmt=elf ;; i386-*-kaos*) fmt=elf ;; i386-*-bsd*) fmt=aout em=386bsd ;; - i386-*-nacl*) fmt=elf em=nacl ;; + i386-*-nacl*) fmt=elf em=nacl + case ${cpu} in + x86_64*) arch=x86_64:32 ;; + esac ;; i386-*-netbsd0.8) fmt=aout em=386bsd ;; i386-*-netbsdpe*) fmt=coff em=pe ;; i386-*-netbsd*-gnu* | \ -- 2.34.1