| 1 |
# This file is generated from configure.ac by Autoconf. DO NOT EDIT! |
| 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 |
| 7 |
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements" >&5 |
| 8 |
printf %s "checking for s390-specific static PIE requirements... " >&6; } |
| 9 |
if { as_var=\ |
| 10 |
libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; } |
| 11 |
then : |
| 12 |
printf %s "(cached) " >&6 |
| 13 |
else case e in #( |
| 14 |
e) cat > conftest1.c <<EOF |
| 15 |
__thread int * foo; |
| 16 |
|
| 17 |
void |
| 18 |
bar (void) |
| 19 |
{ |
| 20 |
*foo = 1; |
| 21 |
} |
| 22 |
|
| 23 |
void bar2 (void); |
| 24 |
void* bar2_ifunc (void) __asm__ ("bar2"); |
| 25 |
__asm__ (".type bar2, %gnu_indirect_function"); |
| 26 |
void* bar2_ifunc (void) { return 0; } |
| 27 |
EOF |
| 28 |
cat > conftest2.c <<EOF |
| 29 |
extern __thread int *foo; |
| 30 |
extern void bar (void); |
| 31 |
extern void bar2 (void); |
| 32 |
static int x; |
| 33 |
|
| 34 |
int |
| 35 |
main () |
| 36 |
{ |
| 37 |
foo = &x; |
| 38 |
bar2 (); |
| 39 |
return 0; |
| 40 |
} |
| 41 |
EOF |
| 42 |
libc_cv_s390x_staticpie_req_runtime=no |
| 43 |
# Check if the static linker does not generate dynamic TLS relocs in PIE |
| 44 |
# (binutils PR ld/22263), if it accepts --no-dynamic-linker |
| 45 |
# (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt |
| 46 |
# with static pie. |
| 47 |
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o' |
| 48 |
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 |
| 49 |
(eval $ac_try) 2>&5 |
| 50 |
ac_status=$? |
| 51 |
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 52 |
test $ac_status = 0; }; } \ |
| 53 |
&& { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o' |
| 54 |
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 |
| 55 |
(eval $ac_try) 2>&5 |
| 56 |
ac_status=$? |
| 57 |
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 58 |
test $ac_status = 0; }; } \ |
| 59 |
&& { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o' |
| 60 |
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 |
| 61 |
(eval $ac_try) 2>&5 |
| 62 |
ac_status=$? |
| 63 |
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 64 |
test $ac_status = 0; }; } \ |
| 65 |
&& { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF >&5' |
| 66 |
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 |
| 67 |
(eval $ac_try) 2>&5 |
| 68 |
ac_status=$? |
| 69 |
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 70 |
test $ac_status = 0; }; } \ |
| 71 |
&& { ac_try='LC_ALL=C $READELF -Wd conftest | grep JMPREL >&5' |
| 72 |
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 |
| 73 |
(eval $ac_try) 2>&5 |
| 74 |
ac_status=$? |
| 75 |
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
| 76 |
test $ac_status = 0; }; } |
| 77 |
then |
| 78 |
libc_cv_s390x_staticpie_req_runtime=yes |
| 79 |
fi |
| 80 |
rm -rf conftest.* ;; |
| 81 |
esac |
| 82 |
fi |
| 83 |
eval ac_res=\$\ |
| 84 |
libc_cv_s390x_staticpie_req_runtime |
| 85 |
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 |
| 86 |
printf "%s\n" "$ac_res" >&6; } |
| 87 |
|
| 88 |
if test $libc_cv_s390x_staticpie_req_runtime = yes; then |
| 89 |
# Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0 |
| 90 |
# due not enough space for a brk call. However, there is no reliable way to |
| 91 |
# test it. |
| 92 |
printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h |
| 93 |
|
| 94 |
fi |
| 95 |
|