Support TLS common symbols

Ian Lance Taylor
Thu Apr 17 07:13:00 GMT 2008

Looking at the failures from gcc's libgomp testsuite showed me that
gold doesn't support TLS common symbols.  As far as I can tell, the
only way to get such a symbol is to use an OpenMP directive.  This
patch adds support for TLS common symbols, with a test case.

(With this patch, the whole libgomp testsuite passes with gold.)


	* (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.
	* (Symbol_table::Symbol_table): Initialize
	(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
	* (queue_middle_tasks): Update creation of
	Allocate_commons_task to not pass options.
	* testsuite/ (INCLUDES): Add -I.. .
	(TLS_TEST_C_FLAGS): New variable.
	(tls_test_c_pic.o): New target.
	( Link in tls_test_c_pic.o.
	(tls_test_c_pic_ie.o): New target.
	( 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_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
	( Link in tls_test_c_gnu2.o.
	( Link in tls_test_c.o.
	* testsuite/ Include "config.h".
	(t_last): Call t11_last.
	* testsuite/tls_test.h (t11, t11_last): Declare.
	* testsuite/tls_test_c.c: New file.
	* testsuite/ (thread_routine): Call t11.
	* Check for OpenMP support.
	* configure,, Rebuild.
	* testsuite/ Rebuild.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 19887 bytes
Desc: Support TLS common symbols
URL: <>

More information about the Binutils mailing list