2012-05-01 08:48:28 -07:00
|
|
|
# Process this file with autoreconf to produce a configure script.
|
2024-01-03 12:19:35 +01:00
|
|
|
# Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
2012-05-01 08:48:28 -07:00
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
AC_INIT([GNU Atomic Library], 1.0,,[libatomic])
|
|
|
|
AC_CONFIG_HEADER(auto-config.h)
|
|
|
|
|
|
|
|
# -------
|
|
|
|
# Options
|
|
|
|
# -------
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
|
|
|
|
LIBAT_ENABLE(version-specific-runtime-libs, no, ,
|
|
|
|
[Specify that runtime libraries should be installed in a compiler-specific directory],
|
|
|
|
permit yes|no)
|
|
|
|
AC_MSG_RESULT($enable_version_specific_runtime_libs)
|
|
|
|
|
|
|
|
# We would like our source tree to be readonly. However when releases or
|
|
|
|
# pre-releases are generated, the flex/bison generated files as well as the
|
|
|
|
# various formats of manuals need to be included along with the rest of the
|
|
|
|
# sources. Therefore we have --enable-generated-files-in-srcdir to do
|
|
|
|
# just that.
|
|
|
|
AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
|
|
|
|
LIBAT_ENABLE(generated-files-in-srcdir, no, ,
|
|
|
|
[put copies of generated files in source dir intended for creating source
|
|
|
|
tarballs for users without texinfo bison or flex.],
|
|
|
|
permit yes|no)
|
|
|
|
AC_MSG_RESULT($enable_generated_files_in_srcdir)
|
|
|
|
AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
|
|
|
|
|
|
|
|
|
|
|
|
# -------
|
|
|
|
|
|
|
|
# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
|
|
|
|
#
|
|
|
|
# You will slowly go insane if you do not grok the following fact: when
|
|
|
|
# building this library, the top-level /target/ becomes the library's /host/.
|
|
|
|
#
|
|
|
|
# configure then causes --target to default to --host, exactly like any
|
|
|
|
# other package using autoconf. Therefore, 'target' and 'host' will
|
|
|
|
# always be the same. This makes sense both for native and cross compilers
|
|
|
|
# just think about it for a little while. :-)
|
|
|
|
#
|
|
|
|
# Also, if this library is being configured as part of a cross compiler, the
|
|
|
|
# top-level configure script will pass the "real" host as $with_cross_host.
|
|
|
|
#
|
|
|
|
# Do not delete or change the following two lines. For why, see
|
|
|
|
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
target_alias=${target_alias-$host_alias}
|
|
|
|
|
|
|
|
# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
|
|
|
|
# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
|
|
|
|
# 1.9.0: minimum required version
|
|
|
|
# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
|
|
|
|
# of other PACKAGE_* variables will, however, and there's nothing
|
|
|
|
# we can do about that; they come from AC_INIT).
|
2012-09-20 16:41:17 +02:00
|
|
|
# no-dist: we don't want 'dist' and related rules.
|
2012-05-01 08:48:28 -07:00
|
|
|
# foreign: we don't follow the normal rules for GNU packages (no COPYING
|
|
|
|
# file in the top srcdir, etc, etc), so stop complaining.
|
|
|
|
# -Wall: turns on all automake warnings...
|
|
|
|
# -Wno-portability: ...except this one, since GNU make is required.
|
|
|
|
# -Wno-override: ... and this one, since we do want this in testsuite.
|
2012-09-20 16:41:17 +02:00
|
|
|
AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
|
2012-05-01 08:48:28 -07:00
|
|
|
AM_ENABLE_MULTILIB(, ..)
|
|
|
|
|
2020-01-24 11:24:25 +00:00
|
|
|
GCC_WITH_TOOLEXECLIBDIR
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
# Calculate toolexeclibdir
|
|
|
|
# Also toolexecdir, though it's only used in toolexeclibdir
|
|
|
|
case ${enable_version_specific_runtime_libs} in
|
|
|
|
yes)
|
|
|
|
# Need the gcc compiler version to know where to install libraries
|
|
|
|
# and header files if --enable-version-specific-runtime-libs option
|
|
|
|
# is selected.
|
|
|
|
toolexecdir='$(libdir)/gcc/$(target_alias)'
|
|
|
|
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
|
|
|
|
;;
|
|
|
|
no)
|
|
|
|
if test -n "$with_cross_host" &&
|
|
|
|
test x"$with_cross_host" != x"no"; then
|
|
|
|
# Install a library built with a cross compiler in tooldir, not libdir.
|
|
|
|
toolexecdir='$(exec_prefix)/$(target_alias)'
|
2020-01-24 11:24:25 +00:00
|
|
|
case ${with_toolexeclibdir} in
|
|
|
|
no)
|
|
|
|
toolexeclibdir='$(toolexecdir)/lib'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
toolexeclibdir=${with_toolexeclibdir}
|
|
|
|
;;
|
|
|
|
esac
|
2012-05-01 08:48:28 -07:00
|
|
|
else
|
|
|
|
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
|
|
|
|
toolexeclibdir='$(libdir)'
|
|
|
|
fi
|
|
|
|
multi_os_directory=`$CC -print-multi-os-directory`
|
|
|
|
case $multi_os_directory in
|
|
|
|
.) ;; # Avoid trailing /.
|
|
|
|
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(toolexecdir)
|
|
|
|
AC_SUBST(toolexeclibdir)
|
|
|
|
|
|
|
|
# Check the compiler.
|
|
|
|
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
|
|
|
|
# We must force CC to /not/ be precious variables; otherwise
|
|
|
|
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
|
|
|
# As a side effect, we have to subst CFLAGS ourselves.
|
|
|
|
|
|
|
|
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
|
|
|
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_AS
|
|
|
|
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
|
|
|
|
|
|
|
AC_SUBST(CFLAGS)
|
|
|
|
|
|
|
|
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
|
|
|
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
|
|
|
# in both places for now and restore CFLAGS at the end of config.
|
|
|
|
save_CFLAGS="$CFLAGS"
|
|
|
|
|
|
|
|
# Find other programs we need.
|
|
|
|
AC_CHECK_TOOL(AR, ar)
|
|
|
|
AC_CHECK_TOOL(NM, nm)
|
|
|
|
AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
|
|
|
# Configure libtool
|
|
|
|
AM_PROG_LIBTOOL
|
2014-06-17 22:43:18 +02:00
|
|
|
ACX_LT_HOST_FLAGS
|
2012-05-01 08:48:28 -07:00
|
|
|
AC_SUBST(enable_shared)
|
|
|
|
AC_SUBST(enable_static)
|
2012-05-03 09:30:11 -07:00
|
|
|
AM_MAINTAINER_MODE
|
2012-05-01 08:48:28 -07:00
|
|
|
|
2021-03-28 14:48:17 +01:00
|
|
|
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
# For libtool versioning info, format is CURRENT:REVISION:AGE
|
Add out-of-line versions of some <stdatomic.h> functions (PR c/65083).
PR c/65083 notes that some functions in <stdatomic.h> are normal
functions, not generic functions, and so need to have out-of-line
copies that can be called when macro expansion is suppressed (unlike
the generic functions where DR#419 makes it undefined if you suppress
a macro expansion).
This patch adds such out-of-line definitions in libatomic for those
six functions, at a new LIBATOMIC_1.2 symbol version, as trivial
wrappers to the <stdatomic.h> macros, along with declarations of those
functions in <stdatomic.h>. Tests are added that are based on the
corresponding tests for the macros, but with parentheses around the
function names to force the out-of-line functions to be used.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc:
* ginclude/stdatomic.h (atomic_thread_fence, atomic_signal_fence)
(atomic_flag_test_and_set, atomic_flag_test_and_set_explicit)
(atomic_flag_clear, atomic_flag_clear_explicit): Declare as
functions before defining as macros.
gcc/testsuite:
* gcc.dg/atomic/stdatomic-fence-2.c,
gcc.dg/atomic/stdatomic-flag-2.c: New tests.
libatomic:
* fence.c, flag.c: New files.
* Makefile.am (libatomic_la_SOURCES): Add fence.c and flag.c.
* Makefile.in: Regenerate.
* configure.ac (libtool_VERSION): Change to 3:0:2.
* configure: Regenerate.
* libatomic.map (LIBATOMIC_1.2): New symbol version.
From-SVN: r230578
2015-11-18 22:13:44 +00:00
|
|
|
libtool_VERSION=3:0:2
|
2012-05-01 08:48:28 -07:00
|
|
|
AC_SUBST(libtool_VERSION)
|
|
|
|
|
2014-06-17 22:43:18 +02:00
|
|
|
# Check for used threading-model
|
|
|
|
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])
|
|
|
|
|
2017-12-14 18:30:38 +00:00
|
|
|
case "$target" in
|
|
|
|
*aarch64*)
|
|
|
|
ACX_PROG_CC_WARNING_OPTS([-march=armv8-a+lse],[enable_aarch64_lse])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2023-09-11 11:36:31 +02:00
|
|
|
AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
# Get target configury.
|
|
|
|
. ${srcdir}/configure.tgt
|
|
|
|
if test -n "$UNSUPPORTED"; then
|
|
|
|
AC_MSG_ERROR([Configuration ${target} is unsupported.])
|
|
|
|
fi
|
|
|
|
|
2017-12-05 00:49:09 +00:00
|
|
|
# Write out the ifunc resolver arg type.
|
|
|
|
AC_DEFINE_UNQUOTED(IFUNC_RESOLVER_ARGS, $IFUNC_RESOLVER_ARGS,
|
|
|
|
[Define ifunc resolver function argument.])
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
# 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"
|
|
|
|
|
|
|
|
# Check header files.
|
|
|
|
AC_STDC_HEADERS
|
|
|
|
ACX_HEADER_STRING
|
|
|
|
GCC_HEADER_STDINT(gstdint.h)
|
tree-core.h (enum cv_qualifier): Add TYPE_QUAL_ATOMIC.
gcc:
2013-11-05 Andrew MacLeod <amacleod@redhat.com>
Joseph Myers <joseph@codesourcery.com>
* tree-core.h (enum cv_qualifier): Add TYPE_QUAL_ATOMIC.
(enum tree_index): Add TI_ATOMICQI_TYPE, TI_ATOMICHI_TYPE,
TI_ATOMICSI_TYPE, TI_ATOMICDI_TYPE and TI_ATOMICTI_TYPE.
(struct tree_base): Add atomic_flag field.
* tree.h (TYPE_ATOMIC): New accessor macro.
(TYPE_QUALS, TYPE_QUALS_NO_ADDR_SPACE): Add TYPE_QUAL_ATOMIC.
(TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC): New macro.
(atomicQI_type_node, atomicHI_type_node, atomicSI_type_node)
(atomicDI_type_node, atomicTI_type_node): New macros for type
nodes.
* tree.c (set_type_quals): Set TYPE_ATOMIC.
(find_atomic_core_type): New function.
(build_qualified_type): Adjust alignment for qualified types.
(build_atomic_base): New function
(build_common_tree_nodes): Build atomicQI_type_node,
atomicHI_type_node, atomicSI_type_node, atomicDI_type_node and
atomicTI_type_node.
* print-tree.c (print_node): Print atomic qualifier.
* tree-pretty-print.c (dump_generic_node): Print atomic type
attribute.
* target.def (atomic_assign_expand_fenv): New hook.
* doc/tm.texi.in (TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New @hook.
* doc/tm.texi: Regenerate.
* targhooks.c (default_atomic_assign_expand_fenv): New function.
* targhooks.h (default_atomic_assign_expand_fenv): Declare.
* sync-builtins.def (__atomic_feraiseexcept): New built-in
function.
* config/i386/i386-builtin-types.def (VOID_FTYPE_PUSHORT): New
function type.
* config/i386/i386.c (enum ix86_builtins): Add
IX86_BUILTIN_FNSTENV, IX86_BUILTIN_FLDENV, IX86_BUILTIN_FNSTSW and
IX86_BUILTIN_FNCLEX.
(bdesc_special_args): Add __builtin_ia32_fnstenv,
__builtin_ia32_fldenv, __builtin_ia32_fnstsw and
__builtin_ia32_fnclex.
(ix86_expand_builtin): Handle the new built-in functions.
(ix86_atomic_assign_expand_fenv): New function.
(TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New macro.
* config/i386/i386.md (UNSPECV_FNSTENV, UNSPECV_FLDENV)
(UNSPECV_FNSTSW, UNSPECV_FNCLEX): New unspecs.
(fnstenv, fldenv, fnstsw, fnclex): New insns.
gcc/c-family:
2013-11-05 Andrew MacLeod <amacleod@redhat.com>
Joseph Myers <joseph@codesourcery.com>
* c-common.h (enum rid): Add RID_ATOMIC.
* c-common.c (c_common_reswords): Add _Atomic.
(sync_resolve_params): Use TYPE_MAIN_VARIANT on pointer argument.
(keyword_is_type_qualifier): Accept RID_ATOMIC.
* c-format.c (check_format_types): Check for extra _Atomic
qualifiers in format argument.
* c-pretty-print.c (pp_c_cv_qualifiers): Handle atomic qualifier.
(pp_c_type_qualifier_list): Mention _Atomic in comment.
gcc/c:
2013-11-05 Joseph Myers <joseph@codesourcery.com>
Andrew MacLeod <amacleod@redhat.com>
* c-aux-info.c (gen_type): Handle atomic qualifier.
* c-decl.c (validate_proto_after_old_defn): Do not remove atomic
qualifiers when compating types.
(shadow_tag_warned): Handle atomic_p in declspecs.
(quals_from_declspecs): Likewise.
(start_decl): Use c_type_promotes_to when promoting argument
types.
(grokdeclarator): Handle _Atomic.
(get_parm_info): Diagnose any qualifier on "void" as only
parameter.
(store_parm_decls_oldstyle): Do not remove atomic qualifiers when
comparing types. Use c_type_promotes_to when promoting argument
types.
(finish_function): Use c_type_promotes_to when promoting argument
types.
(build_null_declspecs): Handle atomic_p in declspecs.
(declspecs_add_qual): Handle RID_ATOMIC.
* c-parser.c (c_token_starts_typename, c_token_is_qualifier)
(c_token_starts_declspecs): Handle RID_ATOMIC.
(c_parser_declspecs): Handle atomic type specifiers and
qualifiers.
(c_parser_typeof_specifier): Remove const and _Atomic qualifiers
from types of expressions with atomic type.
(c_parser_direct_declarator_inner): Use convert_lvalue_to_rvalue.
(c_parser_attribute_any_word): Handle RID_ATOMIC.
(c_parser_initializer, c_parser_initelt, c_parser_initval)
(c_parser_statement_after_labels, c_parser_switch_statement)
(c_parser_for_statement, c_parser_expr_no_commas)
(c_parser_conditional_expression, c_parser_binary_expression)
(c_parser_cast_expression, c_parser_unary_expression)
(c_parser_postfix_expression)
(c_parser_postfix_expression_after_primary, c_parser_expression):
Use convert_lvalue_to_rvalue.
(c_parser_expression_conv, c_parser_expr_list): Document
conversion of lvalues to rvalues. Use convert_lvalue_to_rvalue.
(c_parser_objc_synchronized_statement): Use
convert_lvalue_to_rvalue.
(c_parser_objc_selector): Handle RID_ATOMIC.
(c_parser_objc_receiver, c_parser_array_notation): Use
convert_lvalue_to_rvalue.
* c-tree.h (ctsk_typeof): Adjust comment to mention use for
_Atomic (type-name).
(struct c_declspecs): Add atomic_p field.
(convert_lvalue_to_rvalue): Declare.
* c-typeck.c (c_type_promotes_to): Promote atomic types to
corresponding atomic types.
(qualify_type): Don't add _Atomic qualifiers from second argument.
(comp_target_types): Do not allow _Atomic mismatches.
(type_lists_compatible_p): Do not remove atomic qualifiers when
comparing types.
(really_atomic_lvalue, convert_lvalue_to_rvalue)
(build_atomic_assign): New functions.
(build_unary_op): Use build_atomic_assign for atomic increment and
decrement.
(build_conditional_expr): Do not treat _Atomic void as a qualified
version of void.
(build_modify_expr): Use build_atomic_assign for atomic LHS.
(find_anonymous_field_with_type, convert_to_anonymous_field)
(convert_for_assignment): Do not remove atomic qualifiers when
comparing types.
(digest_init): Do not accept initialization of arrays of atomic
elements by string constants.
(build_asm_expr): Use convert_lvalue_to_rvalue.
(build_binary_op): Do not treat _Atomic void as a qualified
version of void.
gcc/objc:
2013-11-05 Andrew MacLeod <amacleod@redhat.com>
* objc-act.c (objc_push_parm): Handle atomic qualifier.
gcc/testsuite:
2013-11-05 Joseph Myers <joseph@codesourcery.com>
* lib/target-supports.exp
(check_effective_target_fenv_exceptions): New function.
* lib/atomic-dg.exp, gcc.dg/atomic/atomic.exp: New files.
* gcc.dg/atomic/c11-atomic-exec-1.c,
gcc.dg/atomic/c11-atomic-exec-2.c,
gcc.dg/atomic/c11-atomic-exec-3.c,
gcc.dg/atomic/c11-atomic-exec-4.c,
gcc.dg/atomic/c11-atomic-exec-5.c, gcc.dg/c11-atomic-1.c,
gcc.dg/c11-atomic-2.c, gcc.dg/c11-atomic-3.c,
gcc.dg/c90-atomic-1.c, gcc.dg/c99-atomic-1.c: New tests.
libatomic:
2013-11-05 Joseph Myers <joseph@codesourcery.com>
* fenv.c: New file.
* libatomic.map (LIBATOMIC_1.1): New symbol version. Include
__atomic_feraiseexcept.
* configure.ac (libtool_VERSION): Change to 2:0:1.
(fenv.h): Test for header.
* Makefile.am (libatomic_la_SOURCES): Add fenv.c.
* Makefile.in, auto-config.h.in, configure: Regenerate.
From-SVN: r204544
2013-11-07 21:15:25 +00:00
|
|
|
AC_CHECK_HEADERS([fenv.h])
|
2012-05-01 08:48:28 -07:00
|
|
|
|
|
|
|
# Check for common type sizes
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_INT_MODE])
|
|
|
|
|
|
|
|
# Check for compiler builtins of atomic operations.
|
|
|
|
LIBAT_TEST_ATOMIC_INIT
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_LOADSTORE])
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_TAS])
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_EXCHANGE])
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_CAS])
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_FETCH_ADD])
|
|
|
|
LIBAT_FORALL_MODES([LIBAT_HAVE_ATOMIC_FETCH_OP])
|
|
|
|
|
libatomic: Enable LSE128 128-bit atomics for Armv9.4-a
The armv9.4-a architectural revision adds three new atomic operations
associated with the LSE128 feature:
* LDCLRP - Atomic AND NOT (bitclear) of a location with 128-bit
value held in a pair of registers, with original data loaded into
the same 2 registers.
* LDSETP - Atomic OR (bitset) of a location with 128-bit value held
in a pair of registers, with original data loaded into the same 2
registers.
* SWPP - Atomic swap of one 128-bit value with 128-bit value held
in a pair of registers.
It is worth noting that in keeping with existing 128-bit atomic
operations in `atomic_16.S', we have chosen to merge certain
less-restrictive orderings into more restrictive ones. This is done
to minimize the number of branches in the atomic functions, minimizing
both the likelihood of branch mispredictions and, in keeping code
small, limit the need for extra fetch cycles.
Past benchmarking has revealed that acquire is typically slightly
faster than release (5-10%), such that for the most frequently used
atomics (CAS and SWP) it makes sense to add support for acquire, as
well as release.
Likewise, it was identified that combining acquire and release typically
results in little to no penalty, such that it is of negligible benefit
to distinguish between release and acquire-release, making the
combining release/acq_rel/seq_cst a worthwhile design choice.
This patch adds the logic required to make use of these when the
architectural feature is present and a suitable assembler available.
In order to do this, the following changes are made:
1. Add a configure-time check to check for LSE128 support in the
assembler.
2. Edit host-config.h so that when N == 16, nifunc = 2.
3. Where available due to LSE128, implement the second ifunc, making
use of the novel instructions.
4. For atomic functions unable to make use of these new
instructions, define a new alias which causes the _i1 function
variant to point ahead to the corresponding _i2 implementation.
libatomic/ChangeLog:
* Makefile.am (AM_CPPFLAGS): add conditional setting of
-DHAVE_FEAT_LSE128.
* acinclude.m4 (LIBAT_TEST_FEAT_AARCH64_LSE128): New.
* config/linux/aarch64/atomic_16.S (LSE128): New macro
definition.
(libat_exchange_16): New LSE128 variant.
(libat_fetch_or_16): Likewise.
(libat_or_fetch_16): Likewise.
(libat_fetch_and_16): Likewise.
(libat_and_fetch_16): Likewise.
* config/linux/aarch64/host-config.h (IFUNC_COND_2): New.
(IFUNC_NCOND): Add operand size checking.
(has_lse2): Renamed from `ifunc1`.
(has_lse128): New.
(HWCAP2_LSE128): Likewise.
* configure.ac: Add call to
LIBAT_TEST_FEAT_AARCH64_LSE128.
* configure (ac_subst_vars): Regenerated via autoreconf.
* Makefile.in: Likewise.
* auto-config.h.in: Likewise.
2023-08-01 11:07:56 +01:00
|
|
|
# Check for target-specific assembly-level support for atomic operations.
|
|
|
|
LIBAT_TEST_FEAT_AARCH64_LSE128()
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
AC_C_BIGENDIAN
|
|
|
|
# I don't like the default behaviour of WORDS_BIGENDIAN undefined for LE.
|
|
|
|
AH_BOTTOM(
|
|
|
|
[#ifndef WORDS_BIGENDIAN
|
|
|
|
#define WORDS_BIGENDIAN 0
|
|
|
|
#endif])
|
|
|
|
|
|
|
|
LIBAT_WORDSIZE
|
|
|
|
|
|
|
|
# Check to see if -pthread or -lpthread is needed. Prefer the former.
|
|
|
|
# In case the pthread.h system header is not found, this test will fail.
|
|
|
|
case " $config_path " in
|
|
|
|
*" posix "*)
|
|
|
|
XPCFLAGS=""
|
|
|
|
CFLAGS="$CFLAGS -pthread"
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[#include <pthread.h>
|
|
|
|
void *g(void *d) { return NULL; }],
|
|
|
|
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
|
|
|
[XPCFLAGS=" -pthread"],
|
|
|
|
[CFLAGS="$save_CFLAGS $XCFLAGS" LIBS="-lpthread $LIBS"
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM(
|
|
|
|
[#include <pthread.h>
|
|
|
|
void *g(void *d) { return NULL; }],
|
|
|
|
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
|
|
|
[],
|
|
|
|
[AC_MSG_ERROR([Pthreads are required to build libatomic])])])
|
2012-05-07 16:10:11 +00:00
|
|
|
CFLAGS="$save_CFLAGS $XPCFLAGS"
|
2012-05-01 08:48:28 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# See what sort of export controls are available.
|
|
|
|
LIBAT_CHECK_ATTRIBUTE_VISIBILITY
|
|
|
|
LIBAT_CHECK_ATTRIBUTE_DLLEXPORT
|
|
|
|
LIBAT_CHECK_ATTRIBUTE_ALIAS
|
|
|
|
if test x$try_ifunc = xyes; then
|
|
|
|
LIBAT_CHECK_IFUNC
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check linker support.
|
|
|
|
LIBAT_ENABLE_SYMVERS
|
|
|
|
|
|
|
|
# Cleanup and exit.
|
|
|
|
CFLAGS="$save_CFLAGS"
|
|
|
|
AC_CACHE_SAVE
|
|
|
|
|
2022-02-03 15:47:10 +01:00
|
|
|
AC_ARG_ENABLE([werror],
|
|
|
|
[AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
|
2012-05-01 08:48:28 -07:00
|
|
|
# Add -Wall -Werror if we are using GCC.
|
2022-02-03 15:47:10 +01:00
|
|
|
AS_IF([test "x$GCC" = "xyes"],
|
|
|
|
[XCFLAGS="$XCFLAGS -Wall"])
|
|
|
|
AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"],
|
|
|
|
[XCFLAGS="$XCFLAGS -Werror"])
|
2012-05-01 08:48:28 -07:00
|
|
|
|
2017-11-17 22:18:15 +01:00
|
|
|
# Add CET specific flags if CET is enabled
|
|
|
|
GCC_CET_FLAGS(CET_FLAGS)
|
|
|
|
XCFLAGS="$XCFLAGS $CET_FLAGS"
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
XCFLAGS="$XCFLAGS $XPCFLAGS"
|
|
|
|
|
|
|
|
AC_SUBST(config_path)
|
|
|
|
AC_SUBST(XCFLAGS)
|
|
|
|
AC_SUBST(XLDFLAGS)
|
|
|
|
AC_SUBST(LIBS)
|
|
|
|
AC_SUBST(SIZES)
|
|
|
|
|
2020-05-15 17:46:08 -04:00
|
|
|
# Conditionalize the makefile for this target machine.
|
|
|
|
tmake_file_=
|
|
|
|
for f in ${tmake_file}
|
|
|
|
do
|
|
|
|
if test -f ${srcdir}/config/$f
|
|
|
|
then
|
|
|
|
tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
tmake_file="${tmake_file_}"
|
|
|
|
AC_SUBST(tmake_file)
|
|
|
|
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
AM_CONDITIONAL(HAVE_IFUNC, test x$libat_cv_have_ifunc = xyes)
|
2017-12-05 00:49:09 +00:00
|
|
|
AM_CONDITIONAL(ARCH_AARCH64_LINUX,
|
|
|
|
[expr "$config_path" : ".* linux/aarch64 .*" > /dev/null])
|
2012-05-01 08:48:28 -07:00
|
|
|
AM_CONDITIONAL(ARCH_ARM_LINUX,
|
|
|
|
[expr "$config_path" : ".* linux/arm .*" > /dev/null])
|
|
|
|
AM_CONDITIONAL(ARCH_I386,
|
|
|
|
[test "$ARCH" = x86 && test x$libat_cv_wordsize = x4])
|
|
|
|
AM_CONDITIONAL(ARCH_X86_64,
|
|
|
|
[test "$ARCH" = x86 && test x$libat_cv_wordsize = x8])
|
|
|
|
|
2017-01-17 10:38:48 +01:00
|
|
|
# Determine what GCC version number to use in filesystem paths.
|
|
|
|
GCC_BASE_VER
|
|
|
|
|
2012-05-01 08:48:28 -07:00
|
|
|
if test ${multilib} = yes; then
|
|
|
|
multilib_arg="--enable-multilib"
|
|
|
|
else
|
|
|
|
multilib_arg=
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CONFIG_FILES(Makefile testsuite/Makefile)
|
2020-04-06 23:32:44 +01:00
|
|
|
AC_CONFIG_FILES(testsuite/libatomic-site-extra.exp)
|
2012-05-01 08:48:28 -07:00
|
|
|
AC_OUTPUT
|