parameter. Change caller.
(Symbol_table::do_allocate_commons): Remove options parameter.
Change caller. Just call do_allocate_commons_list twice.
(Symbol_table::do_allocate_commons_list): New function, broken out
of do_allocate_commons.
* common.h (class Allocate_commons_task): Remove options_ field.
Update constructor.
* symtab.cc (Symbol_table::Symbol_table): Initialize
tls_commons_.
(Symbol_table::add_from_object): Put TLS common symbols on
tls_commons_ list.
(Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
which are IN_OUTPUT_DATA.
* symtab.h (class Symbol_table): Add tls_commons_ field. Update
allocate_commons and do_allocate_commons declarations. Declare
do_allocate_commons_list.
* gold.cc (queue_middle_tasks): Update creation of
Allocate_commons_task to not pass options.
* testsuite/Makefile.am (INCLUDES): Add -I.. .
(TLS_TEST_C_FLAGS): New variable.
(tls_test_c_pic.o): New target.
(tls_test_shared.so): Link in tls_test_c_pic.o.
(tls_test_c_pic_ie.o): New target.
(tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
(tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
(tls_test_c.o): New target.
(tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
(tls_pic_test_LDADD): Likewise.
(tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
(tls_shared_gd_to_ie_test_LDADD): Likewise.
(tls_test_c_gnu2.o): New target.
(tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
tls_test_c_gnu2.o.
(tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
(tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
(tls_test_shared_nonpic.so): Link in tls_test_c.o.
* testsuite/tls_test.cc: Include "config.h".
(t_last): Call t11_last.
* testsuite/tls_test.h (t11, t11_last): Declare.
* testsuite/tls_test_c.c: New file.
* testsuite/tls_test_main.cc (thread_routine): Call t11.
* configure.ac: Check for OpenMP support.
* configure, config.in, Makefile.in: Rebuild.
* testsuite/Makefile.in: Rebuild.
+2008-04-17 Ian Lance Taylor <iant@google.com>
+
+ * common.cc (Symbol_table::allocate_commons): Remove options
+ parameter. Change caller.
+ (Symbol_table::do_allocate_commons): Remove options parameter.
+ Change caller. Just call do_allocate_commons_list twice.
+ (Symbol_table::do_allocate_commons_list): New function, broken out
+ of do_allocate_commons.
+ * common.h (class Allocate_commons_task): Remove options_ field.
+ Update constructor.
+ * symtab.cc (Symbol_table::Symbol_table): Initialize
+ tls_commons_.
+ (Symbol_table::add_from_object): Put TLS common symbols on
+ tls_commons_ list.
+ (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
+ which are IN_OUTPUT_DATA.
+ * symtab.h (class Symbol_table): Add tls_commons_ field. Update
+ allocate_commons and do_allocate_commons declarations. Declare
+ do_allocate_commons_list.
+ * gold.cc (queue_middle_tasks): Update creation of
+ Allocate_commons_task to not pass options.
+ * testsuite/Makefile.am (INCLUDES): Add -I.. .
+ (TLS_TEST_C_FLAGS): New variable.
+ (tls_test_c_pic.o): New target.
+ (tls_test_shared.so): Link in tls_test_c_pic.o.
+ (tls_test_c_pic_ie.o): New target.
+ (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
+ (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
+ (tls_test_c.o): New target.
+ (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
+ (tls_pic_test_LDADD): Likewise.
+ (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
+ (tls_shared_gd_to_ie_test_LDADD): Likewise.
+ (tls_test_c_gnu2.o): New target.
+ (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
+ tls_test_c_gnu2.o.
+ (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
+ (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
+ (tls_test_shared_nonpic.so): Link in tls_test_c.o.
+ * testsuite/tls_test.cc: Include "config.h".
+ (t_last): Call t11_last.
+ * testsuite/tls_test.h (t11, t11_last): Declare.
+ * testsuite/tls_test_c.c: New file.
+ * testsuite/tls_test_main.cc (thread_routine): Call t11.
+ * configure.ac: Check for OpenMP support.
+ * configure, config.in, Makefile.in: Rebuild.
+ * testsuite/Makefile.in: Rebuild.
+
2008-04-16 Cary Coutant <ccoutant@google.com>
* i386.cc (Target_i386::define_tls_base_symbol): New function.
NATIVE_LINKER_TRUE = @NATIVE_LINKER_TRUE@
NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
+OMP_SUPPORT_FALSE = @OMP_SUPPORT_FALSE@
+OMP_SUPPORT_TRUE = @OMP_SUPPORT_TRUE@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
void
Allocate_commons_task::run(Workqueue*)
{
- this->symtab_->allocate_commons(this->options_, this->layout_);
+ this->symtab_->allocate_commons(this->layout_);
}
// This class is used to sort the common symbol by size. We put the
// Allocate the common symbols.
void
-Symbol_table::allocate_commons(const General_options& options, Layout* layout)
+Symbol_table::allocate_commons(Layout* layout)
{
if (parameters->target().get_size() == 32)
{
#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
- this->do_allocate_commons<32>(options, layout);
+ this->do_allocate_commons<32>(layout);
#else
gold_unreachable();
#endif
else if (parameters->target().get_size() == 64)
{
#if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
- this->do_allocate_commons<64>(options, layout);
+ this->do_allocate_commons<64>(layout);
#else
gold_unreachable();
#endif
template<int size>
void
-Symbol_table::do_allocate_commons(const General_options&,
- Layout* layout)
+Symbol_table::do_allocate_commons(Layout* layout)
+{
+ this->do_allocate_commons_list<size>(layout, false, &this->commons_);
+ this->do_allocate_commons_list<size>(layout, true, &this->tls_commons_);
+}
+
+// Allocate the common symbols in a list. IS_TLS indicates whether
+// these are TLS common symbols.
+
+template<int size>
+void
+Symbol_table::do_allocate_commons_list(Layout* layout, bool is_tls,
+ Commons_type* commons)
{
typedef typename Sized_symbol<size>::Value_type Value_type;
typedef typename Sized_symbol<size>::Size_type Size_type;
// forwarder. First remove all non-common symbols.
bool any = false;
uint64_t addralign = 0;
- for (Commons_type::iterator p = this->commons_.begin();
- p != this->commons_.end();
+ for (Commons_type::iterator p = commons->begin();
+ p != commons->end();
++p)
{
Symbol* sym = *p;
// Sort the common symbols by size, so that they pack better into
// memory.
- std::sort(this->commons_.begin(), this->commons_.end(),
+ std::sort(commons->begin(), commons->end(),
Sort_commons<size>(this));
- // Place them in a newly allocated .bss section.
+ // Place them in a newly allocated BSS section.
Output_data_space *poc = new Output_data_space(addralign);
- layout->add_output_section_data(".bss", elfcpp::SHT_NOBITS,
- elfcpp::SHF_WRITE | elfcpp::SHF_ALLOC,
- poc);
+ const char* name = ".bss";
+ elfcpp::Elf_Xword flags = elfcpp::SHF_WRITE | elfcpp::SHF_ALLOC;
+ if (is_tls)
+ {
+ name = ".tbss";
+ flags |= elfcpp::SHF_TLS;
+ }
+ layout->add_output_section_data(name, elfcpp::SHT_NOBITS, flags, poc);
// Allocate them all.
off_t off = 0;
- for (Commons_type::iterator p = this->commons_.begin();
- p != this->commons_.end();
+ for (Commons_type::iterator p = commons->begin();
+ p != commons->end();
++p)
{
Symbol* sym = *p;
poc->set_current_data_size(off);
- this->commons_.clear();
+ commons->clear();
}
} // End namespace gold.
namespace gold
{
-class General_options;
class Symbol_table;
// This task is used to allocate the common symbols.
class Allocate_commons_task : public Task
{
public:
- Allocate_commons_task(const General_options& options, Symbol_table* symtab,
- Layout* layout, Task_token* symtab_lock,
- Task_token* blocker)
- : options_(options), symtab_(symtab), layout_(layout),
- symtab_lock_(symtab_lock), blocker_(blocker)
+ Allocate_commons_task(Symbol_table* symtab, Layout* layout,
+ Task_token* symtab_lock, Task_token* blocker)
+ : symtab_(symtab), layout_(layout), symtab_lock_(symtab_lock),
+ blocker_(blocker)
{ }
// The standard Task methods.
{ return "Allocate_commons_task"; }
private:
- const General_options& options_;
Symbol_table* symtab_;
Layout* layout_;
Task_token* symtab_lock_;
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define if compiler supports #pragma omp threadprivate */
+#undef HAVE_OMP_SUPPORT
+
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar THREADS_TRUE THREADS_FALSE TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE STATIC_TLS_TRUE STATIC_TLS_FALSE TLS_GNU2_DIALECT_TRUE TLS_GNU2_DIALECT_FALSE TLS_DESCRIPTORS_TRUE TLS_DESCRIPTORS_FALSE CONSTRUCTOR_PRIORITY_TRUE CONSTRUCTOR_PRIORITY_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CFLAGS LIBOBJS CPP EGREP HAVE_ZLIB_TRUE HAVE_ZLIB_FALSE CXXCPP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar THREADS_TRUE THREADS_FALSE TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE STATIC_TLS_TRUE STATIC_TLS_FALSE OMP_SUPPORT_TRUE OMP_SUPPORT_FALSE TLS_GNU2_DIALECT_TRUE TLS_GNU2_DIALECT_FALSE TLS_DESCRIPTORS_TRUE TLS_DESCRIPTORS_FALSE CONSTRUCTOR_PRIORITY_TRUE CONSTRUCTOR_PRIORITY_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CFLAGS LIBOBJS CPP EGREP HAVE_ZLIB_TRUE HAVE_ZLIB_FALSE CXXCPP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
fi
+echo "$as_me:$LINENO: checking for omp support" >&5
+echo $ECHO_N "checking for omp support... $ECHO_C" >&6
+if test "${gold_cv_c_threadprivate+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fopenmp"
+cat >conftest.$ac_ext <<_ACEOF
+
+#include <omp.h>
+int i;
+#pragma omp threadprivate (i)
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gold_cv_c_threadprivate=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gold_cv_c_threadprivate=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $gold_cv_c_threadprivate" >&5
+echo "${ECHO_T}$gold_cv_c_threadprivate" >&6
+if test "$gold_cv_c_threadprivate" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OMP_SUPPORT 1
+_ACEOF
+
+fi
+
+
+if test "$gold_cv_c_threadprivate" = "yes"; then
+ OMP_SUPPORT_TRUE=
+ OMP_SUPPORT_FALSE='#'
+else
+ OMP_SUPPORT_TRUE='#'
+ OMP_SUPPORT_FALSE=
+fi
+
+
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mtls-dialect=gnu2"
cat >conftest.$ac_ext <<_ACEOF
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${OMP_SUPPORT_TRUE}" && test -z "${OMP_SUPPORT_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"OMP_SUPPORT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"OMP_SUPPORT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${TLS_GNU2_DIALECT_TRUE}" && test -z "${TLS_GNU2_DIALECT_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"TLS_GNU2_DIALECT\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
s,@TLS_FALSE@,$TLS_FALSE,;t t
s,@STATIC_TLS_TRUE@,$STATIC_TLS_TRUE,;t t
s,@STATIC_TLS_FALSE@,$STATIC_TLS_FALSE,;t t
+s,@OMP_SUPPORT_TRUE@,$OMP_SUPPORT_TRUE,;t t
+s,@OMP_SUPPORT_FALSE@,$OMP_SUPPORT_FALSE,;t t
s,@TLS_GNU2_DIALECT_TRUE@,$TLS_GNU2_DIALECT_TRUE,;t t
s,@TLS_GNU2_DIALECT_FALSE@,$TLS_GNU2_DIALECT_FALSE,;t t
s,@TLS_DESCRIPTORS_TRUE@,$TLS_DESCRIPTORS_TRUE,;t t
AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes")
+dnl Test for #pragma omp threadprivate
+AC_CACHE_CHECK([for omp support], [gold_cv_c_threadprivate],
+[save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fopenmp"
+AC_COMPILE_IFELSE([
+#include <omp.h>
+int i;
+#pragma omp threadprivate (i)
+], [gold_cv_c_threadprivate=yes], [gold_cv_c_threadprivate=no])
+CFLAGS="$save_CFLAGS"])
+if test "$gold_cv_c_threadprivate" = "yes"; then
+ AC_DEFINE(HAVE_OMP_SUPPORT, 1,
+ [Define if compiler supports #pragma omp threadprivate])
+fi
+AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes")
+
dnl Test for the -ftls-dialect=gnu2 option.
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mtls-dialect=gnu2"
if (parameters->options().define_common())
{
blocker->add_blocker();
- workqueue->queue(new Allocate_commons_task(options, symtab, layout,
- symtab_lock, blocker));
+ workqueue->queue(new Allocate_commons_task(symtab, layout, symtab_lock,
+ blocker));
}
// When all those tasks are complete, we can start laying out the
Symbol_table::Symbol_table(unsigned int count,
const Version_script_info& version_script)
: saw_undefined_(0), offset_(0), table_(count), namepool_(),
- forwarders_(), commons_(), forced_locals_(), warnings_(),
+ forwarders_(), commons_(), tls_commons_(), forced_locals_(), warnings_(),
version_script_(version_script)
{
namepool_.reserve(count);
// Keep track of common symbols, to speed up common symbol
// allocation.
if (!was_common && ret->is_common())
- this->commons_.push_back(ret);
+ {
+ if (ret->type() != elfcpp::STT_TLS)
+ this->commons_.push_back(ret);
+ else
+ this->tls_commons_.push_back(ret);
+ }
if (def)
ret->set_is_default();
case Symbol::IN_OUTPUT_DATA:
{
Output_data* od = sym->output_data();
- value = sym->value() + od->address();
+ value = sym->value();
+ if (sym->type() != elfcpp::STT_TLS)
+ value += od->address();
+ else
+ {
+ Output_section* os = od->output_section();
+ gold_assert(os != NULL);
+ value += os->tls_offset() + (od->address() - os->address());
+ }
if (sym->offset_is_from_end())
value += od->data_size();
}
// Allocate the common symbols
void
- allocate_commons(const General_options&, Layout*);
+ allocate_commons(Layout*);
// Add a warning for symbol NAME in object OBJ. WARNING is the text
// of the warning.
Symbol_table(const Symbol_table&);
Symbol_table& operator=(const Symbol_table&);
+ // The type of the list of common symbols.
+ typedef std::vector<Symbol*> Commons_type;
+
// Make FROM a forwarder symbol to TO.
void
make_forwarder(Symbol* from, Symbol* to);
// Allocate the common symbols, sized version.
template<int size>
void
- do_allocate_commons(const General_options&, Layout*);
+ do_allocate_commons(Layout*);
+
+ // Allocate the common symbols from one list.
+ template<int size>
+ void
+ do_allocate_commons_list(Layout*, bool is_tls, Commons_type*);
// Implement detect_odr_violations.
template<int size, bool big_endian>
typedef Unordered_map<Symbol_table_key, Symbol*, Symbol_table_hash,
Symbol_table_eq> Symbol_table_type;
- // The type of the list of common symbols.
- typedef std::vector<Symbol*> Commons_type;
-
// The type of the list of symbols which have been forced local.
typedef std::vector<Symbol*> Forced_locals;
// symbol is no longer a common symbol. It may also have become a
// forwarder.
Commons_type commons_;
+ // This is like the commons_ field, except that it holds TLS common
+ // symbols.
+ Commons_type tls_commons_;
// A list of symbols which have been forced to be local. We don't
// expect there to be very many of them, so we keep a list of them
// rather than walking the whole table to find them.
INCLUDES = \
-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
- -I$(srcdir)/../../elfcpp \
+ -I$(srcdir)/../../elfcpp -I.. \
-DLOCALEDIR="\"$(datadir)/locale\"" \
@INCINTL@
THREADSLIB = -lpthread
endif
+if OMP_SUPPORT
+TLS_TEST_C_CFLAGS = -fopenmp
+endif
+
# 'make clean' is good about deleting some intermediate files (such as
# .o's), but not all of them (such as .so's and .err files). We
# improve on that here. automake-1.9 info docs say "mostlyclean" is
$(CXXCOMPILE) -c -fpic -o $@ $<
tls_test_file2_pic.o: tls_test_file2.cc
$(CXXCOMPILE) -c -fpic -o $@ $<
-tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o
+tls_test_c_pic.o: tls_test_c.c
+ $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
+tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o
tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
$(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
tls_test_file2_pic_ie.o: tls_test_file2.cc
$(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
-tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o
+tls_test_c_pic_ie.o: tls_test_c.c
+ $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
+tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
-tls_test_DEPENDENCIES = gcctestdir/ld
+tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
tls_test_LDFLAGS = -Bgcctestdir/
-tls_test_LDADD = -lpthread
+tls_test_LDADD = tls_test_c.o -lpthread
+tls_test_c.o: tls_test_c.c
+ $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
tls_pic_test_SOURCES = tls_test_main.cc
-tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o
+tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
+ tls_test_c_pic.o
tls_pic_test_LDFLAGS = -Bgcctestdir/
-tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread
+tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
+ -lpthread
tls_shared_test_SOURCES = tls_test_main.cc
tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
-tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_shared2.so
+tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
+ tls_test_c_pic.o tls_test_shared2.so
tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
-tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_shared2.so -lpthread
+tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
+ tls_test_shared2.so -lpthread
if TLS_GNU2_DIALECT
$(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
tls_test_file2_gnu2.o: tls_test_file2.cc
$(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
+tls_test_c_gnu2.o: tls_test_c.c
+ $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
-tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o tls_test_gnu2_shared2.so
+tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
+ tls_test_c_gnu2.o tls_test_gnu2_shared2.so
tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
-tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_gnu2_shared2.so -lpthread
+tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
+ tls_test_gnu2_shared2.so -lpthread
if TLS_DESCRIPTORS
check_PROGRAMS += tls_shared_gnu2_test
-tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o
+tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
tls_shared_gnu2_test_SOURCES = tls_test_main.cc
tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
if FN_PTRS_IN_SO_WITHOUT_PIC
check_PROGRAMS += tls_shared_nonpic_test
-tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld
- $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o
+tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
+ $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
tls_shared_nonpic_test_SOURCES = tls_test_main.cc
tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_ie_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_shared_gd_to_ie_test
-@GCC_FALSE@tls_test_DEPENDENCIES =
-@NATIVE_LINKER_FALSE@tls_test_DEPENDENCIES =
-@TLS_FALSE@tls_test_DEPENDENCIES =
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@am__append_7 = tls_shared_gnu2_gd_to_ie_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@am__append_8 = tls_shared_gnu2_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am__append_9 = tls_static_test \
tls_static_pic_test_OBJECTS = $(am_tls_static_pic_test_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_2 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_pic.o \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_file2_pic.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_file2_pic.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c_pic.o
am__tls_static_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
tls_test_main.cc tls_test.h
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__objects_4 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_main.$(OBJEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@STATIC_TLS_TRUE@@TLS_TRUE@am_tls_static_test_OBJECTS = $(am__objects_4)
tls_static_test_OBJECTS = $(am_tls_static_test_OBJECTS)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__DEPENDENCIES_3 = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c.o
am__tls_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
tls_test_main.cc tls_test.h
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am_tls_test_OBJECTS = \
NATIVE_LINKER_TRUE = @NATIVE_LINKER_TRUE@
NO_WERROR = @NO_WERROR@
OBJEXT = @OBJEXT@
+OMP_SUPPORT_FALSE = @OMP_SUPPORT_FALSE@
+OMP_SUPPORT_TRUE = @OMP_SUPPORT_TRUE@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
INCLUDES = \
-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
- -I$(srcdir)/../../elfcpp \
+ -I$(srcdir)/../../elfcpp -I.. \
-DLOCALEDIR="\"$(datadir)/locale\"" \
@INCINTL@
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
TEST_STRIP = $(top_builddir)/../binutils/strip-new
@THREADS_TRUE@THREADSLIB = -lpthread
+@OMP_SUPPORT_TRUE@TLS_TEST_C_CFLAGS = -fopenmp
# 'make clean' is good about deleting some intermediate files (such as
# .o's), but not all of them (such as .so's and .err files). We
@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_alias_test_4.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_DEPENDENCIES = gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_LDFLAGS = -Bgcctestdir/
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_LDADD = -lpthread
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_LDADD = tls_test_c.o -lpthread
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_SOURCES = tls_test_main.cc
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c_pic.o
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_LDFLAGS = -Bgcctestdir/
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ -lpthread
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_test_SOURCES = tls_test_main.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_shared2.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_c_pic.o tls_test_shared2.so
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_shared2.so -lpthread
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ tls_test_shared2.so -lpthread
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o tls_test_gnu2_shared2.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ tls_test_c_gnu2.o tls_test_gnu2_shared2.so
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_gnu2_shared2.so -lpthread
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ tls_test_gnu2_shared2.so -lpthread
+
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_test_SOURCES = tls_test_main.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_file2_pic.o: tls_test_file2.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_c_pic.o: tls_test_c.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_file2_pic_ie.o: tls_test_file2.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_c_pic_ie.o: tls_test_c.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_c.o: tls_test_c.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_gnu2.o: tls_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_file2_gnu2.o: tls_test_file2.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_c_gnu2.o: tls_test_c.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld
-@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_DESCRIPTORS_TRUE@@TLS_GNU2_DIALECT_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
+@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg.o: debug_msg.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation1.o: odr_violation1.cc
#include <cstdio>
+#include "config.h"
#include "tls_test.h"
#define CHECK_EQ_OR_RETURN(var, expected) \
CHECK_EQ_OR_RETURN(o1, -10);
CHECK_EQ_OR_RETURN(o2, -20);
CHECK_EQ_OR_RETURN(o3, -30);
+ int check = t11_last();
+ CHECK_EQ_OR_RETURN(check, 1);
return true;
}
extern void f10b(int*);
extern bool t10();
+extern "C" int t11();
+extern "C" int t11_last();
+
extern bool t_last();
// These variables are defined in tls_test_file2.cc
--- /dev/null
+/* tls_test_c.c -- test TLS common symbol
+
+ Copyright 2008 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <iant@google.com>
+
+ This file is part of gold.
+
+ This program 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.
+
+ This program 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* The only way I know to get gcc to generate a TLS common symbol is
+ to use a C file and an OpenMP directive. */
+
+#include <stdio.h>
+#include "config.h"
+
+#define CHECK_EQ_OR_RETURN(var, expected) \
+ do \
+ { \
+ if ((var) != (expected)) \
+ { \
+ printf(#var ": expected %d, found %d\n", expected, var); \
+ return 0; \
+ } \
+ } \
+ while (0)
+
+#ifdef HAVE_OMP_SUPPORT
+int v7;
+#pragma omp threadprivate (v7)
+#endif
+
+int
+t11()
+{
+#ifdef HAVE_OMP_SUPPORT
+ CHECK_EQ_OR_RETURN(v7, 0);
+ v7 = 70;
+#endif
+ return 1;
+}
+
+int
+t11_last()
+{
+#ifdef HAVE_OMP_SUPPORT
+ CHECK_EQ_OR_RETURN(v7, 70);
+#endif
+ return 1;
+}
check("t9", t9());
f10b(f10a());
check("t10", t10());
+ check("t11", t11() != 0);
check("t_last", t_last());
// Unlock the second mutex.