* 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.
This commit is contained in:
parent
32b769e114
commit
155a0dd763
16 changed files with 360 additions and 72 deletions
|
@ -1,3 +1,51 @@
|
|||
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.
|
||||
|
|
|
@ -214,6 +214,8 @@ NATIVE_LINKER_FALSE = @NATIVE_LINKER_FALSE@
|
|||
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@
|
||||
|
|
|
@ -60,7 +60,7 @@ Allocate_commons_task::locks(Task_locker* tl)
|
|||
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
|
||||
|
@ -117,12 +117,12 @@ Sort_commons<size>::operator()(const Symbol* pa, const Symbol* pb) const
|
|||
// 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
|
||||
|
@ -130,7 +130,7 @@ Symbol_table::allocate_commons(const General_options& options, Layout* layout)
|
|||
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
|
||||
|
@ -143,8 +143,19 @@ Symbol_table::allocate_commons(const General_options& options, Layout* layout)
|
|||
|
||||
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;
|
||||
|
@ -154,8 +165,8 @@ Symbol_table::do_allocate_commons(const General_options&,
|
|||
// 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;
|
||||
|
@ -179,22 +190,27 @@ Symbol_table::do_allocate_commons(const General_options&,
|
|||
|
||||
// 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;
|
||||
|
@ -208,7 +224,7 @@ Symbol_table::do_allocate_commons(const General_options&,
|
|||
|
||||
poc->set_current_data_size(off);
|
||||
|
||||
this->commons_.clear();
|
||||
commons->clear();
|
||||
}
|
||||
|
||||
} // End namespace gold.
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
namespace gold
|
||||
{
|
||||
|
||||
class General_options;
|
||||
class Symbol_table;
|
||||
|
||||
// This task is used to allocate the common symbols.
|
||||
|
@ -36,11 +35,10 @@ class Symbol_table;
|
|||
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.
|
||||
|
@ -59,7 +57,6 @@ class Allocate_commons_task : public Task
|
|||
{ return "Allocate_commons_task"; }
|
||||
|
||||
private:
|
||||
const General_options& options_;
|
||||
Symbol_table* symtab_;
|
||||
Layout* layout_;
|
||||
Task_token* symtab_lock_;
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
/* 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
|
||||
|
||||
|
|
77
gold/configure
vendored
77
gold/configure
vendored
|
@ -309,7 +309,7 @@ ac_includes_default="\
|
|||
# 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.
|
||||
|
@ -4651,6 +4651,72 @@ else
|
|||
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
|
||||
|
@ -6657,6 +6723,13 @@ echo "$as_me: error: conditional \"STATIC_TLS\" was never defined.
|
|||
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
|
||||
|
@ -7322,6 +7395,8 @@ s,@TLS_TRUE@,$TLS_TRUE,;t t
|
|||
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
|
||||
|
|
|
@ -221,6 +221,22 @@ error
|
|||
|
||||
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"
|
||||
|
|
|
@ -260,8 +260,8 @@ queue_middle_tasks(const General_options& options,
|
|||
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
|
||||
|
|
|
@ -360,7 +360,7 @@ Symbol::set_output_section(Output_section* os)
|
|||
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);
|
||||
|
@ -715,7 +715,12 @@ Symbol_table::add_from_object(Object* object,
|
|||
// 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();
|
||||
|
@ -1830,7 +1835,15 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym)
|
|||
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();
|
||||
}
|
||||
|
|
|
@ -1104,7 +1104,7 @@ class Symbol_table
|
|||
|
||||
// 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.
|
||||
|
@ -1180,6 +1180,9 @@ class Symbol_table
|
|||
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);
|
||||
|
@ -1282,7 +1285,12 @@ class Symbol_table
|
|||
// 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>
|
||||
|
@ -1347,9 +1355,6 @@ class Symbol_table
|
|||
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;
|
||||
|
||||
|
@ -1416,6 +1421,9 @@ class Symbol_table
|
|||
// 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.
|
||||
|
|
|
@ -13,7 +13,7 @@ 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@
|
||||
|
||||
|
@ -26,6 +26,10 @@ if THREADS
|
|||
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
|
||||
|
@ -433,8 +437,10 @@ tls_test_pic.o: tls_test.cc
|
|||
$(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
|
||||
|
||||
|
@ -442,18 +448,24 @@ tls_test_pic_ie.o: tls_test.cc
|
|||
$(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
|
||||
|
@ -466,9 +478,11 @@ tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
|
|||
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
|
||||
|
||||
|
@ -478,20 +492,24 @@ tls_test_gnu2.o: tls_test.cc
|
|||
$(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
|
||||
|
@ -519,8 +537,8 @@ endif
|
|||
|
||||
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
|
||||
|
|
|
@ -150,9 +150,6 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
|
|||
@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 \
|
||||
|
@ -521,7 +518,8 @@ am__tls_static_pic_test_SOURCES_DIST = tls_test_main.cc
|
|||
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 = \
|
||||
|
@ -530,6 +528,8 @@ am__tls_static_test_SOURCES_DIST = tls_test.cc tls_test_file2.cc \
|
|||
@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 = \
|
||||
|
@ -857,6 +857,8 @@ NATIVE_LINKER_FALSE = @NATIVE_LINKER_FALSE@
|
|||
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@
|
||||
|
@ -939,7 +941,7 @@ AUTOMAKE_OPTIONS =
|
|||
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@
|
||||
|
||||
|
@ -948,6 +950,7 @@ TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
|
|||
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
|
||||
|
@ -1162,13 +1165,17 @@ binary_unittest_SOURCES = binary_unittest.cc
|
|||
@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,.
|
||||
|
@ -1178,13 +1185,21 @@ binary_unittest_SOURCES = binary_unittest.cc
|
|||
@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,.
|
||||
|
@ -1919,8 +1934,10 @@ uninstall-am: uninstall-info-am
|
|||
@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
|
||||
|
||||
|
@ -1928,20 +1945,26 @@ uninstall-am: uninstall-info-am
|
|||
@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
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
|
||||
#include <cstdio>
|
||||
#include "config.h"
|
||||
#include "tls_test.h"
|
||||
|
||||
#define CHECK_EQ_OR_RETURN(var, expected) \
|
||||
|
@ -197,5 +198,7 @@ t_last()
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ extern int* f10a();
|
|||
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
|
||||
|
|
62
gold/testsuite/tls_test_c.c
Normal file
62
gold/testsuite/tls_test_c.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* 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;
|
||||
}
|
|
@ -99,6 +99,7 @@ thread_routine(void* arg)
|
|||
check("t9", t9());
|
||||
f10b(f10a());
|
||||
check("t10", t10());
|
||||
check("t11", t11() != 0);
|
||||
check("t_last", t_last());
|
||||
|
||||
// Unlock the second mutex.
|
||||
|
|
Loading…
Reference in a new issue