[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.

From-SVN: r201164
This commit is contained in:
Yufeng Zhang 2013-07-23 12:12:53 +00:00 committed by Yufeng Zhang
parent 9f9cbdcea6
commit 17a819cb0d
13 changed files with 238 additions and 7 deletions

View File

@ -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.

View File

@ -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"

View File

@ -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 */

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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 =

2
gcc/configure vendored
View File

@ -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

View File

@ -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)

View File

@ -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