[compiler-rt] r246454 - builtins: implement __emutls_get_address

Chih-hung Hsieh via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 10:32:30 PDT 2015


I am not sure which one is correct yet,
but gcc -mx32 and clang -mx32 are not compatible.

       sizeof(gcc_word) (size_t)
 clang -m64   8          8
 gcc   -m64   8          8
 clang -m32   4          4
 gcc   -m32   4          4
 clang -mx32  4          4
 gcc   -mx32  8          4

So, for -mx32 targets, even the original emutls.c will have difference
layout for gcc_word from gcc and clang. Would it be right to use only gcc
or only clang for gcc -mx32? Then, this compiler-rt's emutls.c should be
excluded when gcc -mx32 is used.


On Fri, Sep 4, 2015 at 10:10 AM, H.J. Lu <hjl.tools at gmail.com> wrote:

> On Fri, Sep 4, 2015 at 9:53 AM, Chih-hung Hsieh <chh at google.com> wrote:
> > What are the compilation flags to trigger that failure?
> > It is unexpected that a target integer word is 8 and sizeof(size_t) is 4.
> > If that configuration is correct, and also needs emutls, then it cannot
> use
> > both gnu's emutls.c and this one because the layout difference. If that
> > platform does not need emutls or compatibility with gcc, then we can skip
> > this test for that platform.
> >
> >
> compiler-rt is compiled by gcc:
>
> [hjl at gnu-32 bin]$ cat /tmp/i.c
> typedef __SIZE_TYPE__ size_t;
> typedef unsigned int gcc_word __attribute__((mode(word)));
>
> int foo[sizeof(size_t) == sizeof(gcc_word) ? 1 : -1];
> [hjl at gnu-32 bin]$ gcc -S -mx32 /tmp/i.c
> /tmp/i.c:4:5: error: size of array ‘foo’ is negative
>  int foo[sizeof(size_t) == sizeof(gcc_word) ? 1 : -1];
>      ^
> [hjl at gnu-32 bin]$
>
> --
> H.J.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150904/53e298f4/attachment.html>


More information about the llvm-commits mailing list