aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYufeng Zhang <yufeng.zhang@arm.com>2013-07-23 12:12:53 +0000
committerYufeng Zhang <yufeng.zhang@arm.com>2013-07-23 12:12:53 +0000
commitd6a714f8856a8ed14d2b4408d39dfa33811ce385 (patch)
treeba5fed4bf9a0db1ffa9273ecb836474c8c54c143
parente603ada128ae7c2e96a5c226130c2b0fc8e18d52 (diff)
[AArch64, ILP32] 1/6 Initial support - configury changes
gcc/ * config.gcc (aarch64*-*-*): Support --with-abi. (aarch64*-*-elf): Support --with-multilib-list. (aarch64*-*-linux*): Likewise. (supported_defaults): Add abi to aarch64*-*-*. * configure.ac: Mention AArch64 for --with-multilib-list. * configure: Re-generated. * config/aarch64/biarchilp32.h: New file. * config/aarch64/biarchlp64.h: New file. * config/aarch64/aarch64-elf.h (ENDIAN_SPEC): New define. (ABI_SPEC): Ditto. (MULTILIB_DEFAULTS): Ditto. (DRIVER_SELF_SPECS): Ditto. (ASM_SPEC): Update to also substitute -mabi. * config/aarch64/aarch64-elf-raw.h (LINK_SPEC): Add linker script file whose name depends on -mabi= and -mbig-endian. * config/aarch64/aarch64.h (LONG_TYPE_SIZE): Change to depend on TARGET_ILP32. (POINTER_SIZE): New define. (POINTERS_EXTEND_UNSIGNED): Ditto. (enum aarch64_abi_type): New enumeration tag. (AARCH64_ABI_LP64, AARCH64_ABI_ILP32): New enumerators. (AARCH64_ABI_DEFAULT): Define to AARCH64_ABI_LP64 if undefined. (TARGET_ILP32): New define. * config/aarch64/aarch64.opt (mabi): New. (aarch64_abi): New. (ilp32, lp64): New values for -mabi. * config/aarch64/t-aarch64 (comma): New define. (MULTILIB_OPTIONS): Ditto. (MULTILIB_DIRNAMES): Ditto. * config/aarch64/t-aarch64-linux (MULTIARCH_DIRNAME): New define. * doc/invoke.texi: Document -mabi for AArch64. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@201164 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog34
-rw-r--r--gcc/config.gcc56
-rw-r--r--gcc/config/aarch64/aarch64-elf-raw.h3
-rw-r--r--gcc/config/aarch64/aarch64-elf.h26
-rw-r--r--gcc/config/aarch64/aarch64.h27
-rw-r--r--gcc/config/aarch64/aarch64.opt14
-rw-r--r--gcc/config/aarch64/biarchilp32.h29
-rw-r--r--gcc/config/aarch64/biarchlp64.h29
-rw-r--r--gcc/config/aarch64/t-aarch644
-rw-r--r--gcc/config/aarch64/t-aarch64-linux6
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/configure.ac2
-rw-r--r--gcc/doc/invoke.texi13
13 files changed, 238 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c35938de287..32e20902dc7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,37 @@
+2013-07-23 Yufeng Zhang <yufeng.zhang@arm.com>
+
+ * config.gcc (aarch64*-*-*): Support --with-abi.
+ (aarch64*-*-elf): Support --with-multilib-list.
+ (aarch64*-*-linux*): Likewise.
+ (supported_defaults): Add abi to aarch64*-*-*.
+ * configure.ac: Mention AArch64 for --with-multilib-list.
+ * configure: Re-generated.
+ * config/aarch64/biarchilp32.h: New file.
+ * config/aarch64/biarchlp64.h: New file.
+ * config/aarch64/aarch64-elf.h (ENDIAN_SPEC): New define.
+ (ABI_SPEC): Ditto.
+ (MULTILIB_DEFAULTS): Ditto.
+ (DRIVER_SELF_SPECS): Ditto.
+ (ASM_SPEC): Update to also substitute -mabi.
+ * config/aarch64/aarch64-elf-raw.h (LINK_SPEC): Add linker script
+ file whose name depends on -mabi= and -mbig-endian.
+ * config/aarch64/aarch64.h (LONG_TYPE_SIZE): Change to depend on
+ TARGET_ILP32.
+ (POINTER_SIZE): New define.
+ (POINTERS_EXTEND_UNSIGNED): Ditto.
+ (enum aarch64_abi_type): New enumeration tag.
+ (AARCH64_ABI_LP64, AARCH64_ABI_ILP32): New enumerators.
+ (AARCH64_ABI_DEFAULT): Define to AARCH64_ABI_LP64 if undefined.
+ (TARGET_ILP32): New define.
+ * config/aarch64/aarch64.opt (mabi): New.
+ (aarch64_abi): New.
+ (ilp32, lp64): New values for -mabi.
+ * config/aarch64/t-aarch64 (comma): New define.
+ (MULTILIB_OPTIONS): Ditto.
+ (MULTILIB_DIRNAMES): Ditto.
+ * config/aarch64/t-aarch64-linux (MULTIARCH_DIRNAME): New define.
+ * doc/invoke.texi: Document -mabi for AArch64.
+
2013-07-23 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.md: Explain asm print modifier 'r' for REG.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 94c21c04eaf..177677c8b15 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -498,6 +498,26 @@ then
fi
case ${target} in
+aarch64*-*-*)
+ case ${with_abi} in
+ "")
+ if test "x$with_multilib_list" = xilp32; then
+ tm_file="aarch64/biarchilp32.h ${tm_file}"
+ else
+ tm_file="aarch64/biarchlp64.h ${tm_file}"
+ fi
+ ;;
+ ilp32)
+ tm_file="aarch64/biarchilp32.h ${tm_file}"
+ ;;
+ lp64)
+ tm_file="aarch64/biarchlp64.h ${tm_file}"
+ ;;
+ *)
+ echo "Unknown ABI used in --with-abi=$with_abi"
+ exit 1
+ esac
+ ;;
i[34567]86-*-*)
if test "x$with_abi" != x; then
echo "This target does not support --with-abi."
@@ -828,6 +848,22 @@ aarch64*-*-elf)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
;;
esac
+ aarch64_multilibs="${with_multilib_list}"
+ if test "$aarch64_multilibs" = "default"; then
+ aarch64_multilibs="lp64,ilp32"
+ fi
+ aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
+ for aarch64_multilib in ${aarch64_multilibs}; do
+ case ${aarch64_multilib} in
+ ilp32 | lp64 )
+ TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
+ ;;
+ *)
+ echo "--with-multilib-list=${aarch64_multilib} not supported."
+ exit 1
+ esac
+ done
+ TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
;;
aarch64*-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
@@ -838,6 +874,24 @@ aarch64*-*-linux*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
;;
esac
+ aarch64_multilibs="${with_multilib_list}"
+ if test "$aarch64_multilibs" = "default"; then
+ # TODO: turn on ILP32 multilib build after its support is mature.
+ # aarch64_multilibs="lp64,ilp32"
+ aarch64_multilibs="lp64"
+ fi
+ aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
+ for aarch64_multilib in ${aarch64_multilibs}; do
+ case ${aarch64_multilib} in
+ ilp32 | lp64 )
+ TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
+ ;;
+ *)
+ echo "--with-multilib-list=${aarch64_multilib} not supported."
+ exit 1
+ esac
+ done
+ TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
;;
alpha*-*-linux*)
tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
@@ -3158,7 +3212,7 @@ fi
supported_defaults=
case "${target}" in
aarch64*-*-*)
- supported_defaults="cpu arch"
+ supported_defaults="abi cpu arch"
for which in cpu arch; do
eval "val=\$with_$which"
diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h
index 1cd0155fc63..dfaa9f4b817 100644
--- a/gcc/config/aarch64/aarch64-elf-raw.h
+++ b/gcc/config/aarch64/aarch64-elf-raw.h
@@ -26,7 +26,8 @@
#define ENDFILE_SPEC " crtend%O%s crtn%O%s"
#ifndef LINK_SPEC
-#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
+#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X \
+ -maarch64elf%{mabi=ilp32*:32}%{mbig-endian:b}"
#endif
#endif /* GCC_AARCH64_ELF_RAW_H */
diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h
index 3f3ae526a2a..4757d22473b 100644
--- a/gcc/config/aarch64/aarch64-elf.h
+++ b/gcc/config/aarch64/aarch64-elf.h
@@ -111,12 +111,36 @@
#define GLOBAL_ASM_OP "\t.global\t"
+#ifdef TARGET_BIG_ENDIAN_DEFAULT
+#define ENDIAN_SPEC "-mbig-endian"
+#else
+#define ENDIAN_SPEC "-mlittle-endian"
+#endif
+
+#if TARGET_DATA_MODEL == 1
+#define ABI_SPEC "-mabi=lp64"
+#define MULTILIB_DEFAULTS { "mabi=lp64" }
+#elif TARGET_DATA_MODEL == 2
+#define ABI_SPEC "-mabi=ilp32"
+#define MULTILIB_DEFAULTS { "mabi=ilp32" }
+#else
+#error "Unknown or undefined TARGET_DATA_MODEL!"
+#endif
+
+/* Force the default endianness and ABI flags onto the command line
+ in order to make the other specs easier to write. */
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+ " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \
+ " %{!mabi=*:" ABI_SPEC "}"
+
#ifndef ASM_SPEC
#define ASM_SPEC "\
%{mbig-endian:-EB} \
%{mlittle-endian:-EL} \
%{mcpu=*:-mcpu=%*} \
-%{march=*:-march=%*}"
+%{march=*:-march=%*} \
+%{mabi=*:-mabi=%*}"
#endif
#undef TYPE_OPERAND_FMT
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 7bdb1e2bebf..6011ab8026b 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -95,7 +95,9 @@
#define INT_TYPE_SIZE 32
-#define LONG_TYPE_SIZE 64 /* XXX This should be an option */
+#define LONG_TYPE_SIZE (TARGET_ILP32 ? 32 : 64)
+
+#define POINTER_SIZE (TARGET_ILP32 ? 32 : 64)
#define LONG_LONG_TYPE_SIZE 64
@@ -520,6 +522,18 @@ typedef struct GTY (()) machine_function
} machine_function;
#endif
+/* Which ABI to use. */
+enum aarch64_abi_type
+{
+ AARCH64_ABI_LP64 = 0,
+ AARCH64_ABI_ILP32 = 1
+};
+
+#ifndef AARCH64_ABI_DEFAULT
+#define AARCH64_ABI_DEFAULT AARCH64_ABI_LP64
+#endif
+
+#define TARGET_ILP32 (aarch64_abi & AARCH64_ABI_ILP32)
enum arm_pcs
{
@@ -694,7 +708,18 @@ do { \
#define NO_FUNCTION_CSE 1
+/* Specify the machine mode that the hardware addresses have.
+ After generation of rtl, the compiler makes no further distinction
+ between pointers and any other objects of this machine mode. */
#define Pmode DImode
+
+/* A C expression whose value is zero if pointers that need to be extended
+ from being `POINTER_SIZE' bits wide to `Pmode' are sign-extended and
+ greater then zero if they are zero-extended and less then zero if the
+ ptr_extend instruction should be used. */
+#define POINTERS_EXTEND_UNSIGNED 1
+
+/* Mode of a function address in a call instruction (for indexing purposes). */
#define FUNCTION_MODE Pmode
#define SELECT_CC_MODE(OP, X, Y) aarch64_select_cc_mode (OP, X, Y)
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 35182489d79..8ff6ca12592 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -98,3 +98,17 @@ Target RejectNegative Joined Var(aarch64_cpu_string)
mtune=
Target RejectNegative Joined Var(aarch64_tune_string)
-mtune=CPU Optimize for CPU
+
+mabi=
+Target RejectNegative Joined Enum(aarch64_abi) Var(aarch64_abi) Init(AARCH64_ABI_DEFAULT)
+-mabi=ABI Generate code that conforms to the specified ABI
+
+Enum
+Name(aarch64_abi) Type(int)
+Known AArch64 ABIs (for use with the -mabi= option):
+
+EnumValue
+Enum(aarch64_abi) String(ilp32) Value(AARCH64_ABI_ILP32)
+
+EnumValue
+Enum(aarch64_abi) String(lp64) Value(AARCH64_ABI_LP64)
diff --git a/gcc/config/aarch64/biarchilp32.h b/gcc/config/aarch64/biarchilp32.h
new file mode 100644
index 00000000000..fe13837f59c
--- /dev/null
+++ b/gcc/config/aarch64/biarchilp32.h
@@ -0,0 +1,29 @@
+/* Make configure files to produce biarch compiler defaulting to ilp32 ABI.
+ This file must be included very first, while the OS specific file later
+ to overwrite otherwise wrong defaults.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by ARM Ltd.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define AARCH64_ABI_DEFAULT AARCH64_ABI_ILP32
+#define TARGET_DATA_MODEL 2
diff --git a/gcc/config/aarch64/biarchlp64.h b/gcc/config/aarch64/biarchlp64.h
new file mode 100644
index 00000000000..86803af27dc
--- /dev/null
+++ b/gcc/config/aarch64/biarchlp64.h
@@ -0,0 +1,29 @@
+/* Make configure files to produce biarch compiler defaulting to ilp64 ABI.
+ This file must be included very first, while the OS specific file later
+ to overwrite otherwise wrong defaults.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by ARM Ltd.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define AARCH64_ABI_DEFAULT AARCH64_ABI_LP64
+#define TARGET_DATA_MODEL 1
diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64
index 4c265ebba7b..2975850dcb9 100644
--- a/gcc/config/aarch64/t-aarch64
+++ b/gcc/config/aarch64/t-aarch64
@@ -34,3 +34,7 @@ aarch64-builtins.o: $(srcdir)/config/aarch64/aarch64-builtins.c $(CONFIG_H) \
$(srcdir)/config/aarch64/aarch64-simd-builtins.def
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/aarch64/aarch64-builtins.c
+
+comma=,
+MULTILIB_OPTIONS = $(patsubst %, mabi=%, $(subst $(comma), ,$(TM_MULTILIB_CONFIG)))
+MULTILIB_DIRNAMES = $(subst $(comma), ,$(TM_MULTILIB_CONFIG))
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index a7a0a883605..ca1525e9046 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -23,3 +23,9 @@ LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+
+# Disable the multilib for linux-gnu targets for the time being; focus
+# on the baremetal targets.
+MULTILIB_OPTIONS =
+MULTILIB_DIRNAMES =
diff --git a/gcc/configure b/gcc/configure
index 8c221078102..e36a6086c44 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1664,7 +1664,7 @@ Optional Packages:
--with-specs=SPECS add SPECS to driver command-line processing
--with-pkgversion=PKG Use PKG in the version string in place of "GCC"
--with-bugurl=URL Direct users to URL to report a bug
- --with-multilib-list select multilibs (SH and x86-64 only)
+ --with-multilib-list select multilibs (AArch64, SH and x86-64 only)
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 41b64c78736..9dfd389bd98 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -839,7 +839,7 @@ esac],
[enable_languages=c])
AC_ARG_WITH(multilib-list,
-[AS_HELP_STRING([--with-multilib-list], [select multilibs (SH and x86-64 only)])],
+[AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
:,
with_multilib_list=default)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 31553bea64e..3df4662b7f8 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -470,7 +470,7 @@ Objective-C and Objective-C++ Dialects}.
@c so users have a clue at guessing where the ones they want will be.
@emph{AArch64 Options}
-@gccoptlist{-mbig-endian -mlittle-endian @gol
+@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
-mgeneral-regs-only @gol
-mcmodel=tiny -mcmodel=small -mcmodel=large @gol
-mstrict-align @gol
@@ -10972,6 +10972,17 @@ These options are defined for AArch64 implementations:
@table @gcctabopt
+@item -mabi=@var{name}
+@opindex mabi
+Generate code for the specified data model. Permissible values
+are @samp{ilp32} for SysV-like data model where int, long int and pointer
+are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
+but long int and pointer are 64-bit.
+
+The default depends on the specific target configuration. Note that
+the LP64 and ILP32 ABIs are not link-compatible; you must compile your
+entire program with the same ABI, and link with a compatible set of libraries.
+
@item -mbig-endian
@opindex mbig-endian
Generate big-endian code. This is the default when GCC is configured for an