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='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -fPIC -o conftest2.so conftest2.S'
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='LC_ALL=C $READELF -Wr conftest2.so | grep -q 'R_LARCH_JUMP_SLOT.*external_func''
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; }; }
64 libc_cv_static_pie_on_loongarch=yes
68 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie_on_loongarch" >&5
69 $as_echo "$libc_cv_static_pie_on_loongarch" >&6; }
71 if test "$libc_cv_static_pie_on_loongarch" = yes; then
72 $as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
76 # Check if gcc supports option -mcmodel=medium.
77 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports option -mcmodel=medium" >&5
78 $as_echo_n "checking whether $CC supports option -mcmodel=medium... " >&6; }
79 if ${libc_cv_loongarch_cmodel_medium+:} false; then :
80 $as_echo_n "(cached) " >&6
83 if { ac_try='${CC-cc} -c $CFLAGS -mcmodel=medium /dev/null 1>&5'
84 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
87 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
88 test $ac_status = 0; }; }; then
89 libc_cv_loongarch_cmodel_medium=yes
91 libc_cv_loongarch_cmodel_medium=no
94 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_loongarch_cmodel_medium" >&5
95 $as_echo "$libc_cv_loongarch_cmodel_medium" >&6; }
96 config_vars="$config_vars
97 have-cmodel-medium = $libc_cv_loongarch_cmodel_medium"