2015-01-05 13:33:28 +01:00
|
|
|
## Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
2012-05-01 17:48:28 +02:00
|
|
|
## Contributed by Richard Henderson <rth@redhat.com>.
|
|
|
|
##
|
|
|
|
## 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/>.
|
|
|
|
|
|
|
|
ACLOCAL_AMFLAGS = -I .. -I ../config
|
|
|
|
SUBDIRS = testsuite
|
|
|
|
|
|
|
|
## May be used by toolexeclibdir.
|
|
|
|
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
|
|
|
|
|
|
|
|
config_path= @config_path@
|
|
|
|
search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
|
|
|
|
$(top_srcdir) $(top_builddir)
|
|
|
|
|
|
|
|
vpath % $(strip $(search_path))
|
|
|
|
|
|
|
|
DEFAULT_INCLUDES = $(addprefix -I, $(search_path))
|
|
|
|
AM_CFLAGS = $(XCFLAGS)
|
|
|
|
AM_CCASFLAGS = $(XCFLAGS)
|
|
|
|
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
|
|
|
|
|
|
|
|
toolexeclib_LTLIBRARIES = libatomic.la
|
2012-12-18 23:04:08 +01:00
|
|
|
noinst_LTLIBRARIES = libatomic_convenience.la
|
2012-05-01 17:48:28 +02:00
|
|
|
|
|
|
|
if LIBAT_BUILD_VERSIONED_SHLIB
|
|
|
|
if LIBAT_BUILD_VERSIONED_SHLIB_GNU
|
|
|
|
libatomic_version_script = -Wl,--version-script,$(top_srcdir)/libatomic.map
|
|
|
|
libatomic_version_dep = $(top_srcdir)/libatomic.map
|
|
|
|
endif
|
|
|
|
if LIBAT_BUILD_VERSIONED_SHLIB_SUN
|
|
|
|
libatomic_version_script = -Wl,-M,libatomic.map-sun
|
|
|
|
libatomic_version_dep = libatomic.map-sun
|
|
|
|
libatomic.map-sun : $(top_srcdir)/libatomic.map \
|
|
|
|
$(top_srcdir)/../contrib/make_sunver.pl \
|
|
|
|
$(libatomic_la_OBJECTS) $(libatomic_la_LIBADD)
|
|
|
|
perl $(top_srcdir)/../contrib/make_sunver.pl \
|
|
|
|
$(top_srcdir)/libatomic.map \
|
|
|
|
$(libatomic_la_OBJECTS:%.lo=.libs/%.o) \
|
|
|
|
`echo $(libatomic_la_LIBADD) | \
|
2012-05-07 18:11:14 +02:00
|
|
|
sed 's,\([^/ ]*\)\.l\([ao]\),.libs/\1.\2,g'` \
|
2012-05-01 17:48:28 +02:00
|
|
|
> $@ || (rm -f $@ ; exit 1)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
libatomic_version_script =
|
|
|
|
libatomic_version_dep =
|
|
|
|
endif
|
|
|
|
libatomic_version_info = -version-info $(libtool_VERSION)
|
|
|
|
|
2014-06-17 22:43:18 +02:00
|
|
|
libatomic_la_LDFLAGS = $(libatomic_version_info) $(libatomic_version_script) $(lt_host_flags)
|
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 22:15:25 +01:00
|
|
|
libatomic_la_SOURCES = gload.c gstore.c gcas.c gexch.c glfree.c lock.c init.c \
|
|
|
|
fenv.c
|
2012-05-01 17:48:28 +02:00
|
|
|
|
|
|
|
SIZEOBJS = load store cas exch fadd fsub fand fior fxor fnand tas
|
|
|
|
SIZES = @SIZES@
|
|
|
|
|
|
|
|
EXTRA_libatomic_la_SOURCES = $(addsuffix _n.c,$(SIZEOBJS))
|
|
|
|
libatomic_la_DEPENDENCIES = $(libatomic_la_LIBADD) $(libatomic_version_dep)
|
|
|
|
|
|
|
|
## And now our custom target patterns that allow us not to have tons of
|
|
|
|
## extra source files hanging about. Unfortunately, the complex relation
|
|
|
|
## between source and object filenames doesn't allow us to add an explicit
|
|
|
|
## dependency here. Fortunately that doesn't matter since auto-generated
|
|
|
|
## dependencies do the job just as well:
|
|
|
|
-include $(wildcard $(DEPDIR)/*.Ppo)
|
|
|
|
|
|
|
|
## Naming pattern: base_n_i_.lo
|
|
|
|
##
|
|
|
|
## N size of data
|
|
|
|
## I IFUNC alternative, index beginning at 1.
|
|
|
|
##
|
|
|
|
## The trailing _ in the output object file name is required to differentiate
|
|
|
|
## these objects from those which should be compiled normally. We can only
|
|
|
|
## have one stem in the implicit rule.
|
|
|
|
|
|
|
|
empty =
|
|
|
|
space = $(empty) $(empty)
|
|
|
|
PAT_SPLIT = $(subst _,$(space),$(*F))
|
|
|
|
PAT_BASE = $(word 1,$(PAT_SPLIT))
|
|
|
|
PAT_N = $(word 2,$(PAT_SPLIT))
|
|
|
|
PAT_S = $(word 3,$(PAT_SPLIT))
|
|
|
|
IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
|
|
|
|
IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
|
|
|
|
|
|
|
|
M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
|
|
|
|
M_SIZE = -DN=$(PAT_N)
|
|
|
|
M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
|
|
|
|
M_FILE = $(PAT_BASE)_n.c
|
|
|
|
|
|
|
|
# The lack of explicit dependency on the source file means that VPATH cannot
|
|
|
|
# work properly. Instead, perform this operation by hand. First, collect a
|
|
|
|
# list of all .c files in the search path.
|
|
|
|
all_c_files := $(foreach dir,$(search_path),$(wildcard $(dir)/*.c))
|
|
|
|
|
|
|
|
# Then sort through them to find the one we want, and select the first.
|
|
|
|
M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
|
|
|
|
|
|
|
|
%_.lo: Makefile
|
|
|
|
$(LTCOMPILE) $(M_DEPS) $(M_SIZE) $(M_IFUNC) -c -o $@ $(M_SRC)
|
|
|
|
|
|
|
|
## Include all of the sizes in the "normal" set of compilation flags.
|
|
|
|
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_ARM_LINUX
|
|
|
|
IFUNC_OPTIONS = -march=armv7-a -DHAVE_KERNEL64
|
|
|
|
libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
|
|
|
|
libatomic_la_LIBADD += $(addsuffix _8_2_.lo,$(SIZEOBJS))
|
|
|
|
endif
|
|
|
|
if ARCH_I386
|
|
|
|
IFUNC_OPTIONS = -march=i586
|
|
|
|
libatomic_la_LIBADD += $(addsuffix _8_1_.lo,$(SIZEOBJS))
|
|
|
|
endif
|
|
|
|
if ARCH_X86_64
|
|
|
|
IFUNC_OPTIONS = -mcx16
|
|
|
|
libatomic_la_LIBADD += $(addsuffix _16_1_.lo,$(SIZEOBJS))
|
|
|
|
endif
|
|
|
|
endif
|
2012-12-18 23:04:08 +01:00
|
|
|
|
|
|
|
libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES)
|
|
|
|
libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD)
|