On Wed, Jun 26, 2013 at 3:33 PM, Yufeng Zhang <yufeng.zh...@arm.com> 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


>
> 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 (SPEC_LP64): New define.
>         (SPEC_ILP32): Ditto.
>         (ASM_SPEC): Update to SPEC_LP64 and SPEC_ILP32.
>         (MULTILIB_DEFAULTS): New define.
>         * config/aarch64/aarch64-elf-raw.h (EMUL_SUFFIX): New define.
>         (LINK_SPEC): Change to depend on SPEC_LP64 and SPEC_ILP32 and also
>         to use EMUL_SUFFIX.
>         * config/aarch64/aarch64.h (LONG_TYPE_SIZE): Change to depend on
>         TARGET_ILP32.
>         (POINTER_SIZE): New define.
>         (POINTERS_EXTEND_UNSIGNED): Ditto.
>         * config/aarch64/aarch64.c (initialize_aarch64_programming_model):
>         New declaration and definition.
>         (aarch64_override_options): Call the new function.
>         * config/aarch64/aarch64.opt (aarch64_pmodel_flags): New.
>         (milp32, mlp64): New.
>         * config/aarch64/t-aarch64 (comma): New define.
>         (MULTILIB_OPTIONS): Ditto.
>         (MULTILIB_DIRNAMES): Ditto.
>         * config/aarch64/t-aarch64-linux (MULTIARCH_DIRNAME): New define.
>

Reply via email to