[compiler-rt] r246454 - builtins: implement __emutls_get_address
H.J. Lu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 4 08:30:39 PDT 2015
On Fri, Sep 4, 2015 at 8:15 AM, Joerg Sonnenberger via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> On Fri, Sep 04, 2015 at 08:00:34AM -0700, H.J. Lu via llvm-commits wrote:
>> > +/* Emulated TLS objects are always allocated at run-time. */
>> > +static inline void* emutls_allocate_object(__emutls_control* control) {
>> > + /* Use standard C types, check with gcc's emutls.o. */
>> > + typedef unsigned int gcc_word __attribute__((mode(word)));
>> > + typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
>> > + COMPILE_TIME_ASSERT(sizeof(size_t) == sizeof(gcc_word));
>>
>> What is this assert for? It is false for x32 where size_t is 4 bytes and
>> gcc_word 8 bytes.
>
> To ensure that the struct layout is ABI compatible. So what layout does
> GCC use?
>
Why not use
typedef unsigned int gcc_word __attribute__((mode(word)));
typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
typedef struct __emutls_control {
gcc_word size; /* size of the object in bytes */
gcc_word align; /* alignment of the object in bytes */
union {
gcc_pointer index; /* data[index-1] is the object address */
void* address; /* object address, when in single thread env */
} object;
void* value; /* null or non-zero initial value for the object */
} __emutls_control;
then?
--
H.J.
More information about the llvm-commits
mailing list