1 # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
2 # Local configure fragment for sysdeps/loongarch/elf.
4 $as_echo "#define HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 1" >>confdefs.h
7 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the toolchain is sufficient to build static PIE on LoongArch" >&5
8 $as_echo_n "checking if the toolchain is sufficient to build static PIE on LoongArch... " >&6; }
9 if ${libc_cv_static_pie_on_loongarch+:} false; then :
10 $as_echo_n "(cached) " >&6
13 cat > conftest1.S << EOF
15 .type _start, @function
18 /* This ensures the assembler supports explicit reloc. */
19 pcalau12i \$a0, %pc_hi20(x)
20 ld.w \$a0, \$a0, %pc_lo12(x)
26 /* This should produce an R_LARCH_RELATIVE in the static PIE. */
29 cat > conftest2.S << EOF
33 /* The linker should be able to handle this and produce a PLT entry. */
34 la.pcrel \$t0, \$t0, external_func
38 libc_cv_static_pie_on_loongarch=no
39 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostdlib -fPIE -o conftest1 conftest1.S'
40 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
43 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
44 test $ac_status = 0; }; } \
45 && { ac_try='LC_ALL=C $READELF -Wr conftest1 | grep -q R_LARCH_RELATIVE'
46 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
49 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
50 test $ac_status = 0; }; } \
51 && ! { ac_try='LC_ALL=C $READELF -Wl conftest1 | grep -q INTERP'
52 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
55 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
56 test $ac_status = 0; }; } \
57 && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -fPIC -o conftest2.so conftest2.S'
58 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
61 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
62 test $ac_status = 0; }; } \
63 && { ac_try='LC_ALL=C $READELF -Wr conftest2.so | grep -q 'R_LARCH_JUMP_SLOT.*external_func''
64 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
67 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
68 test $ac_status = 0; }; }
70 libc_cv_static_pie_on_loongarch=yes
74 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie_on_loongarch" >&5
75 $as_echo "$libc_cv_static_pie_on_loongarch" >&6; }
77 if test "$libc_cv_static_pie_on_loongarch" = yes; then
78 $as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
82 # Check if gcc supports option -mcmodel=medium.
83 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports option -mcmodel=medium" >&5
84 $as_echo_n "checking whether $CC supports option -mcmodel=medium... " >&6; }
85 if ${libc_cv_loongarch_cmodel_medium+:} false; then :
86 $as_echo_n "(cached) " >&6
89 if { ac_try='${CC-cc} -c $CFLAGS -mcmodel=medium /dev/null 1>&5'
90 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
93 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
94 test $ac_status = 0; }; }; then
95 libc_cv_loongarch_cmodel_medium=yes
97 libc_cv_loongarch_cmodel_medium=no
100 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_loongarch_cmodel_medium" >&5
101 $as_echo "$libc_cv_loongarch_cmodel_medium" >&6; }
102 config_vars="$config_vars
103 have-cmodel-medium = $libc_cv_loongarch_cmodel_medium"