1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/s390/s390-64.
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
7 AC_CACHE_CHECK([for s390-specific static PIE requirements (runtime check)], \
8 [libc_cv_s390x_staticpie_req_runtime], [dnl
9 cat > conftest1.c <<EOF
19 void* bar2_ifunc (void) __asm__ ("bar2");
20 __asm__ (".type bar2, %gnu_indirect_function");
21 void* bar2_ifunc (void) { return 0; }
23 cat > conftest2.c <<EOF
24 extern __thread int *foo;
25 extern void bar (void);
26 extern void bar2 (void);
37 libc_cv_s390x_staticpie_req_runtime=no
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
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]) \
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])
48 libc_cv_s390x_staticpie_req_runtime=yes
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
56 AC_DEFINE(SUPPORT_STATIC_PIE)