Re: AARCH64 configure check for gas -mabi support
Hi Thomas, On Thu, 20 Jun 2019 at 20:04, Thomas Schwinge wrote: > > Hi! > > I was just building an aarch64 cross-compiler (indeed compiler only: > 'make all-gcc'), and then wanted to check something in gimplification > ('-S -fdump-tree-gimple'), with '-mabi=ilp32', which told me: "cc1: > error: assembler does not support '-mabi=ilp32'". That's unexpected, as > for '-S' GCC isn't even going to invoke the assembler. It's coming from > this change: > > On Wed, 11 Dec 2013 13:57:59 +0100, Christophe Lyon > wrote: > > Committed on Kugan's behalf as rev 205891. > > > > On 11 December 2013 13:27, Marcus Shawcroft > > wrote: > > > On 10/12/13 20:23, Kugan wrote: > > > > > >> gcc/ > > >> > > >> +2013-12-11 Kugan Vivekanandarajah > > >> + * configure.ac: Add check for aarch64 assembler -mabi support. > > >> + * configure: Regenerate. > > >> + * config.in: Regenerate. > > >> + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. > > >> + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. > > >> + * config/aarch64/aarch64.h (aarch64_override_options): Issue > > >> error if > > >> + assembler does not support -mabi and option ilp32 is selected. > > >> + * doc/install.texi: Added note that building gcc 4.9 and after > > >> with pre > > >> + 2.24 binutils will not support -mabi=ilp32. > > >> + > > >> > > > > > > Kugan, Thanks for sorting this out. OK to commit. > > > > > > /Marcus > > Specifically: > > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -5187,6 +5187,13 @@ aarch64_override_options (void) >aarch64_parse_tune (); > } > > +#ifndef HAVE_AS_MABI_OPTION > + /* The compiler may have been configured with 2.23.* binutils, which > does > + not have support for ILP32. */ > + if (TARGET_ILP32) > +error ("Assembler does not support -mabi=ilp32"); > +#endif > > Why is that necessary? Won't the assembler itself tell the user that it > "does not support -mabi=ilp32", thus this check can be removed? If not, > can a condition simply be added here to only emit this error if we're > indeed going to invoke the assembler? Current binutils will but binutils 2.23 and before didnt. Specifically, with 2.23.2, bootstrap was failing. That is why we needed this. Thanks, Kugan > > (For my own testing, I just locally disabled that, of course.) > > > Grüße > Thomas
Re: AARCH64 configure check for gas -mabi support
Hi! I was just building an aarch64 cross-compiler (indeed compiler only: 'make all-gcc'), and then wanted to check something in gimplification ('-S -fdump-tree-gimple'), with '-mabi=ilp32', which told me: "cc1: error: assembler does not support '-mabi=ilp32'". That's unexpected, as for '-S' GCC isn't even going to invoke the assembler. It's coming from this change: On Wed, 11 Dec 2013 13:57:59 +0100, Christophe Lyon wrote: > Committed on Kugan's behalf as rev 205891. > > On 11 December 2013 13:27, Marcus Shawcroft wrote: > > On 10/12/13 20:23, Kugan wrote: > > > >> gcc/ > >> > >> +2013-12-11 Kugan Vivekanandarajah > >> + * configure.ac: Add check for aarch64 assembler -mabi support. > >> + * configure: Regenerate. > >> + * config.in: Regenerate. > >> + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. > >> + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. > >> + * config/aarch64/aarch64.h (aarch64_override_options): Issue > >> error if > >> + assembler does not support -mabi and option ilp32 is selected. > >> + * doc/install.texi: Added note that building gcc 4.9 and after > >> with pre > >> + 2.24 binutils will not support -mabi=ilp32. > >> + > >> > > > > Kugan, Thanks for sorting this out. OK to commit. > > > > /Marcus Specifically: --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5187,6 +5187,13 @@ aarch64_override_options (void) aarch64_parse_tune (); } +#ifndef HAVE_AS_MABI_OPTION + /* The compiler may have been configured with 2.23.* binutils, which does + not have support for ILP32. */ + if (TARGET_ILP32) +error ("Assembler does not support -mabi=ilp32"); +#endif Why is that necessary? Won't the assembler itself tell the user that it "does not support -mabi=ilp32", thus this check can be removed? If not, can a condition simply be added here to only emit this error if we're indeed going to invoke the assembler? (For my own testing, I just locally disabled that, of course.) Grüße Thomas signature.asc Description: PGP signature
Re: AARCH64 configure check for gas -mabi support
On Mon, 30 Jun 2014, Yufeng Zhang wrote: > Looks good to me. Thanks for the fix. >> 2014-06-30 Gerald Pfeifer >> >> * doc/install.texi (Specific, aarch64*-*-*): Fix markup. Reword a bit. I also pushed this to the GCC 4.9 branch now. Gerald
Re: AARCH64 configure check for gas -mabi support
Looks good to me. Thanks for the fix. Yufeng On 06/30/14 10:44, Gerald Pfeifer wrote: I applied the small patch on top of this, mostly triggered by the markup issue. Let me know if there is anything you'd like to see differently; I am thinking to push back to GCC 4.9 as well later. Gerald 2014-06-30 Gerald Pfeifer * doc/install.texi (Specific, aarch64*-*-*): Fix markup. Reword a bit. Index: doc/install.texi === --- doc/install.texi(revision 212139) +++ doc/install.texi(working copy) @@ -3760,9 +3760,9 @@ @end html @anchor{aarch64-x-x} @heading aarch64*-*-* -Pre 2.24 binutils does not have support for selecting -mabi and does not -support ILP32. If GCC 4.9 or later is built with pre 2.24, GCC will not -support option -mabi=ilp32. +Binutils pre 2.24 does not have support for selecting @option{-mabi} and +does not support ILP32. If it is used to build GCC 4.9 or later, GCC will +not support option @option{-mabi=ilp32}. @html
Re: AARCH64 configure check for gas -mabi support
I applied the small patch on top of this, mostly triggered by the markup issue. Let me know if there is anything you'd like to see differently; I am thinking to push back to GCC 4.9 as well later. Gerald 2014-06-30 Gerald Pfeifer * doc/install.texi (Specific, aarch64*-*-*): Fix markup. Reword a bit. Index: doc/install.texi === --- doc/install.texi(revision 212139) +++ doc/install.texi(working copy) @@ -3760,9 +3760,9 @@ @end html @anchor{aarch64-x-x} @heading aarch64*-*-* -Pre 2.24 binutils does not have support for selecting -mabi and does not -support ILP32. If GCC 4.9 or later is built with pre 2.24, GCC will not -support option -mabi=ilp32. +Binutils pre 2.24 does not have support for selecting @option{-mabi} and +does not support ILP32. If it is used to build GCC 4.9 or later, GCC will +not support option @option{-mabi=ilp32}. @html
Re: AARCH64 configure check for gas -mabi support
Committed on Kugan's behalf as rev 205891. On 11 December 2013 13:27, Marcus Shawcroft wrote: > On 10/12/13 20:23, Kugan wrote: > >> gcc/ >> >> +2013-12-11 Kugan Vivekanandarajah >> + * configure.ac: Add check for aarch64 assembler -mabi support. >> + * configure: Regenerate. >> + * config.in: Regenerate. >> + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. >> + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. >> + * config/aarch64/aarch64.h (aarch64_override_options): Issue >> error if >> + assembler does not support -mabi and option ilp32 is selected. >> + * doc/install.texi: Added note that building gcc 4.9 and after >> with pre >> + 2.24 binutils will not support -mabi=ilp32. >> + >> > > Kugan, Thanks for sorting this out. OK to commit. > > /Marcus >
Re: AARCH64 configure check for gas -mabi support
On 10/12/13 20:23, Kugan wrote: gcc/ +2013-12-11 Kugan Vivekanandarajah + * configure.ac: Add check for aarch64 assembler -mabi support. + * configure: Regenerate. + * config.in: Regenerate. + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. + * config/aarch64/aarch64.h (aarch64_override_options): Issue error if + assembler does not support -mabi and option ilp32 is selected. + * doc/install.texi: Added note that building gcc 4.9 and after with pre + 2.24 binutils will not support -mabi=ilp32. + Kugan, Thanks for sorting this out. OK to commit. /Marcus
Re: AARCH64 configure check for gas -mabi support
[snip] >> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c >> index b1b4eef..a53febc 100644 >> --- a/gcc/config/aarch64/aarch64.c >> +++ b/gcc/config/aarch64/aarch64.c >> @@ -5187,6 +5187,13 @@ aarch64_override_options (void) >> aarch64_parse_tune (); >> } >> >> +/* Issue error if assembler does not support -mabi and option ilp32 >> + is selected. */ > >I'd prefer the comment to be "The compiler may have been configured >with 2.23.* binutils, which does not have support for ILP32." >> +#ifndef HAVE_AS_MABI_OPTION >> + if (TARGET_ILP32) >> +error ("Assembler does not supprt -mabi=ilp32"); >> +#endif > > supprt/support > [snip] > I'm not very sure about the indent rules for configury files, but in > other areas of configure.ac, it seems using a similar indent convention > as in .c files. > Thanks Yufeng. I have updated the patch based on the comments above. Marcus, is this OK for trunk now? Thanks, Kugan gcc/ +2013-12-11 Kugan Vivekanandarajah + * configure.ac: Add check for aarch64 assembler -mabi support. + * configure: Regenerate. + * config.in: Regenerate. + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. + * config/aarch64/aarch64.h (aarch64_override_options): Issue error if + assembler does not support -mabi and option ilp32 is selected. + * doc/install.texi: Added note that building gcc 4.9 and after with pre + 2.24 binutils will not support -mabi=ilp32. + diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index 4757d22..a66c3db 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -134,13 +134,19 @@ " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \ " %{!mabi=*:" ABI_SPEC "}" +#ifdef HAVE_AS_MABI_OPTION +#define ASM_MABI_SPEC "%{mabi=*:-mabi=%*}" +#else +#define ASM_MABI_SPEC "%{mabi=lp64:}" +#endif + #ifndef ASM_SPEC #define ASM_SPEC "\ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{mcpu=*:-mcpu=%*} \ -%{march=*:-march=%*} \ -%{mabi=*:-mabi=%*}" +%{march=*:-march=%*}" \ +ASM_MABI_SPEC #endif #undef TYPE_OPERAND_FMT diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b1b4eef..01dbe23 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5187,6 +5187,13 @@ aarch64_override_options (void) aarch64_parse_tune (); } +#ifndef HAVE_AS_MABI_OPTION + /* The compiler may have been configured with 2.23.* binutils, which does + not have support for ILP32. */ + if (TARGET_ILP32) +error ("Assembler does not support -mabi=ilp32"); +#endif + initialize_aarch64_code_model (); aarch64_build_bitmask_table (); diff --git a/gcc/configure.ac b/gcc/configure.ac index 91a22d5..0a3b97b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3495,6 +3495,35 @@ AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin, AC_MSG_RESULT($gcc_cv_lto_plugin) case "$target" in + aarch64*-*-*) +gcc_GAS_CHECK_FEATURE([-mabi option], gcc_cv_as_aarch64_mabi,, + [-mabi=lp64], [.text],,,) +if test x$gcc_cv_as_aarch64_mabi = xyes; then + AC_DEFINE(HAVE_AS_MABI_OPTION, 1, +[Define if your assembler supports the -mabi option.]) +else + if test x$with_abi = xilp32; then +AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ + Upgrade the Assembler.]) + fi + if test x"$with_multilib_list" = xdefault; then +TM_MULTILIB_CONFIG=lp64 + else +aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'` +for aarch64_multilib in ${aarch64_multilibs}; do + case ${aarch64_multilib} in +ilp32) + AC_MSG_ERROR([Assembler does not support -mabi=ilp32.\ +Upgrade the Assembler.]) + ;; +*) + ;; + esac +done + fi +fi +;; + # All TARGET_ABI_OSF targets. alpha*-*-linux* | alpha*-*-*bsd*) gcc_GAS_CHECK_FEATURE([explicit relocation support], diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index a8f9f8a..00c4f0d 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -3735,6 +3735,15 @@ removed and the system libunwind library will always be used. @html +@end html +@anchor{aarch64-x-x} +@heading aarch64*-*-* +Pre 2.24 binutils does not have support for selecting -mabi and does not +support ILP32. If GCC 4.9 or later is built with pre 2.24, GCC will not +support option -mabi=ilp32. + +@html + @end html @anchor{x-ibm-aix}
Re: AARCH64 configure check for gas -mabi support
Hi Kugan, The latest patch looks good to me; I only have a couple of minor comments inlined below. Please ask Marcus to review and approve it. Thanks again for fixing this issue! On 12/10/13 06:21, Kugan wrote: [snip] Updated it and tested with 1. binutils 2.23.2 a. bootstrapped with defaults and tested gcc for -mabi=lp64 (compiles) and -mabi=ilp32 gives error b. Trying to boottsrap with --with-multilibs-list=lp64,ilp32 fails with error msg c. Trying to bootstrap with --with-multilibs-list=ilp32 fails with error msg d. Bootstrap with --with-multilibs-list=lp64 works. 2. binutils 2.24.51 a. bootstrapped with defaults and tested gcc for -mabi=lp64 (compiles) and -mabi=ilp32 (compiles) b. Bootstrap with --with-multilibs-list=lp64,ilp32 works and tested gcc for -mabi=lp64 compiles and -mabi=ilp32 compiles(* gives linker error in my setup - aarch64:ilp32 architecture of input file `/tmp/ccIFqSxU.o' is incompatible with aarch64 output; I believe this is not related to what I am testing) c. Bootstrap with default works Thanks for the comprehensive testing. The linker error you see is because that the ILP32 support for aarch64*-*-linux* has not been added (Andrew Pinski has sent the patch series to enable the support here http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00282.html) I also test the patch by building aarch64-none-elf cross compilers with binutils 2.23.2 and mainline, with default --with-multilibs-list. It works well. [snip] diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b1b4eef..a53febc 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5187,6 +5187,13 @@ aarch64_override_options (void) aarch64_parse_tune (); } +/* Issue error if assembler does not support -mabi and option ilp32 + is selected. */ I'd prefer the comment to be "The compiler may have been configured with 2.23.* binutils, which does not have support for ILP32." +#ifndef HAVE_AS_MABI_OPTION + if (TARGET_ILP32) +error ("Assembler does not supprt -mabi=ilp32"); +#endif supprt/support + initialize_aarch64_code_model (); aarch64_build_bitmask_table (); diff --git a/gcc/configure.ac b/gcc/configure.ac index 91a22d5..a951b82 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3495,6 +3495,35 @@ AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin, AC_MSG_RESULT($gcc_cv_lto_plugin) case "$target" in + + aarch64*-*-*) +gcc_GAS_CHECK_FEATURE([-mabi option], + gcc_cv_as_aarch64_mabi,, + [-mabi=lp64], [.text],,,) +if test x$gcc_cv_as_aarch64_mabi = xyes; then + AC_DEFINE(HAVE_AS_MABI_OPTION, 1, + [Define if your assembler supports the -mabi option.]) +else + if test x$with_abi = xilp32; then + AC_MSG_ERROR([Assembler does not support -mabi=ilp32. Upgrade the Assembler.]) + fi +if test x"$with_multilib_list" = xdefault; then + TM_MULTILIB_CONFIG=lp64 +else + aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'` + for aarch64_multilib in ${aarch64_multilibs}; do + case ${aarch64_multilib} in + ilp32) + AC_MSG_ERROR([Assembler does not support -mabi=ilp32. Upgrade the Assembler.]) + ;; + *) + ;; + esac + done + fi +fi +;; + I'm not very sure about the indent rules for configury files, but in other areas of configure.ac, it seems using a similar indent convention as in .c files. Thanks, Yufeng # All TARGET_ABI_OSF targets. alpha*-*-linux* | alpha*-*-*bsd*) gcc_GAS_CHECK_FEATURE([explicit relocation support], diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index a8f9f8a..00c4f0d 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -3735,6 +3735,15 @@ removed and the system libunwind library will always be used. @html +@end html +@anchor{aarch64-x-x} +@heading aarch64*-*-* +Pre 2.24 binutils does not have support for selecting -mabi and does not +support ILP32. If GCC 4.9 or later is built with pre 2.24, GCC will not +support option -mabi=ilp32. + +@html + @end html @anchor{x-ibm-aix}
Re: AARCH64 configure check for gas -mabi support
Hi Yufeng, Thanks for the quick response. >> +#define ASM_MABI_SPEC"%{mabi=lp64*:}" > > Is '*' necessary here? Removed it. >> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c >> index b1b4eef..c1a9cbd 100644 >> --- a/gcc/config/aarch64/aarch64.c >> +++ b/gcc/config/aarch64/aarch64.c >> @@ -5186,6 +5186,10 @@ aarch64_override_options (void) >> { >> aarch64_parse_tune (); >> } >> +#ifndef HAVE_AS_MABI_OPTION >> + if (TARGET_ILP32) >> +error ("Assembler does not supprt -mabi=ilp32"); >> +#endif > > A blank line before #ifndef and some comment to explain the reason please. Blank line and comments are added. >> + aarch64*-*-*) > > Alphabetically, this should be placed before alpha*. Moved it up. > > It is not sufficient to only check with_abi itself. By default, > aarch64*-*-elf builds both ilp32 and lp64 libraries (e.g. libgcc). This > needs to be turned off if test x$gcc_cv_as_aarch64_mabi = xno. We also > need to detect the situation where users explicitly configure the > toolchain with --with-multilib-list=lp64,ilp32 > > Here is an incremental diff based on your change to gcc/configure.ac to > give an example on a more thorough check: > > diff --git a/gcc/configure.ac b/gcc/configure.ac > index c8cf274..c590ad7 100644 > --- a/gcc/configure.ac > +++ b/gcc/configure.ac > @@ -3488,12 +3488,27 @@ case "$target" in > gcc_GAS_CHECK_FEATURE([-mabi option], >gcc_cv_as_aarch64_mabi,, >[-mabi=lp64], [.text],,,) > -if test $gcc_cv_as_aarch64_mabi = yes ; then > +if test x$gcc_cv_as_aarch64_mabi = xyes ; then > AC_DEFINE(HAVE_AS_MABI_OPTION, 1, >[Define if your assembler supports the -mabi option.]) > -fi > -if test x$gcc_cv_as_aarch64_mabi = xno && test x$with_abi = xilp32; > then > -AC_MSG_ERROR([Assembler doesnot support -mabi=ilp32. Upgrade the > Assembler.]) > +else > +if test x$with_abi = xilp32; then > + AC_MSG_ERROR([Assembler does not support -mabi=ilp32. Upgrade > the Assembler.]) > +fi > +if test x"$with_multilib_list" = xdefault; then > + TM_MULTILIB_CONFIG=lp64 > +else > + aarch64_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'` > + for aarch64_multilib in ${aarch64_multilibs}; do > +case ${aarch64_multilib} in > + ilp32 ) > +AC_MSG_ERROR([Assembler does not support -mabi=ilp32. Upgrade > the Assembler.]) > +;; > + *) > +;; > +esac > + done > +fi > fi > ;; Updated it and tested with 1. binutils 2.23.2 a. bootstrapped with defaults and tested gcc for -mabi=lp64 (compiles) and -mabi=ilp32 gives error b. Trying to boottsrap with --with-multilibs-list=lp64,ilp32 fails with error msg c. Trying to bootstrap with --with-multilibs-list=ilp32 fails with error msg d. Bootstrap with --with-multilibs-list=lp64 works. 2. binutils 2.24.51 a. bootstrapped with defaults and tested gcc for -mabi=lp64 (compiles) and -mabi=ilp32 (compiles) b. Bootstrap with --with-multilibs-list=lp64,ilp32 works and tested gcc for -mabi=lp64 compiles and -mabi=ilp32 compiles(* gives linker error in my setup - aarch64:ilp32 architecture of input file `/tmp/ccIFqSxU.o' is incompatible with aarch64 output; I believe this is not related to what I am testing) c. Bootstrap with default works Thanks, kugan gcc/ +2013-12-09 Kugan Vivekanandarajah + * configure.ac: Add check for aarch64 assembler -mabi support. + * configure: Regenerate. + * config.in: Regenerate. + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. + * config/aarch64/aarch64.h (aarch64_override_options): Issue error if + assebler does not support -mabi and option ilp32 is selected. + * doc/install.texi: Added note that building gcc 4.9 and after with pre + 2.24 binutils will not support -mabi=ilp32. + diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index 4757d22..a66c3db 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -134,13 +134,19 @@ " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \ " %{!mabi=*:" ABI_SPEC "}" +#ifdef HAVE_AS_MABI_OPTION +#define ASM_MABI_SPEC "%{mabi=*:-mabi=%*}" +#else +#define ASM_MABI_SPEC "%{mabi=lp64:}" +#endif + #ifndef ASM_SPEC #define ASM_SPEC "\ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{mcpu=*:-mcpu=%*} \ -%{march=*:-march=%*} \ -%{mabi=*:-mabi=%*}" +%{march=*:-march=%*}" \ +ASM_MABI_SPEC #endif #undef TYPE_OPERAND_FMT diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b1b4eef..a53febc 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5187,6 +5187,13 @@ aarch64_override_options (void) aarch64_parse_tune (); } +/* Issue error if assembler does not support -mabi and option ilp
Re: AARCH64 configure check for gas -mabi support
Hi Kugan, Thanks for the quick action. On 12/09/13 11:20, Kugan wrote: Thanks Yufeng for the review. On 07/12/13 03:18, Yufeng Zhang wrote: >> gcc trunk aarch64 bootstrapping fails with gas version 2.23.2 (with >> error message similar to cannot compute suffix of object files) as this >> particular version does not support -mabi=lp64. It succeeds with later >> versions of gas that supports -mabi. > > The -mabi option was introduced to gas when the support for ILP32 was > added. Initially the options were named -milp32 and -mlp64: > > http://sourceware.org/ml/binutils/2013-06/msg00178.html > > and later on they were change to -mabi=ilp32 and -mabi=lp64 for > consistency with those in the aarch64 gcc: > > http://sourceware.org/ml/binutils/2013-07/msg00180.html > > The following gcc patch made the driver use the explicit option to drive > gas: > > http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00083.html > > It is a neglect of the backward compatibility with binutils 2.23. > >> >> Attached patch add checking for -mabi=lp64 and prompts upgradation. Is >> this Ok? > > I think instead of mandating the support for the -mabi option, the > compiler shall be changed able to work with binutils 2.23. The 2.23 > binutils have a good support for aarch64 and the main difference from > 2.24 is the ILP32 support. I think it is necessary to maintain the > backward compatibility, and it should be achieved by suppressing the > compiler's support for ILP32 when the -mabi option is not found > available in gas during the configuration time. > > I had a quick look at areas need to be updated: > > * multilib support > > In gcc/config.gcc, the default and the only accepted value for > --with-multilib-list and --with-abi shall be lp64 when -mabi is not > available. > > * -mabi option > > I suggest we keep the -mabi option, but reject -mabi=ilp32 in > gcc/config/aarch64/aarch64.c:aarch64_override_options () > > * driver spec > > In gcc/config/aarch64/aarch64-elf.h, the DRIVER_SELF_SPECS and ASM_SPEC > shall be updated to not pass/specify -mabi for gas. > > * documentation > > I think it needs to be mentioned in gcc/doc/install.texi the constraint > of using pre-2.24 binutils with aarch64 gcc that is 4.9 or later. > > It is a quick scouting, but hopefully it has provided provide some > guidance. If you need more help, just let me know. > > > Yufeng > > P.s. some minor comments on the attached patch. > >> >> diff --git a/gcc/configure b/gcc/configure >> index fdf0cd0..17b6e85 100755 >> --- a/gcc/configure >> +++ b/gcc/configure > > Diff result of auto-generation is usually excluded from a patch. > >> diff --git a/gcc/configure.ac b/gcc/configure.ac >> index 91a22d5..730ada0 100644 >> --- a/gcc/configure.ac >> +++ b/gcc/configure.ac >> @@ -3532,6 +3532,15 @@ case "$target" in >> [Define if your assembler supports the -no-mul-bug-abort >> option.])]) >> ;; >> >> + aarch64-*-*) > > aarch64*-*-* > >> +gcc_GAS_CHECK_FEATURE([-mabi option], >> + gcc_cv_as_aarch64_mabi,, >> + [-mabi=lp64], [.text],,,) >> +if test x$gcc_cv_as_aarch64_mabi = xno; then >> +AC_MSG_ERROR([Assembler support for -mabi=lp64 is required. >> Upgrade the Assembler.]) >> +fi >> +;; >> + >> sparc*-*-*) >> gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,, >> [.register %g2, #scratch],, >> > > Here is an attempt to do it the way you have suggested. Thanks, Kugan gcc/ +2013-12-09 Kugan Vivekanandarajah + * configure.ac: Add check for aarch64 assembler -mabi support. + * configure: Regenerate. + * config.in: Regenerate. + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. + * config/aarch64/aarch64.h (aarch64_override_options): Issue error if + Assembler does not support -mabi and option ilp32 is selected. Assembler/assembler + * doc/install.texi: Added note that building gcc 4.9 and after with pre + 2.24 binutils will not support -mabi=ilp32. + p.txt diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index 4757d22..b260b7c 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -134,13 +134,19 @@ " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \ " %{!mabi=*:" ABI_SPEC "}" +#ifdef HAVE_AS_MABI_OPTION +#define ASM_MABI_SPEC "%{mabi=*:-mabi=%*}" +#else +#define ASM_MABI_SPEC "%{mabi=lp64*:}" Is '*' necessary here? +#endif + #ifndef ASM_SPEC #define ASM_SPEC "\ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{mcpu=*:-mcpu=%*} \ -%{march=*:-march=%*} \ -%{mabi=*:-mabi=%*}" +%{march=*:-march=%*}" \ +ASM_MABI_SPEC #endif #undef TYPE_OPERAND_FMT diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b1b4eef..c1a9cbd 100644 --- a/gcc/config/aarch64/aar
Re: AARCH64 configure check for gas -mabi support
Thanks Yufeng for the review. On 07/12/13 03:18, Yufeng Zhang wrote: >> gcc trunk aarch64 bootstrapping fails with gas version 2.23.2 (with >> error message similar to cannot compute suffix of object files) as this >> particular version does not support -mabi=lp64. It succeeds with later >> versions of gas that supports -mabi. > > The -mabi option was introduced to gas when the support for ILP32 was > added. Initially the options were named -milp32 and -mlp64: > > http://sourceware.org/ml/binutils/2013-06/msg00178.html > > and later on they were change to -mabi=ilp32 and -mabi=lp64 for > consistency with those in the aarch64 gcc: > > http://sourceware.org/ml/binutils/2013-07/msg00180.html > > The following gcc patch made the driver use the explicit option to drive > gas: > > http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00083.html > > It is a neglect of the backward compatibility with binutils 2.23. > >> >> Attached patch add checking for -mabi=lp64 and prompts upgradation. Is >> this Ok? > > I think instead of mandating the support for the -mabi option, the > compiler shall be changed able to work with binutils 2.23. The 2.23 > binutils have a good support for aarch64 and the main difference from > 2.24 is the ILP32 support. I think it is necessary to maintain the > backward compatibility, and it should be achieved by suppressing the > compiler's support for ILP32 when the -mabi option is not found > available in gas during the configuration time. > > I had a quick look at areas need to be updated: > > * multilib support > > In gcc/config.gcc, the default and the only accepted value for > --with-multilib-list and --with-abi shall be lp64 when -mabi is not > available. > > * -mabi option > > I suggest we keep the -mabi option, but reject -mabi=ilp32 in > gcc/config/aarch64/aarch64.c:aarch64_override_options () > > * driver spec > > In gcc/config/aarch64/aarch64-elf.h, the DRIVER_SELF_SPECS and ASM_SPEC > shall be updated to not pass/specify -mabi for gas. > > * documentation > > I think it needs to be mentioned in gcc/doc/install.texi the constraint > of using pre-2.24 binutils with aarch64 gcc that is 4.9 or later. > > It is a quick scouting, but hopefully it has provided provide some > guidance. If you need more help, just let me know. > > > Yufeng > > P.s. some minor comments on the attached patch. > >> >> diff --git a/gcc/configure b/gcc/configure >> index fdf0cd0..17b6e85 100755 >> --- a/gcc/configure >> +++ b/gcc/configure > > Diff result of auto-generation is usually excluded from a patch. > >> diff --git a/gcc/configure.ac b/gcc/configure.ac >> index 91a22d5..730ada0 100644 >> --- a/gcc/configure.ac >> +++ b/gcc/configure.ac >> @@ -3532,6 +3532,15 @@ case "$target" in >> [Define if your assembler supports the -no-mul-bug-abort >> option.])]) >> ;; >> >> + aarch64-*-*) > > aarch64*-*-* > >> +gcc_GAS_CHECK_FEATURE([-mabi option], >> + gcc_cv_as_aarch64_mabi,, >> + [-mabi=lp64], [.text],,,) >> +if test x$gcc_cv_as_aarch64_mabi = xno; then >> +AC_MSG_ERROR([Assembler support for -mabi=lp64 is required. >> Upgrade the Assembler.]) >> +fi >> +;; >> + >> sparc*-*-*) >> gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,, >> [.register %g2, #scratch],, >> > > Here is an attempt to do it the way you have suggested. Thanks, Kugan gcc/ +2013-12-09 Kugan Vivekanandarajah + * configure.ac: Add check for aarch64 assembler -mabi support. + * configure: Regenerate. + * config.in: Regenerate. + * config/aarch64/aarch64-elf.h (ASM_MABI_SPEC): New define. + (ASM_SPEC): Update to substitute -mabi with ASM_MABI_SPEC. + * config/aarch64/aarch64.h (aarch64_override_options): Issue error if + Assembler does not support -mabi and option ilp32 is selected. + * doc/install.texi: Added note that building gcc 4.9 and after with pre + 2.24 binutils will not support -mabi=ilp32. + diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index 4757d22..b260b7c 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -134,13 +134,19 @@ " %{!mbig-endian:%{!mlittle-endian:" ENDIAN_SPEC "}}" \ " %{!mabi=*:" ABI_SPEC "}" +#ifdef HAVE_AS_MABI_OPTION +#define ASM_MABI_SPEC "%{mabi=*:-mabi=%*}" +#else +#define ASM_MABI_SPEC "%{mabi=lp64*:}" +#endif + #ifndef ASM_SPEC #define ASM_SPEC "\ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %{mcpu=*:-mcpu=%*} \ -%{march=*:-march=%*} \ -%{mabi=*:-mabi=%*}" +%{march=*:-march=%*}" \ +ASM_MABI_SPEC #endif #undef TYPE_OPERAND_FMT diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b1b4eef..c1a9cbd 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5186,6 +5186,10 @@ aarch64_override_options (void) { aarch64_parse_tune (); } +#ifndef HAVE_AS_MABI_OPTION + if (TARGET_ILP32) +e
Re: AARCH64 configure check for gas -mabi support
Hi Kugan, Thanks for working on this issue. On 12/04/13 21:03, Kugan wrote: Hi, gcc trunk aarch64 bootstrapping fails with gas version 2.23.2 (with error message similar to cannot compute suffix of object files) as this particular version does not support -mabi=lp64. It succeeds with later versions of gas that supports -mabi. The -mabi option was introduced to gas when the support for ILP32 was added. Initially the options were named -milp32 and -mlp64: http://sourceware.org/ml/binutils/2013-06/msg00178.html and later on they were change to -mabi=ilp32 and -mabi=lp64 for consistency with those in the aarch64 gcc: http://sourceware.org/ml/binutils/2013-07/msg00180.html The following gcc patch made the driver use the explicit option to drive gas: http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00083.html It is a neglect of the backward compatibility with binutils 2.23. Attached patch add checking for -mabi=lp64 and prompts upgradation. Is this Ok? I think instead of mandating the support for the -mabi option, the compiler shall be changed able to work with binutils 2.23. The 2.23 binutils have a good support for aarch64 and the main difference from 2.24 is the ILP32 support. I think it is necessary to maintain the backward compatibility, and it should be achieved by suppressing the compiler's support for ILP32 when the -mabi option is not found available in gas during the configuration time. I had a quick look at areas need to be updated: * multilib support In gcc/config.gcc, the default and the only accepted value for --with-multilib-list and --with-abi shall be lp64 when -mabi is not available. * -mabi option I suggest we keep the -mabi option, but reject -mabi=ilp32 in gcc/config/aarch64/aarch64.c:aarch64_override_options () * driver spec In gcc/config/aarch64/aarch64-elf.h, the DRIVER_SELF_SPECS and ASM_SPEC shall be updated to not pass/specify -mabi for gas. * documentation I think it needs to be mentioned in gcc/doc/install.texi the constraint of using pre-2.24 binutils with aarch64 gcc that is 4.9 or later. It is a quick scouting, but hopefully it has provided provide some guidance. If you need more help, just let me know. Yufeng P.s. some minor comments on the attached patch. diff --git a/gcc/configure b/gcc/configure index fdf0cd0..17b6e85 100755 --- a/gcc/configure +++ b/gcc/configure Diff result of auto-generation is usually excluded from a patch. diff --git a/gcc/configure.ac b/gcc/configure.ac index 91a22d5..730ada0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3532,6 +3532,15 @@ case "$target" in [Define if your assembler supports the -no-mul-bug-abort option.])]) ;; + aarch64-*-*) aarch64*-*-* +gcc_GAS_CHECK_FEATURE([-mabi option], + gcc_cv_as_aarch64_mabi,, + [-mabi=lp64], [.text],,,) +if test x$gcc_cv_as_aarch64_mabi = xno; then + AC_MSG_ERROR([Assembler support for -mabi=lp64 is required. Upgrade the Assembler.]) +fi +;; + sparc*-*-*) gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,, [.register %g2, #scratch],,
AARCH64 configure check for gas -mabi support
Hi, gcc trunk aarch64 bootstrapping fails with gas version 2.23.2 (with error message similar to cannot compute suffix of object files) as this particular version does not support -mabi=lp64. It succeeds with later versions of gas that supports -mabi. Attached patch add checking for -mabi=lp64 and prompts upgradation. Is this Ok? Thanks, Kugan +2013-12-05 Kugan Vivekanandarajah + * configure.ac: Add checks for aarch64 assembler -mabi support. + * configure: Regenerate. + diff --git a/gcc/configure b/gcc/configure index fdf0cd0..17b6e85 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24057,6 +24057,38 @@ $as_echo "#define HAVE_AS_NO_MUL_BUG_ABORT_OPTION 1" >>confdefs.h fi ;; + aarch64-*-*) +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mabi option" >&5 +$as_echo_n "checking assembler for -mabi option... " >&6; } +if test "${gcc_cv_as_aarch64_mabi+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_aarch64_mabi=no + if test x$gcc_cv_as != x; then +$as_echo '.text' > conftest.s +if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mabi=lp64 -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then + gcc_cv_as_aarch64_mabi=yes +else + echo "configure: failed program was" >&5 + cat conftest.s >&5 +fi +rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_aarch64_mabi" >&5 +$as_echo "$gcc_cv_as_aarch64_mabi" >&6; } + +if test x$gcc_cv_as_aarch64_mabi = xno; then + as_fn_error "Assembler support for -mabi=lp64 is required. Upgrade the Assembler." "$LINENO" 5 +fi +;; + sparc*-*-*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .register" >&5 $as_echo_n "checking assembler for .register... " >&6; } diff --git a/gcc/configure.ac b/gcc/configure.ac index 91a22d5..730ada0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3532,6 +3532,15 @@ case "$target" in [Define if your assembler supports the -no-mul-bug-abort option.])]) ;; + aarch64-*-*) +gcc_GAS_CHECK_FEATURE([-mabi option], + gcc_cv_as_aarch64_mabi,, + [-mabi=lp64], [.text],,,) +if test x$gcc_cv_as_aarch64_mabi = xno; then + AC_MSG_ERROR([Assembler support for -mabi=lp64 is required. Upgrade the Assembler.]) +fi +;; + sparc*-*-*) gcc_GAS_CHECK_FEATURE([.register], gcc_cv_as_sparc_register_op,,, [.register %g2, #scratch],,