diff options
author | Sitsofe Wheeler <sitsofe@yahoo.com> | 2020-12-23 11:58:02 +0000 |
---|---|---|
committer | Sitsofe Wheeler <sitsofe@yahoo.com> | 2020-12-26 16:31:47 +0000 |
commit | b6a1e63a1ff607692a3caf3c2db2c3d575ba2320 (patch) | |
tree | b4b59ad58f6f5f49025a3b8dc0acd07461fb8aef /configure | |
parent | ced224611b039df68ceebde4733269f4f6606912 (diff) | |
download | fio-b6a1e63a1ff607692a3caf3c2db2c3d575ba2320.tar.gz fio-b6a1e63a1ff607692a3caf3c2db2c3d575ba2320.tar.bz2 |
configure: fix compilation on recent macOS Xcode versions
Back in ccf2d89d39b21bc8c7b497b40be5b82eadb80863 ("configure: try to
disable weak linking on OSX") disabling weak symbols was done to prevent
depending on features when building on a newer macOS but targeting an
older one. Fast-forward to Xcode 11.4 and it turns out Apple have broken
this by depending on weak symbols for critical symbols like FD_SET
leading to compilation errors like the following
ld: weak import of symbol '___darwin_check_fd_set_overflow' not supported because of option: -no_weak_imports for architecture x86_64
Other people/projects have been hit by this issue:
- https://openradar.appspot.com/FB7647406
- https://github.com/mono/mono/issues/19393
but Apple have kept this behaviour into XCode 12 so we should adapt.
- Introduce the concept of configure only CFLAGS
- Switch to using -Werror=partial-availability with the above
- Stop logging a message about disabling weak linking
The above should avoid finding features the target platform doesn't have
while allowing weak linking. The name CONFIGURE_CFLAGS is used to remain
similar to QEMU's configure. Fingers crossed this approach stays
supported by Apple...
Fixes https://github.com/axboe/fio/issues/1006
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -45,6 +45,7 @@ print_config() { # Default CFLAGS CFLAGS="-D_GNU_SOURCE -include config-host.h $CFLAGS" +CONFIGURE_CFLAGS="-Werror-implicit-function-declaration" BUILD_CFLAGS="" # Print a helpful header at the top of config.log @@ -88,14 +89,14 @@ do_cc() { } compile_object() { - do_cc $CFLAGS -Werror-implicit-function-declaration -c -o $TMPO $TMPC + do_cc $CFLAGS $CONFIGURE_CFLAGS -c -o $TMPO $TMPC } compile_prog() { local_cflags="$1" local_ldflags="$2 $LIBS" echo "Compiling test case $3" >> config.log - do_cc $CFLAGS -Werror-implicit-function-declaration $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags + do_cc $CFLAGS $CONFIGURE_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags } feature_not_found() { @@ -360,16 +361,15 @@ Darwin) if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then cpu="x86_64" fi - # Error at compile time linking of weak/partial symbols if possible... + # Avoid configure feature detection of features provided by weak symbols cat > $TMPC <<EOF int main(void) { return 0; } EOF - if compile_prog "" "-Wl,-no_weak_imports" "disable weak symbols"; then - echo "Disabling weak symbols" - LDFLAGS="$LDFLAGS -Wl,-no_weak_imports" + if compile_prog "" "-Werror=partial-availability" "error on weak symbols"; then + CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Werror=partial-availability" fi ;; SunOS) |