Commit 931fae81 by Jerome Lambourg Committed by Olivier Hainque

vxworks.h (VXWORKS_LIB_SPEC): Incorporate ...

2017-06-27  Jerome Lambourg  <lambourg@adacore.com>
            Olivier Hainque  <hainque@adacore.com>

	* config/vxworks.h (VXWORKS_LIB_SPEC): Incorporate ...
	(TLS_SYM): New local macro, forcing reference to __tls__ on
	link command lines for VxWorks 7 RTPs, triggering initialization
	of tlsLib.
	(VXWORKS_HAVE_TLS): New macro. State whether the target VxWorks
	OS features TLS support, true for RTPs on VxWorks 7.
	* config/vxworks.c (vxworks_override_options): Setup emutls
	accordingly.


Co-Authored-By: Olivier Hainque <hainque@adacore.com>

From-SVN: r249684
parent f6b3ca5a
2017-06-27 Jerome Lambourg <lambourg@adacore.com>
Olivier Hainque <hainque@adacore.com>
* config/vxworks.h (VXWORKS_LIB_SPEC): Incorporate ...
(TLS_SYM): New local macro, forcing reference to __tls__ on
link command lines for VxWorks 7 RTPs, triggering initialization
of tlsLib.
(VXWORKS_HAVE_TLS): New macro. State whether the target VxWorks
OS features TLS support, true for RTPs on VxWorks 7.
* config/vxworks.c (vxworks_override_options): Setup emutls
accordingly.
2017-06-27 Jakub Jelinek <jakub@redhat.com> 2017-06-27 Jakub Jelinek <jakub@redhat.com>
* predict.c (test_prediction_value_range): Use -1U instead of -1 * predict.c (test_prediction_value_range): Use -1U instead of -1
......
...@@ -125,20 +125,24 @@ vxworks_emutls_var_init (tree var, tree decl, tree tmpl_addr) ...@@ -125,20 +125,24 @@ vxworks_emutls_var_init (tree var, tree decl, tree tmpl_addr)
void void
vxworks_override_options (void) vxworks_override_options (void)
{ {
/* We don't support __thread via target hooks. */ /* Setup the tls emulation bits if the OS misses proper
targetm.have_tls = false; tls support. */
targetm.have_tls = VXWORKS_HAVE_TLS;
targetm.emutls.get_address = "__builtin___tls_lookup";
targetm.emutls.register_common = NULL; if (!VXWORKS_HAVE_TLS)
targetm.emutls.var_section = ".tls_vars"; {
targetm.emutls.tmpl_section = ".tls_data"; targetm.emutls.get_address = "__builtin___tls_lookup";
targetm.emutls.var_prefix = "__tls__"; targetm.emutls.register_common = NULL;
targetm.emutls.tmpl_prefix = ""; targetm.emutls.var_section = ".tls_vars";
targetm.emutls.var_fields = vxworks_emutls_var_fields; targetm.emutls.tmpl_section = ".tls_data";
targetm.emutls.var_init = vxworks_emutls_var_init; targetm.emutls.var_prefix = "__tls__";
targetm.emutls.var_align_fixed = true; targetm.emutls.tmpl_prefix = "";
targetm.emutls.debug_form_tls_address = true; targetm.emutls.var_fields = vxworks_emutls_var_fields;
targetm.emutls.var_init = vxworks_emutls_var_init;
targetm.emutls.var_align_fixed = true;
targetm.emutls.debug_form_tls_address = true;
}
/* We can use .ctors/.dtors sections only in RTP mode. */ /* We can use .ctors/.dtors sections only in RTP mode. */
targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; targetm.have_ctors_dtors = TARGET_VXWORKS_RTP;
......
...@@ -81,16 +81,22 @@ along with GCC; see the file COPYING3. If not see ...@@ -81,16 +81,22 @@ along with GCC; see the file COPYING3. If not see
and its structure is fixed and does not depend on the arch. We can thus and its structure is fixed and does not depend on the arch. We can thus
tell gcc where to look for when linking with RTP libraries. */ tell gcc where to look for when linking with RTP libraries. */
/* On Vx7 RTP, we need to drag the __tls__ symbol to trigger initialization of
tlsLib, responsible for TLS support by the OS. */
#if TARGET_VXWORKS7 #if TARGET_VXWORKS7
#define VXWORKS_LIBS_DIR_RTP "-L%:getenv(VSB_DIR /usr/lib/common)" #define VXWORKS_LIBS_DIR_RTP "-L%:getenv(VSB_DIR /usr/lib/common)"
#define TLS_SYM "-u __tls__"
#else #else
#define VXWORKS_LIBS_DIR_RTP "" #define VXWORKS_LIBS_DIR_RTP ""
#define TLS_SYM ""
#endif #endif
#undef VXWORKS_LIB_SPEC #undef VXWORKS_LIB_SPEC
#define VXWORKS_LIB_SPEC \ #define VXWORKS_LIB_SPEC \
"%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \ "%{mrtp:%{shared:-u " USER_LABEL_PREFIX "__init -u " USER_LABEL_PREFIX "__fini} \
%{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \ %{!shared:%{non-static:-u " USER_LABEL_PREFIX "_STI__6__rtld -ldl} \
" TLS_SYM " \
--start-group " VXWORKS_LIBS_RTP " --end-group} \ --start-group " VXWORKS_LIBS_RTP " --end-group} \
" VXWORKS_LIBS_DIR_RTP "}" " VXWORKS_LIBS_DIR_RTP "}"
...@@ -126,6 +132,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -126,6 +132,9 @@ along with GCC; see the file COPYING3. If not see
#define VXWORKS_ENDFILE_SPEC "" #define VXWORKS_ENDFILE_SPEC ""
/* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */ /* Do VxWorks-specific parts of TARGET_OPTION_OVERRIDE. */
#define VXWORKS_HAVE_TLS (TARGET_VXWORKS7 && TARGET_VXWORKS_RTP)
#undef VXWORKS_OVERRIDE_OPTIONS #undef VXWORKS_OVERRIDE_OPTIONS
#define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options () #define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options ()
extern void vxworks_override_options (void); extern void vxworks_override_options (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment