Ping~ Thanks, Yufeng
On 07/02/13 19:53, Yufeng Zhang wrote:
Hi Andrew, Please find the updated patch in the attachment that addresses your comments. It now builds both ilp32 and lp64 multilibs by default, with the --with-multilib-list support remaining to provide options to turn off one of them. -mabi=ilp32 and -mabi=lp64 are now the command line options to use. The SPECs have been updated as well. Thanks, Yufeng 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. On 06/26/13 23:59, Andrew Pinski wrote:On Wed, Jun 26, 2013 at 3:33 PM, Yufeng Zhang<[email protected]> wrote:This patch adds the configuration changes to the AArch64 GCC to support: * -milp32 and -mlp64 options in the compiler and the driver * multilib of ilp32 and/or lp64 libraries * differentiation of basic types in the compiler backend The patch enables --with-multilib-list configuration option for specifying the list of library flavors to enable; the default value is "mlp64" and can be overridden by --with-abi to "milp32". It also enables --with-abi for setting the default model in the compiler. Its default value is "mlp64" unless --with-multilib-list is explicitly specified with "milp32", in which case it defaults to "milp32". In the backend, two target flags are introduced: TARGET_ILP32 and TARGET_LP64. They are set by -milp32 and -mlp64 respectively, exclusive to each other. The default setting is via the option variable aarch64_pmodel_flags, which defaults to TARGET_DEFAULT_PMODEL, which is further defined in biarchlp64.h or biarchilp32.h depending which header file is included. biarchlp64.h biarchilp32.h TARGET_DEFAULT_PMODEL OPTION_MASK_LP64 OPTION_MASK_ILP32 TARGET_PMODEL 1 2 TARGET_ILP32 and TARGET_LP64 are implicitly defined as: #define TARGET_ILP32 ((aarch64_pmodel_flags& OPTION_MASK_ILP32) != 0) #define TARGET_LP64 ((aarch64_pmodel_flags& OPTION_MASK_LP64) != 0) Note that the multilib support in the Linux toolchain is suppressed deliberately. OK for the trunk?I think you should not support --with-multilib-list at all. It should just include ilp32 multilib no matter what. Note the linux multilib has to wait until the glibc/kernel side is done. Also: +#if TARGET_BIG_ENDIAN_DEFAULT == 1 +#define EMUL_SUFFIX "b" +#else +#define EMUL_SUFFIX "" +#endif is broken when you supply the opposite endian option. Also you really should just use -mabi=ilp32 and -mabi=lp64 which reduces the number of changes needed to be done to config.gcc. You should use DRIVER_SELF_SPECS to simplify your LINKS_SPECS. Something like: #ifdef TARGET_BIG_ENDIAN_DEFAULT #define ENDIAN_SPEC "-mbig-endian" #else #define ENDIAN_SPEC "-mlittle-endian" #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 "}}" \ " %{!milp32:%{!mlp64:-mlp64}}" or rather: " %{!mabi=*: -mabi=lp64}" And then in aarch64-elf-raw.h: #ifndef LINK_SPEC #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X \ -maarch64elf%{milp32:32}%{mbig-endian:b}" #endif Or using the -mabi=* way: #ifndef LINK_SPEC #define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X \ -maarch64elf%{mabi=ilp32:32}%{mbig-endian:b}" #endif Thanks, Andrew Pinski
