]>
Commit | Line | Data |
---|---|---|
728894db SL |
1 | GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. |
2 | # Local configure fragment for sysdeps/s390/s390-64. | |
3 | ||
4 | # Minimal checking for static PIE support in ld. | |
5 | # Compare to ld testcase/bugzilla: | |
6 | # <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd | |
f5f96b78 SL |
7 | AC_CACHE_CHECK([for s390-specific static PIE requirements (runtime check)], \ |
8 | [libc_cv_s390x_staticpie_req_runtime], [dnl | |
728894db SL |
9 | cat > conftest1.c <<EOF |
10 | __thread int * foo; | |
11 | ||
12 | void | |
13 | bar (void) | |
14 | { | |
15 | *foo = 1; | |
16 | } | |
b53e73ea AZ |
17 | |
18 | void bar2 (void); | |
19 | void* bar2_ifunc (void) __asm__ ("bar2"); | |
20 | __asm__ (".type bar2, %gnu_indirect_function"); | |
21 | void* bar2_ifunc (void) { return 0; } | |
728894db SL |
22 | EOF |
23 | cat > conftest2.c <<EOF | |
24 | extern __thread int *foo; | |
25 | extern void bar (void); | |
b53e73ea | 26 | extern void bar2 (void); |
728894db SL |
27 | static int x; |
28 | ||
29 | int | |
30 | main () | |
31 | { | |
32 | foo = &x; | |
b53e73ea | 33 | bar2 (); |
728894db SL |
34 | return 0; |
35 | } | |
36 | EOF | |
f5f96b78 | 37 | libc_cv_s390x_staticpie_req_runtime=no |
b53e73ea AZ |
38 | # Check if the static linker does not generate dynamic TLS relocs in PIE |
39 | # (binutils PR ld/22263), if it accepts --no-dynamic-linker | |
40 | # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt | |
41 | # with static pie. | |
728894db SL |
42 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o]) \ |
43 | && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o]) \ | |
b53e73ea AZ |
44 | && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o]) \ |
45 | && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF]) \ | |
46 | && AC_TRY_COMMAND([LC_ACLL=C $READELF -d conftest | grep JMPREL]) | |
728894db | 47 | then |
f5f96b78 | 48 | libc_cv_s390x_staticpie_req_runtime=yes |
728894db SL |
49 | fi |
50 | rm -rf conftest.*]) | |
f5f96b78 | 51 | |
b53e73ea AZ |
52 | if test $libc_cv_s390x_staticpie_req_runtime = yes; then |
53 | # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0 | |
54 | # due not enough space for a brk call. However, there is no reliable way to | |
55 | # test it. | |
728894db SL |
56 | AC_DEFINE(SUPPORT_STATIC_PIE) |
57 | fi |