From 8d63c93e6db16f997f4b65146ee7570ced965af1 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 23 Jan 2012 21:42:04 +0000 Subject: [PATCH] * configure.tgt (i386-*-nacl*): Match it. * config/te-nacl.h: New file. * config/tc-i386.h [TE_NACL] (ELF_TARGET_FORMAT): Define for this case. * config/tc-i386.c [TE_NACL] (i386_comment_chars, PREFIX_SEPARATOR): Use TE_GNU et al case for TE_NACL too. --- gas/ChangeLog | 8 ++++++++ gas/config/tc-i386.c | 11 ++++++----- gas/config/tc-i386.h | 6 ++++-- gas/config/te-nacl.h | 23 +++++++++++++++++++++++ gas/configure.tgt | 7 ++++--- 5 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 gas/config/te-nacl.h diff --git a/gas/ChangeLog b/gas/ChangeLog index 984e2ee..8e4c127 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2012-01-23 Roland McGrath + + * configure.tgt (i386-*-nacl*): Match it. + * config/te-nacl.h: New file. + * config/tc-i386.h [TE_NACL] (ELF_TARGET_FORMAT): Define for this case. + * config/tc-i386.c [TE_NACL] (i386_comment_chars, PREFIX_SEPARATOR): + Use TE_GNU et al case for TE_NACL too. + 2012-01-20 H.J. Lu * config/tc-i386.c (_i386_insn): Replace disp32_encoding with diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index dbac2ce..75ed56c 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -309,7 +309,8 @@ const char extra_symbol_chars[] = "*%-([" || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \ && !defined (TE_GNU) \ && !defined (TE_LINUX) \ - && !defined (TE_NETWARE) \ + && !defined (TE_NACL) \ + && !defined (TE_NETWARE) \ && !defined (TE_FreeBSD) \ && !defined (TE_DragonFly) \ && !defined (TE_NetBSD))) @@ -3337,11 +3338,11 @@ parse_insn (char *line, char *mnemonic) encoding. */ if (mnem_p - 2 == dot_p && dot_p[1] == 's') i.swap_operand = 1; - else if (mnem_p - 3 == dot_p + else if (mnem_p - 3 == dot_p && dot_p[1] == 'd' && dot_p[2] == '8') i.disp_encoding = disp_encoding_8bit; - else if (mnem_p - 4 == dot_p + else if (mnem_p - 4 == dot_p && dot_p[1] == 'd' && dot_p[2] == '3' && dot_p[3] == '2') @@ -5854,7 +5855,7 @@ build_modrm_byte (void) vex_reg = op + 1; } else - { + { /* There are only 2 operands. */ gas_assert (op < 2 && i.operands == 2); vex_reg = 1; @@ -8647,7 +8648,7 @@ show_arch (FILE *stream, int ext, int check) fprintf (stream, "%s\n", message); p = start; left = size - (start - message) - len - 2; - + gas_assert (left >= 0); p = mempcpy (p, name, len); diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 6a6b31d..688c69a 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -1,6 +1,6 @@ /* tc-i386.h -- Header file for tc-i386.c Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -61,6 +61,8 @@ extern unsigned long i386_mach (void); #define ELF_TARGET_FORMAT64 "elf64-x86-64-freebsd" #elif defined (TE_VXWORKS) #define ELF_TARGET_FORMAT "elf32-i386-vxworks" +#elif defined (TE_NACL) +#define ELF_TARGET_FORMAT "elf32-i386-nacl" #endif #ifdef TE_SOLARIS @@ -162,7 +164,7 @@ extern int tc_i386_fix_adjustable (struct fix *); /* This expression evaluates to true if the relocation is for a local object for which we still want to do the relocation at runtime. False if we are willing to perform this relocation while building - the .o file. GOTOFF and GOT32 do not need to be checked here because + the .o file. GOTOFF and GOT32 do not need to be checked here because they are not pcrel. .*/ #define TC_FORCE_RELOCATION_LOCAL(FIX) \ diff --git a/gas/config/te-nacl.h b/gas/config/te-nacl.h new file mode 100644 index 0000000..6550756 --- /dev/null +++ b/gas/config/te-nacl.h @@ -0,0 +1,23 @@ +/* Copyright 2012 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, + or (at your option) any later version. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#define TE_NACL +#define LOCAL_LABELS_FB 1 + +#include "obj-format.h" diff --git a/gas/configure.tgt b/gas/configure.tgt index 7090682..c33bb7a 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -13,7 +13,7 @@ # em emulation; identifies the config/te-* files # Optional output shell variables; these are not always set: -# arch the default architecture; sets DEFAULT_ARCH on some systems +# arch the default architecture; sets DEFAULT_ARCH on some systems # endian "big" or "little"; used on bi-endian systems cpu_type= @@ -43,8 +43,8 @@ case ${cpu} in hppa*) cpu_type=hppa ;; i[3-7]86) cpu_type=i386 arch=i386;; ia64) cpu_type=ia64 ;; - ip2k) cpu_type=ip2k endian=big ;; - iq2000) cpu_type=iq2000 endian=big ;; + ip2k) cpu_type=ip2k endian=big ;; + iq2000) cpu_type=iq2000 endian=big ;; lm32) cpu_type=lm32 ;; m32c) cpu_type=m32c endian=little ;; m32r) cpu_type=m32r endian=big ;; @@ -181,6 +181,7 @@ 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-*-netbsd0.8) fmt=aout em=386bsd ;; i386-*-netbsdpe*) fmt=coff em=pe ;; i386-*-netbsd*-gnu* | \ -- 2.7.4