[compiler-rt] r246454 - builtins: implement __emutls_get_address

H.J. Lu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 08:00:34 PDT 2015


On Mon, Aug 31, 2015 at 10:14 AM, Chih-Hung Hsieh via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: chh
> Date: Mon Aug 31 12:14:07 2015
> New Revision: 246454
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246454&view=rev
> Log:
> builtins: implement __emutls_get_address
>
> For targets like Android that depends on libgcc's emulated thread local storage.
> clang/llvm can generate calls to __emutls_get_address since
> http://reviews.llvm.org/D10522 and http://reviews.llvm.org/D10524
>
> Differential Revision: http://reviews.llvm.org/D12001
>
>
> Added:
>     compiler-rt/trunk/lib/builtins/emutls.c
> Modified:
>     compiler-rt/trunk/lib/builtins/CMakeLists.txt
>     compiler-rt/trunk/lib/builtins/README.txt
>     compiler-rt/trunk/lib/builtins/int_util.h
>
>
> +/* 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.

> +    COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(gcc_pointer));
> +    COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(void*));
>
-- 
H.J.


More information about the llvm-commits mailing list