configure: Don't use -no-pie flag with LLVM

This commit is contained in:
Matt Borgerson 2024-12-28 15:25:13 -07:00 committed by mborgerson
parent 6ee1639c82
commit 2c722c8661
1 changed files with 11 additions and 4 deletions

15
configure vendored
View File

@ -1333,6 +1333,13 @@ EOF
# Meson currently only handles pie as a boolean for now so if we have
# explicitly disabled PIE we need to extend our cflags because it wont.
if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1; then
NO_PIE_LDFLAG=""
else
NO_PIE_LDFLAG="-no-pie"
fi
if test "$static" = "yes"; then
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
@ -1341,13 +1348,13 @@ if test "$static" = "yes"; then
error_exit "-static-pie not available due to missing toolchain support"
else
pie="no"
QEMU_CFLAGS="-fno-pie -no-pie $QEMU_CFLAGS"
QEMU_CFLAGS="-fno-pie $NO_PIE_LDFLAG $QEMU_CFLAGS"
fi
elif test "$pie" = "no"; then
if compile_prog "-Werror -fno-pie" "-no-pie"; then
if compile_prog "-Werror -fno-pie" $NO_PIE_LDFLAG; then
CONFIGURE_CFLAGS="-fno-pie $CONFIGURE_CFLAGS"
CONFIGURE_LDFLAGS="-no-pie $CONFIGURE_LDFLAGS"
QEMU_CFLAGS="-fno-pie -no-pie $QEMU_CFLAGS"
CONFIGURE_LDFLAGS="$NO_PIE_LDFLAG $CONFIGURE_LDFLAGS"
QEMU_CFLAGS="-fno-pie $NO_PIE_LDFLAG $QEMU_CFLAGS"
fi
elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"