2.9
[glibc/nacl-glibc.git] / sysdeps / sparc / sparc64 / elf / configure.in
blobfd7e34e900159825118697e5e8f29fdb54446448
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/sparc/sparc64/elf.
4 if test "$usetls" != no; then
5 # Check for support of thread-local storage handling in assembler and linker.
6 AC_CACHE_CHECK(for sparc64 TLS support, libc_cv_sparc64_tls, [dnl
7 changequote(,)dnl
8 cat > conftest.s <<\EOF
9         .section ".tdata", "awT", @progbits
10         .globl foo
11 foo:    .word   1
12         .section ".tbss", "awT", @nobits
13         .globl bar
14 bar:    .skip   4
15         .text
16         .globl main
17 main:   sethi   %tgd_hi22(foo), %l1
18         add     %l1, %tgd_lo10(foo), %l1
19         add     %l7, %l1, %o0, %tgd_add(foo)
20         call    __tls_get_addr, %tgd_call(foo)
21         sethi   %tldm_hi22(bar), %l1
22         add     %l1, %tldm_lo10(bar), %l1
23         add     %l7, %l1, %o0, %tldm_add(bar)
24         call    __tls_get_addr, %tldm_call(bar)
25         sethi   %tldo_hix22(bar), %l1
26         xor     %l1, %tldo_lox10(bar), %l1
27         add     %o0, %l1, %l1, %tldo_add(bar)
28         sethi   %tie_hi22(foo), %l1
29         add     %l1, %tie_lo10(foo), %l1
30         ldx     [%l7 + %l1], %l1, %tie_ldx(foo)
31         add     %g7, %l1, %l1, %tie_add(foo)
32         sethi   %tle_hix22(foo), %l1
33         xor     %l1, %tle_lox10(foo), %l1
34 EOF
35 changequote([,])dnl
36 dnl
37 if AC_TRY_COMMAND(${CC-cc} -o conftest.bin $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
38   libc_cv_sparc64_tls=yes
39 else
40   libc_cv_sparc64_tls=no
42 rm -f conftest*])
43 if test $libc_cv_sparc64_tls = yes; then
44   AC_DEFINE(HAVE_TLS_SUPPORT)
48 # Check for broken WDISP22 in the linker.
49 AC_CACHE_CHECK(for sparc64 ld WDISP22 handling, libc_cv_sparc64_wdisp22, [dnl
50 echo 'bne foo; nop' > conftest1.s
51 echo '.globl foo; .hidden foo; foo: nop' > conftest2.s
52 libc_cv_sparc64_wdisp22=unknown
53 if AC_TRY_COMMAND(${CC-cc} -nostdlib -shared $CFLAGS conftest1.s conftest2.s -o conftest.so 1>&AS_MESSAGE_LOG_FD); then
54   if readelf -r conftest.so | grep -q R_SPARC_WDISP22; then
55     libc_cv_sparc64_wdisp22=broken
56   else
57     libc_cv_sparc64_wdisp22=ok
58   fi
60 rm -f conftest*])
61 if test $libc_cv_sparc64_wdisp22 != ok; then
62   AC_DEFINE(BROKEN_SPARC_WDISP22)