* [Patch][Aarch64] Fix aarch64 libatomic build with older binutils
@ 2017-12-07 23:57 Steve Ellcey
2017-12-14 17:39 ` James Greenhalgh
0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey @ 2017-12-07 23:57 UTC (permalink / raw)
To: gcc-patches, james.greenhalgh, Szabolcs Nagy, nd
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
James,
Here is a patch that will turn off the use of IFUNC and the LSE
instructions in libatomic if the compiler/assembler toolchain do not
understand the '-march=armv8-a+lse' option (changed from
-march=armv8.1-a). Â Rather than check the assembler directly, I used
the existing ACX_PROG_CC_WARNING_OPTS macro to test this.  This will
cause the GCC being built to send the option in question to the
assembler and if the assembler complains that is enough to cause us to
not set enable_aarch64_lse, and thus not set try_ifunc.
Steve Ellcey
sellcey@cavium.com
2017-12-07  Steve Ellcey  <sellcey@cavium.com>
* Makefile.am (IFUNC_OPTIONS): Change aarch64
option from -march=armv8.1-a to -march=armv8-a+lse.
* configure.ac (*aarch64*): Check to see if
compiler understands -march=armv8-a+lse option.
* configure.tgt (*aarch64*): Only set try_ifunc
if compiler understands -march=armv8-a+lse option.
* Makefile.in: Regenerate.
* configure: Regenerate.
* aclocal.m4: Regenerate.
[-- Attachment #2: gcc-libatomic-aarch64.patch --]
[-- Type: text/x-patch, Size: 1438 bytes --]
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index ec36c8e..21fd1be 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -123,7 +123,7 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
## On a target-specific basis, include alternates to be selected by IFUNC.
if HAVE_IFUNC
if ARCH_AARCH64_LINUX
-IFUNC_OPTIONS = -march=armv8.1-a
+IFUNC_OPTIONS = -march=armv8-a+lse
libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
endif
if ARCH_ARM_LINUX
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 6b11f21..cee0198 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -157,6 +157,12 @@ AC_MSG_CHECKING([for thread model used by GCC])
target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
AC_MSG_RESULT([$target_thread_file])
+case "$target" in
+ *aarch64*)
+ ACX_PROG_CC_WARNING_OPTS([-march=armv8-a+lse],[enable_aarch64_lse])
+ ;;
+esac
+
# Get target configury.
. ${srcdir}/configure.tgt
if test -n "$UNSUPPORTED"; then
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 388ae95..2f3bcc9 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -44,7 +44,9 @@ case "${target_cpu}" in
ARCH=aarch64
case "${target}" in
aarch64*-*-linux*)
- try_ifunc=yes
+ if test -n "$enable_aarch64_lse"; then
+ try_ifunc=yes
+ fi
;;
esac
;;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch][Aarch64] Fix aarch64 libatomic build with older binutils
2017-12-07 23:57 [Patch][Aarch64] Fix aarch64 libatomic build with older binutils Steve Ellcey
@ 2017-12-14 17:39 ` James Greenhalgh
0 siblings, 0 replies; 2+ messages in thread
From: James Greenhalgh @ 2017-12-14 17:39 UTC (permalink / raw)
To: Steve Ellcey; +Cc: gcc-patches, Szabolcs Nagy, nd
On Thu, Dec 07, 2017 at 11:56:55PM +0000, Steve Ellcey wrote:
> James,
>
> Here is a patch that will turn off the use of IFUNC and the LSE
> instructions in libatomic if the compiler/assembler toolchain do not
> understand the '-march=armv8-a+lse' option (changed from
> -march=armv8.1-a). Â Rather than check the assembler directly, I used
> the existing ACX_PROG_CC_WARNING_OPTS macro to test this.  This will
> cause the GCC being built to send the option in question to the
> assembler and if the assembler complains that is enough to cause us to
> not set enable_aarch64_lse, and thus not set try_ifunc.
Thanks for the fix.
OK,
James
>
> Steve Ellcey
> sellcey@cavium.com
>
>
> 2017-12-07  Steve Ellcey  <sellcey@cavium.com>
>
> * Makefile.am (IFUNC_OPTIONS): Change aarch64
> option from -march=armv8.1-a to -march=armv8-a+lse.
> * configure.ac (*aarch64*): Check to see if
> compiler understands -march=armv8-a+lse option.
> * configure.tgt (*aarch64*): Only set try_ifunc
> if compiler understands -march=armv8-a+lse option.
> * Makefile.in: Regenerate.
> * configure: Regenerate.
> * aclocal.m4: Regenerate.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-14 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 23:57 [Patch][Aarch64] Fix aarch64 libatomic build with older binutils Steve Ellcey
2017-12-14 17:39 ` James Greenhalgh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).