mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
Makefile.am (ARCH_AARCH64_LINUX): Add IFUNC_OPTIONS and libatomic_la_LIBADD.
2017-12-04 Steve Ellcey <sellcey@cavium.com> * Makefile.am (ARCH_AARCH64_LINUX): Add IFUNC_OPTIONS and libatomic_la_LIBADD. * config/linux/aarch64/host-config.h: New file. * configure.ac (IFUNC_RESOLVER_ARGS): Define. (ARCH_AARCH64_LINUX): New conditional for IFUNC builds. * configure.tgt (aarch64): Set ARCH and try_ifunc. (aarch64*-*-linux*) Update config_path. (aarch64*-*-linux*) Set IFUNC_RESOLVER_ARGS. * libatomic_i.h (GEN_SELECTOR): Add IFUNC_RESOLVER_ARGS argument. * Makefile.in: Regenerate. * auto-config.h.in: Regenerate. * configure: Regenerate. From-SVN: r255399
This commit is contained in:
parent
ad8503503f
commit
141abc6f1e
@ -1,3 +1,18 @@
|
||||
2017-12-04 Steve Ellcey <sellcey@cavium.com>
|
||||
|
||||
* Makefile.am (ARCH_AARCH64_LINUX): Add IFUNC_OPTIONS and
|
||||
libatomic_la_LIBADD.
|
||||
* config/linux/aarch64/host-config.h: New file.
|
||||
* configure.ac (IFUNC_RESOLVER_ARGS): Define.
|
||||
(ARCH_AARCH64_LINUX): New conditional for IFUNC builds.
|
||||
* configure.tgt (aarch64): Set ARCH and try_ifunc.
|
||||
(aarch64*-*-linux*) Update config_path.
|
||||
(aarch64*-*-linux*) Set IFUNC_RESOLVER_ARGS.
|
||||
* libatomic_i.h (GEN_SELECTOR): Add IFUNC_RESOLVER_ARGS argument.
|
||||
* Makefile.in: Regenerate.
|
||||
* auto-config.h.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
|
||||
2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
|
||||
|
||||
* configure.ac: Set CET_FLAGS, update XCFLAGS.
|
||||
|
@ -122,6 +122,10 @@ 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
|
||||
libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
|
||||
endif
|
||||
if ARCH_ARM_LINUX
|
||||
IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
|
||||
libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
|
||||
|
@ -52,13 +52,14 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@am__append_1 = $(foreach \
|
||||
@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@am__append_1 = $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@am__append_2 = $(foreach \
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@ s,$(SIZES),$(addsuffix \
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@ _$(s)_1_.lo,$(SIZEOBJS))) \
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@ $(addsuffix \
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@ _8_2_.lo,$(SIZEOBJS))
|
||||
@ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@am__append_2 = $(addsuffix _8_1_.lo,$(SIZEOBJS))
|
||||
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@am__append_3 = $(addsuffix _16_1_.lo,$(SIZEOBJS))
|
||||
@ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@am__append_3 = $(addsuffix _8_1_.lo,$(SIZEOBJS))
|
||||
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@am__append_4 = $(addsuffix _16_1_.lo,$(SIZEOBJS))
|
||||
subdir = .
|
||||
DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) \
|
||||
@ -346,7 +347,8 @@ all_c_files := $(foreach dir,$(search_path),$(wildcard $(dir)/*.c))
|
||||
M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
|
||||
libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
|
||||
_$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
|
||||
$(am__append_3)
|
||||
$(am__append_3) $(am__append_4)
|
||||
@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8.1-a
|
||||
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
|
||||
@ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
|
||||
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16
|
||||
|
@ -153,6 +153,9 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define ifunc resolver function argument. */
|
||||
#undef IFUNC_RESOLVER_ARGS
|
||||
|
||||
/* Define to 1 if GNU symbol versioning is used for libatomic. */
|
||||
#undef LIBAT_GNU_SYMBOL_VERSIONING
|
||||
|
||||
|
36
libatomic/config/linux/aarch64/host-config.h
Normal file
36
libatomic/config/linux/aarch64/host-config.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Atomic Library (libatomic).
|
||||
|
||||
Libatomic is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if HAVE_IFUNC
|
||||
#include <stdlib.h>
|
||||
|
||||
# ifdef HWCAP_ATOMICS
|
||||
# define IFUNC_COND_1 (hwcap & HWCAP_ATOMICS)
|
||||
# else
|
||||
# define IFUNC_COND_1 (false)
|
||||
# endif
|
||||
# define IFUNC_NCOND(N) (1)
|
||||
|
||||
#endif /* HAVE_IFUNC */
|
||||
|
||||
#include_next <host-config.h>
|
25
libatomic/configure
vendored
25
libatomic/configure
vendored
@ -608,6 +608,8 @@ ARCH_I386_FALSE
|
||||
ARCH_I386_TRUE
|
||||
ARCH_ARM_LINUX_FALSE
|
||||
ARCH_ARM_LINUX_TRUE
|
||||
ARCH_AARCH64_LINUX_FALSE
|
||||
ARCH_AARCH64_LINUX_TRUE
|
||||
HAVE_IFUNC_FALSE
|
||||
HAVE_IFUNC_TRUE
|
||||
SIZES
|
||||
@ -11118,7 +11120,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11121 "configure"
|
||||
#line 11123 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11224,7 +11226,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11227 "configure"
|
||||
#line 11229 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11526,6 +11528,13 @@ if test -n "$UNSUPPORTED"; then
|
||||
as_fn_error "Configuration ${target} is unsupported." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Write out the ifunc resolver arg type.
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define IFUNC_RESOLVER_ARGS $IFUNC_RESOLVER_ARGS
|
||||
_ACEOF
|
||||
|
||||
|
||||
# Disable fallbacks to __sync routines from libgcc. Otherwise we'll
|
||||
# make silly decisions about what the cpu can do.
|
||||
CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
|
||||
@ -15313,6 +15322,14 @@ else
|
||||
HAVE_IFUNC_FALSE=
|
||||
fi
|
||||
|
||||
if expr "$config_path" : ".* linux/aarch64 .*" > /dev/null; then
|
||||
ARCH_AARCH64_LINUX_TRUE=
|
||||
ARCH_AARCH64_LINUX_FALSE='#'
|
||||
else
|
||||
ARCH_AARCH64_LINUX_TRUE='#'
|
||||
ARCH_AARCH64_LINUX_FALSE=
|
||||
fi
|
||||
|
||||
if expr "$config_path" : ".* linux/arm .*" > /dev/null; then
|
||||
ARCH_ARM_LINUX_TRUE=
|
||||
ARCH_ARM_LINUX_FALSE='#'
|
||||
@ -15503,6 +15520,10 @@ if test -z "${HAVE_IFUNC_TRUE}" && test -z "${HAVE_IFUNC_FALSE}"; then
|
||||
as_fn_error "conditional \"HAVE_IFUNC\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ARCH_AARCH64_LINUX_TRUE}" && test -z "${ARCH_AARCH64_LINUX_FALSE}"; then
|
||||
as_fn_error "conditional \"ARCH_AARCH64_LINUX\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${ARCH_ARM_LINUX_TRUE}" && test -z "${ARCH_ARM_LINUX_FALSE}"; then
|
||||
as_fn_error "conditional \"ARCH_ARM_LINUX\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
|
@ -163,6 +163,10 @@ if test -n "$UNSUPPORTED"; then
|
||||
AC_MSG_ERROR([Configuration ${target} is unsupported.])
|
||||
fi
|
||||
|
||||
# Write out the ifunc resolver arg type.
|
||||
AC_DEFINE_UNQUOTED(IFUNC_RESOLVER_ARGS, $IFUNC_RESOLVER_ARGS,
|
||||
[Define ifunc resolver function argument.])
|
||||
|
||||
# Disable fallbacks to __sync routines from libgcc. Otherwise we'll
|
||||
# make silly decisions about what the cpu can do.
|
||||
CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
|
||||
@ -251,6 +255,8 @@ AC_SUBST(LIBS)
|
||||
AC_SUBST(SIZES)
|
||||
|
||||
AM_CONDITIONAL(HAVE_IFUNC, test x$libat_cv_have_ifunc = xyes)
|
||||
AM_CONDITIONAL(ARCH_AARCH64_LINUX,
|
||||
[expr "$config_path" : ".* linux/aarch64 .*" > /dev/null])
|
||||
AM_CONDITIONAL(ARCH_ARM_LINUX,
|
||||
[expr "$config_path" : ".* linux/arm .*" > /dev/null])
|
||||
AM_CONDITIONAL(ARCH_I386,
|
||||
|
@ -40,6 +40,14 @@ case "${target_cpu}" in
|
||||
riscv*) ARCH=riscv ;;
|
||||
sh*) ARCH=sh ;;
|
||||
|
||||
aarch64*)
|
||||
ARCH=aarch64
|
||||
case "${target}" in
|
||||
aarch64*-*-linux*)
|
||||
try_ifunc=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
arm*)
|
||||
ARCH=arm
|
||||
case "${target}" in
|
||||
@ -109,6 +117,11 @@ fi
|
||||
|
||||
# Other system configury
|
||||
case "${target}" in
|
||||
aarch64*-*-linux*)
|
||||
# OS support for atomic primitives.
|
||||
config_path="${config_path} linux/aarch64 posix"
|
||||
;;
|
||||
|
||||
arm*-*-linux*)
|
||||
# OS support for atomic primitives.
|
||||
config_path="${config_path} linux/arm posix"
|
||||
@ -153,3 +166,14 @@ case "${target}" in
|
||||
UNSUPPORTED=1
|
||||
;;
|
||||
esac
|
||||
|
||||
# glibc will pass hwcap to ifunc resolver functions as an argument.
|
||||
# The type may be different on different architectures.
|
||||
case "${target}" in
|
||||
aarch64*-*-*)
|
||||
IFUNC_RESOLVER_ARGS="uint64_t hwcap"
|
||||
;;
|
||||
*)
|
||||
IFUNC_RESOLVER_ARGS="void"
|
||||
;;
|
||||
esac
|
||||
|
@ -240,7 +240,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
|
||||
# if IFUNC_NCOND(N) == 1
|
||||
# define GEN_SELECTOR(X) \
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN; \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (void) \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (IFUNC_RESOLVER_ARGS) \
|
||||
{ \
|
||||
if (IFUNC_COND_1) \
|
||||
return C3(libat_,X,_i1); \
|
||||
@ -250,7 +250,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
|
||||
# define GEN_SELECTOR(X) \
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN; \
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i2) HIDDEN; \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (void) \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (IFUNC_RESOLVER_ARGS) \
|
||||
{ \
|
||||
if (IFUNC_COND_1) \
|
||||
return C3(libat_,X,_i1); \
|
||||
@ -263,7 +263,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN; \
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i2) HIDDEN; \
|
||||
extern typeof(C2(libat_,X)) C3(libat_,X,_i3) HIDDEN; \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (void) \
|
||||
static typeof(C2(libat_,X)) * C2(select_,X) (IFUNC_RESOLVER_ARGS) \
|
||||
{ \
|
||||
if (IFUNC_COND_1) \
|
||||
return C3(libat_,X,_i1); \
|
||||
|
Loading…
Reference in New Issue
Block a user