From 42ab460db31fac0c95e8937b3cffb205683c7b65 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Apr 2025 11:12:07 +0530 Subject: [PATCH] Only include -fno-plt if the compiler supports it --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3944d1977..8b29f7029 100755 --- a/setup.py +++ b/setup.py @@ -500,12 +500,14 @@ def init_env( env_cflags = shlex.split(os.environ.get('CFLAGS', '')) env_cppflags = shlex.split(os.environ.get('CPPFLAGS', '')) env_ldflags = shlex.split(os.environ.get('LDFLAGS', '')) + # Newer clang does not use -fno-plt leading to an error + no_plt = '-fno-plt' if test_compile(cc, '-fno-plt', '-Werror') else '' cflags_ = os.environ.get( 'OVERRIDE_CFLAGS', ( f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {std}' f' {werror} {optimize} {sanitize_flag} -fwrapv {stack_protector} {missing_braces}' - f' -pipe -fvisibility=hidden -fno-plt' + f' -pipe -fvisibility=hidden {no_plt}' ) ) cflags = shlex.split(cflags_) + shlex.split(