This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] arm-nacl target support for BFD and GAS
- From: Roland McGrath <mcgrathr at google dot com>
- To: binutils at sourceware dot org
- Cc: David Sehr <sehr at google dot com>
- Date: Wed, 14 Mar 2012 09:59:35 -0700
- Subject: [PATCH] arm-nacl target support for BFD and GAS
This adds support for the arm-nacl target flavor to BFD and GAS.
It passes 'make -C gas check
implemented, but the BFD parts for linking are there, including PLT
generation for arm-nacl's idiosyncratic ABI. I used local hacks (not in
this patch) to get a linker built and test that a PLT comes out as
intended.
Ok for trunk?
IMHO elf32-arm.c could use some cleanup to use
for things like the PLT variants that are now done via overriding
link_hash_table_create
backend as if they were dynamically-varying details of a particular link.
But I didn't want to try to perturb the existing vxworks and symbian
backends with such cleanup right now, so I followed their model for the
new nacl backend too.
Thanks,
Roland
bfd/
2012-03-14 Roland McGrath <mcgrathr@google.com>
* elf32-arm.c (elf32_arm_nacl_plt0_entry, elf32_arm_nacl_plt_entry):
New variables.
(struct elf32_arm_link_hash_table): New member `nacl_p'.
(elf32_arm_link_hash_table_create): Initialize it.
(elf32_arm_nacl_link_hash_table_create): New function.
(arm_movw_immediate, arm_movt_immediate): New functions.
(elf32_arm_populate_plt_entry): Test HTAB->nacl_p.
(elf32_arm_finish_dynamic_sections): Likewise.
(elf32_arm_output_plt_map_1): Likewise.
(bfd_elf32_littlearm_nacl_vec, bfd_elf32_bigarm_nacl_vec):
New backend vector stanza.
* config.bfd: Handle arm-*-nacl*, armeb-*-nacl*.
* targets.c: Support bfd_elf32_{big,little}_nacl_vec.
* configure.in: Likewise.
* configure: Regenerated.
gas/
2012-03-14 Roland McGrath <mcgrathr@google.com>
* configure.tgt (arm-*-nacl*): Match it.
* config/te-nacl.h (FPU_DEFAULT, EABI_DEFAULT): Define.
(LOCAL_LABELS_DOLLAR): Define.
* config/tc-arm.c (elf32_arm_target_format) [TE_NACL]:
Use nacl format variants.
gas/testsuite/
2012-03-14 Roland McGrath <mcgrathr@google.com>
* gas/arm/arch4t-eabi.d: Match *-*-nacl* targets too.
* gas/arm/arch4t.d: Likewise.
* gas/arm/got_prel.d: Likewise.
* gas/arm/got_prel.d: Likewise.
* gas/arm/mapdir.d: Likewise.
* gas/arm/mapmisc.d: Likewise.
* gas/arm/mapsecs.d: Likewise.
* gas/arm/mapshort-eabi.d: Likewise.
* gas/arm/mapshort-elf.d: Likewise.
* gas/arm/thumb-eabi.d: Likewise.
* gas/arm/thumb.d: Likewise.
* gas/arm/thumbrel.d: Likewise.
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 2cf89ed..1ede6d8 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -216,6 +216,16 @@ case "${targ}" in
targ_selvecs=bfd_elf32_bigarc_vec
;;
+ arm-*-nacl*)
+ targ_defvec=bfd_elf32_littlearm_nacl_vec
+ targ_selvecs="bfd_elf32_i386_vec bfd_elf32_bigarm_nacl_vec bfd_elf32_littlearm_nacl_vec"
+ targ_archs="$targ_archs bfd_arm_arch bfd_i386_arch"
+ ;;
+ armeb-*-nacl*)
+ targ_defvec=bfd_elf32_bigarm_nacl_vec
+ targ_selvecs="bfd_elf32_i386_vec bfd_elf32_bigarm_nacl_vec bfd_elf32_littlearm_nacl_vec"
+ targ_archs="$targ_archs bfd_arm_arch bfd_i386_arch"
+ ;;
armeb-*-netbsdelf*)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
@@ -573,7 +583,8 @@ case "${targ}" in
;;
i[3-7]86-*-nacl*)
targ_defvec=bfd_elf32_i386_nacl_vec
- targ_selvecs="bfd_elf32_i386_vec"
+ targ_selvecs="bfd_elf32_i386_vec bfd_elf32_bigarm_nacl_vec bfd_elf32_littlearm_nacl_vec"
+ targ_archs="$targ_archs bfd_arm_arch bfd_i386_arch"
;;
#ifdef BFD64
x86_64-*-darwin*)
diff --git a/bfd/configure b/bfd/configure
index dc2a63c..6ced7e4 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15185,6 +15185,7 @@ 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_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_vxworks_vec)
@@ -15230,6 +15231,7 @@ do
bfd_elf32_littlearm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index d6f3fe3..0ebef49 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -684,6 +684,7 @@ 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_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_vxworks_vec)
@@ -729,6 +730,7 @@ do
bfd_elf32_littlearm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vxworks_vec)
tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 9231552..17be46c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -2195,6 +2195,45 @@ static const bfd_vma elf32_arm_symbian_plt_entry [] =
0x00000000, /* dcd R_ARM_GLOB_DAT(X) */
};
+/* The first entry in a procedure linkage table looks like
+ this. It is set up so that any shared library function that is
+ called before the relocation has been set up calls the dynamic
+ linker first. */
+static const bfd_vma elf32_arm_nacl_plt0_entry [] =
+ {
+ /* First bundle: */
+ 0xe300c000, /* movw ip, #:lower16:&GOT[2]-.+8 */
+ 0xe340c000, /* movt ip, #:upper16:&GOT[2]-.+8 */
+ 0xe08cc00f, /* add ip, ip, pc */
+ 0xe52dc008, /* str ip, [sp, #-8]! */
+ /* Second bundle: */
+ 0xe7dfcf1f, /* bfc ip, #30, #2 */
+ 0xe59cc000, /* ldr ip, [ip] */
+ 0xe3ccc13f, /* bic ip, ip, #0xc000000f */
+ 0xe12fff1c, /* bx ip */
+ /* Third bundle: */
+ 0xe320f000, /* nop */
+ 0xe320f000, /* nop */
+ 0xe320f000, /* nop */
+ /* .Lplt_tail: */
+ 0xe50dc004, /* str ip, [sp, #-4] */
+ /* Fourth bundle: */
+ 0xe7dfcf1f, /* bfc ip, #30, #2 */
+ 0xe59cc000, /* ldr ip, [ip] */
+ 0xe3ccc13f, /* bic ip, ip, #0xc000000f */
+ 0xe12fff1c, /* bx ip */
+ };
+#define ARM_NACL_PLT_TAIL_OFFSET (11 * 4)
+
+/* Subsequent entries in a procedure linkage table look like this. */
+static const bfd_vma elf32_arm_nacl_plt_entry [] =
+ {
+ 0xe300c000, /* movw ip, #:lower16:&GOT[n]-.+8 */
+ 0xe340c000, /* movt ip, #:upper16:&GOT[n]-.+8 */
+ 0xe08cc00f, /* add ip, ip, pc */
+ 0xea000000, /* b .Lplt_tail */
+ };
+
#define ARM_MAX_FWD_BRANCH_OFFSET ((((1 << 23) - 1) << 2) + 8)
#define ARM_MAX_BWD_BRANCH_OFFSET ((-((1 << 23) << 2)) + 8)
#define THM_MAX_FWD_BRANCH_OFFSET ((1 << 22) -2 + 4)
@@ -2878,6 +2917,9 @@ struct elf32_arm_link_hash_table
/* True if the target system is Symbian OS. */
int symbian_p;
+ /* True if the target system is Native Client. */
+ int nacl_p;
+
/* True if the target uses REL relocations. */
int use_rel;
@@ -3408,6 +3450,7 @@ elf32_arm_link_hash_table_create (bfd *abfd)
ret->use_blx = 0;
ret->vxworks_p = 0;
ret->symbian_p = 0;
+ ret->nacl_p = 0;
ret->use_rel = 1;
ret->sym_cache.abfd = NULL;
ret->obfd = abfd;
@@ -7403,6 +7446,18 @@ elf32_arm_allocate_plt_entry (struct bfd_link_info *info,
}
}
+static bfd_vma
+arm_movw_immediate (bfd_vma value)
+{
+ return (value & 0x00000fff) | ((value & 0x0000f000) << 4);
+}
+
+static bfd_vma
+arm_movt_immediate (bfd_vma value)
+{
+ return ((value & 0x0fff0000) >> 16) | ((value & 0xf0000000) >> 12);
+}
+
/* Fill in a PLT entry and its associated GOT slot. If DYNINDX == -1,
the entry lives in .iplt and resolves to (*SYM_VALUE)().
Otherwise, DYNINDX is the index of the symbol in the dynamic
@@ -7563,6 +7618,43 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
rel.r_addend = 0;
SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
}
+ else if (htab->nacl_p)
+ {
+ /* Calculate the displacement between the PLT slot and the
+ common tail that's part of the special initial PLT slot. */
+ bfd_vma tail_displacement
+ = ((splt->output_section->vma + splt->output_offset
+ + ARM_NACL_PLT_TAIL_OFFSET)
+ - (plt_address + htab->plt_entry_size + 4));
+ BFD_ASSERT ((tail_displacement & 3) == 0);
+ tail_displacement >>= 2;
+
+ BFD_ASSERT ((-tail_displacement & 0xff000000) == 0);
+
+ /* Calculate the displacement between the PLT slot and the entry
+ in the GOT. The offset accounts for the value produced by
+ adding to pc in the penultimate instruction of the PLT stub. */
+ got_displacement = got_address - (plt_address + htab->plt_entry_size);
+
+ /* NaCl does not support interworking at all. */
+ BFD_ASSERT (!elf32_arm_plt_needs_thumb_stub_p (info, arm_plt));
+
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt_entry[0]
+ | arm_movw_immediate (got_displacement),
+ ptr + 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt_entry[1]
+ | arm_movt_immediate (got_displacement),
+ ptr + 4);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt_entry[2],
+ ptr + 8);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt_entry[3]
+ | (tail_displacement & 0x00ffffff),
+ ptr + 12);
+ }
else
{
/* Calculate the displacement between the PLT slot and the
@@ -14049,6 +14141,25 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
SWAP_RELOC_OUT (htab) (output_bfd, &rel,
htab->srelplt2->contents);
}
+ else if (htab->nacl_p)
+ {
+ unsigned int i;
+
+ got_displacement = got_address + 8 - (plt_address + 16);
+
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt0_entry[0]
+ | arm_movw_immediate (got_displacement),
+ splt->contents + 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt0_entry[1]
+ | arm_movt_immediate (got_displacement),
+ splt->contents + 4);
+ for (i = 2; i < ARRAY_SIZE (elf32_arm_nacl_plt0_entry); ++i)
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_nacl_plt0_entry[i],
+ splt->contents + (i * 4));
+ }
else
{
got_displacement = got_address - (plt_address + 16);
@@ -14366,6 +14477,11 @@ elf32_arm_output_plt_map_1 (output_arch_syminfo *osi,
if (!elf32_arm_output_map_sym (osi, ARM_MAP_DATA, addr + 20))
return FALSE;
}
+ else if (htab->nacl_p)
+ {
+ if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
+ return FALSE;
+ }
else
{
bfd_boolean thumb_stub_p;
@@ -14692,6 +14808,11 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
return FALSE;
}
}
+ else if (htab->nacl_p)
+ {
+ if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+ }
else if (!htab->symbian_p)
{
if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
@@ -15461,6 +15582,57 @@ const struct elf_size_info elf32_arm_size_info =
#include "elf32-target.h"
+/* Native Client targets. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_littlearm_nacl_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-littlearm-nacl"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_bigarm_nacl_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-bigarm-nacl"
+
+/* Like elf32_arm_link_hash_table_create -- but overrides
+ appropriately for NaCl. */
+static struct bfd_link_hash_table *
+elf32_arm_nacl_link_hash_table_create (bfd *abfd)
+{
+ struct bfd_link_hash_table *ret;
+
+ ret = elf32_arm_link_hash_table_create (abfd);
+ if (ret)
+ {
+ struct elf32_arm_link_hash_table *htab
+ = (struct elf32_arm_link_hash_table *) ret;
+
+ htab->nacl_p = 1;
+
+ /* NaCl uses armv7 or above, so use_blx is always true. */
+ htab->use_blx = 1;
+
+ htab->plt_header_size = 4 * ARRAY_SIZE (elf32_arm_nacl_plt0_entry);
+ htab->plt_entry_size = 4 * ARRAY_SIZE (elf32_arm_nacl_plt_entry);
+ }
+ return ret;
+}
+
+#undef elf32_bed
+#define elf32_bed elf32_arm_nacl_bed
+#undef bfd_elf32_bfd_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create \
+ elf32_arm_nacl_link_hash_table_create
+#undef elf_backend_plt_alignment
+#define elf_backend_plt_alignment 4
+
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x10000
+
+#include "elf32-target.h"
+
+/* Reset to default. */
+#undef elf_backend_plt_alignment
+
/* VxWorks Targets. */
#undef TARGET_LITTLE_SYM
diff --git a/bfd/targets.c b/bfd/targets.c
index e5d08af..614171f 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.
@@ -596,6 +596,7 @@ extern const bfd_target bfd_elf32_bfinfdpic_vec;
extern const bfd_target bfd_elf32_big_generic_vec;
extern const bfd_target bfd_elf32_bigarc_vec;
extern const bfd_target bfd_elf32_bigarm_vec;
+extern const bfd_target bfd_elf32_bigarm_nacl_vec;
extern const bfd_target bfd_elf32_bigarm_symbian_vec;
extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
extern const bfd_target bfd_elf32_bigmips_vec;
@@ -634,6 +635,7 @@ extern const bfd_target bfd_elf32_lm32fdpic_vec;
extern const bfd_target bfd_elf32_little_generic_vec;
extern const bfd_target bfd_elf32_littlearc_vec;
extern const bfd_target bfd_elf32_littlearm_vec;
+extern const bfd_target bfd_elf32_littlearm_nacl_vec;
extern const bfd_target bfd_elf32_littlearm_symbian_vec;
extern const bfd_target bfd_elf32_littlearm_vxworks_vec;
extern const bfd_target bfd_elf32_littlemips_vec;
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index b2e0d86..98293e5 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -22231,6 +22231,10 @@ elf32_arm_target_format (void)
return (target_big_endian
? "elf32-bigarm-vxworks"
: "elf32-littlearm-vxworks");
+#elif defined (TE_NACL)
+ return (target_big_endian
+ ? "elf32-bigarm-nacl"
+ : "elf32-littlearm-nacl");
#else
if (target_big_endian)
return "elf32-bigarm";
diff --git a/gas/config/te-nacl.h b/gas/config/te-nacl.h
index 6550756..d64a44d 100644
--- a/gas/config/te-nacl.h
+++ b/gas/config/te-nacl.h
@@ -18,6 +18,13 @@
02110-1301, USA. */
#define TE_NACL
+
+#define LOCAL_LABELS_DOLLAR 1
#define LOCAL_LABELS_FB 1
+/* These are for ARM but don't hurt other CPU targets.
+ They match the settings from te-armeabi.h; NaCl/ARM is based on EABI. */
+#define FPU_DEFAULT FPU_ARCH_VFP
+#define EABI_DEFAULT EF_ARM_EABI_VER5
+
#include "obj-format.h"
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 06fb6ca..367e2b7 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -117,6 +117,7 @@ case ${generic_target} in
arm-*-linux-*) fmt=elf em=linux ;;
arm-*-uclinux*eabi*) fmt=elf em=armlinuxeabi ;;
arm-*-uclinux*) fmt=elf em=linux ;;
+ arm-*-nacl*) fmt=elf em=nacl ;;
arm-*-netbsdelf*) fmt=elf em=nbsd ;;
arm-*-*n*bsd*) fmt=aout em=nbsd ;;
arm-*-nto*) fmt=elf ;;
diff --git a/gas/testsuite/gas/arm/arch4t-eabi.d b/gas/testsuite/gas/arm/arch4t-eabi.d
index afd92f7..4289d60 100644
--- a/gas/testsuite/gas/arm/arch4t-eabi.d
+++ b/gas/testsuite/gas/arm/arch4t-eabi.d
@@ -2,7 +2,7 @@
# as: -march=armv4t
# objdump: -dr --prefix-addresses --show-raw-insn
# source: arch4t.s
-# target: *-*-*eabi *-*-symbianelf
+# target: *-*-*eabi *-*-symbianelf *-*-nacl*
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/arch4t.d b/gas/testsuite/gas/arm/arch4t.d
index 6655852..1f8c320 100644
--- a/gas/testsuite/gas/arm/arch4t.d
+++ b/gas/testsuite/gas/arm/arch4t.d
@@ -2,7 +2,7 @@
# as: -march=armv4t
# objdump: -dr --prefix-addresses --show-raw-insn
# EABI targets have their own variant.
-# not-target: *-*-*eabi *-*-symbianelf
+# not-target: *-*-*eabi *-*-symbianelf *-*-nacl*
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/got_prel.d b/gas/testsuite/gas/arm/got_prel.d
index ad74dfc..74a0bb5 100644
--- a/gas/testsuite/gas/arm/got_prel.d
+++ b/gas/testsuite/gas/arm/got_prel.d
@@ -2,7 +2,7 @@
# source: got_prel.s
# as: -march=armv5te -meabi=5
# readelf: -x 4 -r
-# target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+# target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf *-*-nacl*
Relocation section '.rel.text.foo' at offset 0x3f0 contains 1 entries:
Offset Info Type Sym.Value Sym. Name
diff --git a/gas/testsuite/gas/arm/mapdir.d b/gas/testsuite/gas/arm/mapdir.d
index 549fe94..bb37a6b 100644
--- a/gas/testsuite/gas/arm/mapdir.d
+++ b/gas/testsuite/gas/arm/mapdir.d
@@ -2,7 +2,7 @@
#objdump: --syms --special-syms -d
#name: ARM Mapping Symbols for .arm/.thumb
# This test is only valid on EABI based ports.
-#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf *-*-nacl*
#source: mapdir.s
diff --git a/gas/testsuite/gas/arm/mapmisc.d b/gas/testsuite/gas/arm/mapmisc.d
index c130b65..6196b6b 100644
--- a/gas/testsuite/gas/arm/mapmisc.d
+++ b/gas/testsuite/gas/arm/mapmisc.d
@@ -2,7 +2,7 @@
#objdump: --syms --special-syms -d
#name: ARM Mapping Symbols for miscellaneous directives
# This test is only valid on EABI based ports.
-#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf *-*-nacl*
#source: mapmisc.s
diff --git a/gas/testsuite/gas/arm/mapsecs.d b/gas/testsuite/gas/arm/mapsecs.d
index 8cd0baf..b0d0421 100644
--- a/gas/testsuite/gas/arm/mapsecs.d
+++ b/gas/testsuite/gas/arm/mapsecs.d
@@ -2,7 +2,7 @@
#objdump: --syms --special-syms -d
#name: ARM Mapping Symbols with multiple sections
# This test is only valid on EABI based ports.
-#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf *-*-nacl*
#source: mapsecs.s
diff --git a/gas/testsuite/gas/arm/mapshort-eabi.d b/gas/testsuite/gas/arm/mapshort-eabi.d
index 1f920d3..69a5a22 100644
--- a/gas/testsuite/gas/arm/mapshort-eabi.d
+++ b/gas/testsuite/gas/arm/mapshort-eabi.d
@@ -1,7 +1,7 @@
#objdump: --syms --special-syms -d
#name: ARM Mapping Symbols for .short (EABI version)
# This test is only valid on EABI based ports.
-#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf
+#target: *-*-*eabi *-*-symbianelf *-*-linux-* *-*-elf *-*-nacl*
#source: mapshort.s
# Test the generation and use of ARM ELF Mapping Symbols
diff --git a/gas/testsuite/gas/arm/mapshort-elf.d b/gas/testsuite/gas/arm/mapshort-elf.d
index 38b290e..b0b62cf 100644
--- a/gas/testsuite/gas/arm/mapshort-elf.d
+++ b/gas/testsuite/gas/arm/mapshort-elf.d
@@ -1,7 +1,7 @@
#objdump: --syms --special-syms -d
#name: ARM Mapping Symbols for .short (ELF version)
# This test is only valid on ELF based ports.
-#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* *-*-*eabi *-*-syymbianelf *-*-linux-* *-*-vxworks *-*-elf
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix* *-*-*eabi *-*-syymbianelf *-*-linux-* *-*-vxworks *-*-elf *-*-nacl*
#source: mapshort.s
# Test the generation and use of ARM ELF Mapping Symbols
diff --git a/gas/testsuite/gas/arm/thumb-eabi.d b/gas/testsuite/gas/arm/thumb-eabi.d
index 9fd77d1..602dafb 100644
--- a/gas/testsuite/gas/arm/thumb-eabi.d
+++ b/gas/testsuite/gas/arm/thumb-eabi.d
@@ -2,7 +2,7 @@
# as: -mcpu=arm7t
# objdump: -dr --prefix-addresses --show-raw-insn
# source: thumb.s
-# target: *-*-*eabi *-*-symbianelf
+# target: *-*-*eabi *-*-symbianelf *-*-nacl*
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/thumb.d b/gas/testsuite/gas/arm/thumb.d
index 6d88508..514152b 100644
--- a/gas/testsuite/gas/arm/thumb.d
+++ b/gas/testsuite/gas/arm/thumb.d
@@ -3,7 +3,7 @@
# objdump: -dr --prefix-addresses --show-raw-insn
# The arm-aout and arm-pe ports do not support Thumb branch relocations.
# EABI targets have their own variant.
-# not-target: *-*-*aout* *-*-pe *-*-*eabi *-*-symbianelf
+# not-target: *-*-*aout* *-*-pe *-*-*eabi *-*-symbianelf *-*-nacl*
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/thumbrel.d b/gas/testsuite/gas/arm/thumbrel.d
index fff41af..a87353e 100644
--- a/gas/testsuite/gas/arm/thumbrel.d
+++ b/gas/testsuite/gas/arm/thumbrel.d
@@ -1,6 +1,6 @@
#objdump: -sr
# This test is only valid on EABI based ports.
-#target: *-*-*eabi *-*-symbianelf
+#target: *-*-*eabi *-*-symbianelf *-*-nacl*
.*: file format.*