Skip to content

Commit

Permalink
Pass SDK root to the linker as -isysroot, not -Wl,-syslibroot
Browse files Browse the repository at this point in the history
The former option to clang will result in more options to the linker,
such as the newly introduced -platform_version, which writes the
SDK version to the resulting binary. By using the syslibroot flag
directly we were missing the platform version, and binaries were
left without an SDK version set, resulting in failed validation
of the binary. Going with the clang driver gives us the right
behavior for free.

Fixes: QTBUG-83100
Change-Id: I98bc9ba644dae4bcc7a6a88481556bae185ce5fa
Reviewed-by: Simon Hausmann <[email protected]>
Reviewed-by: Timur Pocheptsov <[email protected]>
(cherry picked from commit 6a60192)
Reviewed-by: Tor Arne Vestbø <[email protected]>
  • Loading branch information
torarnv committed Apr 2, 2020
1 parent 53ed635 commit 6387138
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,9 @@ macSDKify()
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
echo "$var=$val"
;;
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*)
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*)
echo "$line -isysroot $sysroot $version_min_flag"
;;
QMAKE_LFLAGS=*)
echo "$line -Wl,-syslibroot,$sysroot $version_min_flag"
;;
*)
echo "$line"
;;
Expand Down
4 changes: 2 additions & 2 deletions mkspecs/features/mac/default_post.prf
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ macx-xcode {
-isysroot$$xcodeSDKInfo(Path, $$sdk)
QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
-Xarch_$${arch} \
-Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
-isysroot$$xcodeSDKInfo(Path, $$sdk)

QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
Expand All @@ -222,7 +222,7 @@ macx-xcode {
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_path $$version_min_flag
QMAKE_LFLAGS += -isysroot $$sysroot_path $$version_min_flag
}

# Enable precompiled headers for multiple architectures
Expand Down

0 comments on commit 6387138

Please sign in to comment.