aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/s390/s390-64/configure
blob: c8e25b242f57803b3e444c9caf47afab0f7833c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
 # Local configure fragment for sysdeps/s390/s390-64.

# Minimal checking for static PIE support in ld.
# Compare to ld testcase/bugzilla:
# <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements (runtime check)" >&5
printf %s "checking for s390-specific static PIE requirements (runtime check)... " >&6; }
if { as_var=\
libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; }
then :
  printf %s "(cached) " >&6
else $as_nop
    cat > conftest1.c <<EOF
__thread int * foo;

void
bar (void)
{
  *foo = 1;
}

void bar2 (void);
void* bar2_ifunc (void) __asm__ ("bar2");
__asm__ (".type bar2, %gnu_indirect_function");
void* bar2_ifunc (void) { return 0; }
EOF
  cat > conftest2.c <<EOF
extern __thread int *foo;
extern void bar (void);
extern void bar2 (void);
static int x;

int
main ()
{
  foo = &x;
  bar2 ();
  return 0;
}
EOF
  libc_cv_s390x_staticpie_req_runtime=no
  # Check if the static linker does not generate dynamic TLS relocs in PIE
  # (binutils PR ld/22263), if it accepts --no-dynamic-linker
  # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt
  # with static pie.
  if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; } \
     && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; } \
     && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; } \
     && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; } \
     && { ac_try='LC_ACLL=C $READELF -d conftest | grep JMPREL'
  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; }
  then
    libc_cv_s390x_staticpie_req_runtime=yes
  fi
  rm -rf conftest.*
fi
eval ac_res=\$\
libc_cv_s390x_staticpie_req_runtime
	       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }

if test $libc_cv_s390x_staticpie_req_runtime = yes; then
   # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0
   # due not enough space for a brk call.  However, there is no reliable way to
   # test it.
   printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h

fi