debug: Fix clang open fortify wrapper (BZ 31927)
[glibc.git] / sysdeps / i386 / configure.ac
blob7f68e6210a81f328a831ea6c79a4a3bef838009f
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/i386.
4 # CET is only supported for x86-64.
5 if test $enable_cet != no; then
6   AC_MSG_ERROR(["CET is only supported on x86_64 or x32"])
7 fi
9 # We no longer support i386 since it lacks the atomic instructions
10 # required to implement NPTL threading.
11 if test "$config_machine" = i386; then
12   AC_MSG_ERROR([
13 *** ERROR: Support for i386 is deprecated.
14 *** Please use host i786, i686, i585 or i486.
15 *** For example: /src/glibc/configure --host=i686-pc-linux-gnu ..."])
18 # The GNU C Library can't be built for i386.  There are several reasons for
19 # this restriction.  The primary reason is that i386 lacks the atomic
20 # operations required to support the current NPTL implementation.  While it is
21 # possible that such atomic operations could be emulated in the kernel to date
22 # no such work has been done to enable this.  Even with NPTL disabled you still
23 # have no atomic.h implementation.  Given the declining use of i386 we disable
24 # support for building with `-march=i386' or `-mcpu=i386.' We don't explicitly
25 # check for i386, instead we make sure the compiler has support for inlining
26 # the builtin __sync_val_compare_and_swap. If it does then we should have no
27 # problem building for i386.
28 LIBC_COMPILER_BUILTIN_INLINED(
29   [__sync_val_compare_and_swap],
30   [int a, b, c; __sync_val_compare_and_swap (&a, b, c);],
31   [-O0],
32   [libc_cv_unsupported_i386=no],
33   [AC_MSG_ERROR([
34 *** Building with -march=i386/-mcpu=i386 is not supported.
35 *** Please use host i786, i686, i586, or i486.
36 *** For example: /source/glibc/configure CFLAGS='-O2 -march=i686' ...])])
38 dnl Check if linker can convert "movl main@GOT(%ebx), %eax" to
39 dnl "leal main@GOTOFF(%ebx), %eax" for static PIE.
40 if test "$static_pie" = yes; then
41   AC_CACHE_CHECK(for linker static PIE support, libc_cv_ld_static_pie, [dnl
42 cat > conftest.s <<\EOF
43         .text
44         .global _start
45 _start:
46         movl    _start@GOT(%ebx), %eax
47 EOF
48   libc_cv_pie_option="-Wl,-pie"
49   libc_cv_ld_static_pie=no
50   if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD); then
51     if $READELF -r conftest | grep 'There are no relocations in this file.' > /dev/null; then
52       libc_cv_ld_static_pie=yes
53     fi
54   fi
55 rm -f conftest*])
56   if test "$libc_cv_ld_static_pie" != yes; then
57     AC_MSG_ERROR([linker support for static PIE needed])
58   fi
61 dnl When multi-arch is enabled, all external functions must be called
62 dnl via PIC PLT in PIE, which requires setting up EBX register.
63 if test x"$multi_arch" != xno; then
64   AC_DEFINE(NO_HIDDEN_EXTERN_FUNC_IN_PIE)