diff mbox series

[Aarch64] Fix aarch64 libatomic build with older binutils

Message ID 1512691015.23303.21.camel@cavium.com
State New
Headers show
Series [Aarch64] Fix aarch64 libatomic build with older binutils | expand

Commit Message

Steve Ellcey Dec. 7, 2017, 11:56 p.m. UTC
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.

Comments

James Greenhalgh Dec. 14, 2017, 5:39 p.m. UTC | #1
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.
>
diff mbox series

Patch

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