diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-09-28 10:41:29 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-10-18 10:01:02 +0200 |
commit | 2e938a9a6145be52488af74949d49a60ce8baaad (patch) | |
tree | 146de7c1e278898eef7ca76f564c1fe3671dd476 /configure | |
parent | 39fb3cfc28baac007ea8dafaf7a2c22c44faba19 (diff) |
configure: clean up PIE option handling
Keep together all the conditions that lead to disabling PIE.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 33 |
1 files changed, 13 insertions, 20 deletions
@@ -373,17 +373,6 @@ else targetos=bogus fi -# OS specific - -case $targetos in -windows) - pie="no" -;; -haiku) - pie="no" -;; -esac - if test ! -z "$cpu" ; then # command line argument : @@ -1088,19 +1077,23 @@ static THREAD int tls_var; int main(void) { return tls_var; } EOF -if test "$static" = "yes"; then - if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then - pie="yes" - elif test "$pie" = "yes"; then - error_exit "-static-pie not available due to missing toolchain support" +if test "$targetos" = windows || test "$targetos" = haiku; then + if test "$pie" = "yes"; then + error_exit "PIE not available due to missing OS support" + fi + pie=no +fi + +if test "$pie" != "no"; then + if test "$static" = "yes"; then + pie_ldflags=-static-pie else - pie="no" + pie_ldflags=-pie fi -elif test "$pie" != "no"; then - if compile_prog "-Werror -fPIE -DPIE" "-pie"; then + if compile_prog "-Werror -fPIE -DPIE" "$pie_ldflags"; then pie="yes" elif test "$pie" = "yes"; then - error_exit "PIE not available due to missing toolchain support" + error_exit "-static-pie not available due to missing toolchain support" else echo "Disabling PIE due to missing toolchain support" pie="no" |