gccint: Emulated TLS
1
1 18.25 Emulating TLS
1 ===================
1
1 For targets whose psABI does not provide Thread Local Storage via
1 specific relocations and instruction sequences, an emulation layer is
1 used. A set of target hooks allows this emulation layer to be
1 configured for the requirements of a particular target. For instance
1 the psABI may in fact specify TLS support in terms of an emulation
1 layer.
1
1 The emulation layer works by creating a control object for every TLS
1 object. To access the TLS object, a lookup function is provided which,
1 when given the address of the control object, will return the address of
1 the current thread's instance of the TLS object.
1
1 -- Target Hook: const char * TARGET_EMUTLS_GET_ADDRESS
1 Contains the name of the helper function that uses a TLS control
1 object to locate a TLS instance. The default causes libgcc's
1 emulated TLS helper function to be used.
1
1 -- Target Hook: const char * TARGET_EMUTLS_REGISTER_COMMON
1 Contains the name of the helper function that should be used at
1 program startup to register TLS objects that are implicitly
1 initialized to zero. If this is 'NULL', all TLS objects will have
1 explicit initializers. The default causes libgcc's emulated TLS
1 registration function to be used.
1
1 -- Target Hook: const char * TARGET_EMUTLS_VAR_SECTION
1 Contains the name of the section in which TLS control variables
1 should be placed. The default of 'NULL' allows these to be placed
1 in any section.
1
1 -- Target Hook: const char * TARGET_EMUTLS_TMPL_SECTION
1 Contains the name of the section in which TLS initializers should
1 be placed. The default of 'NULL' allows these to be placed in any
1 section.
1
1 -- Target Hook: const char * TARGET_EMUTLS_VAR_PREFIX
1 Contains the prefix to be prepended to TLS control variable names.
1 The default of 'NULL' uses a target-specific prefix.
1
1 -- Target Hook: const char * TARGET_EMUTLS_TMPL_PREFIX
1 Contains the prefix to be prepended to TLS initializer objects.
1 The default of 'NULL' uses a target-specific prefix.
1
1 -- Target Hook: tree TARGET_EMUTLS_VAR_FIELDS (tree TYPE, tree *NAME)
1 Specifies a function that generates the FIELD_DECLs for a TLS
1 control object type. TYPE is the RECORD_TYPE the fields are for
1 and NAME should be filled with the structure tag, if the default of
1 '__emutls_object' is unsuitable. The default creates a type
1 suitable for libgcc's emulated TLS function.
1
1 -- Target Hook: tree TARGET_EMUTLS_VAR_INIT (tree VAR, tree DECL, tree
1 TMPL_ADDR)
1 Specifies a function that generates the CONSTRUCTOR to initialize a
1 TLS control object. VAR is the TLS control object, DECL is the TLS
1 object and TMPL_ADDR is the address of the initializer. The
1 default initializes libgcc's emulated TLS control object.
1
1 -- Target Hook: bool TARGET_EMUTLS_VAR_ALIGN_FIXED
1 Specifies whether the alignment of TLS control variable objects is
1 fixed and should not be increased as some backends may do to
1 optimize single objects. The default is false.
1
1 -- Target Hook: bool TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS
1 Specifies whether a DWARF 'DW_OP_form_tls_address' location
1 descriptor may be used to describe emulated TLS control objects.
1