wrappers: For UWP, pass the default -lwindowsapp after user specified options
This matches how the compiler driver normally includes default linked libraries; the user provided -l flags are passed first, followed by the compiler's default ones. That allows a user specified library to override the default ones. This makes sure that if a user provides -lwindowsappcompat, it gets linked before -lwindowsapp, which makes a difference for symbols that are provided in both (such as e.g. LoadLibraryW).
This commit is contained in:
1 parent
e76e935c7d
commit
56fec2622f
2 files changed
+25
-9
No files matched your search
@@ -71,6 +71,7 @@ aarch64)
|
||||
# SEH is the default for aarch64.
|
||||
;;
|
||||
esac
|
||||
LINKER_FLAGS=""
|
||||
case $TARGET_OS in
|
||||
mingw32uwp)
|
||||
# the UWP target is for Windows 10
|
||||
@@ -79,11 +80,18 @@ mingw32uwp)
|
||||
FLAGS="$FLAGS -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
|
||||
# the Windows Store API only supports Windows Unicode (some rare ANSI ones are available)
|
||||
FLAGS="$FLAGS -DUNICODE"
|
||||
|
||||
# Default linker flags; passed after any user specified -l options,
|
||||
# to let the user specified libraries take precedence over these.
|
||||
|
||||
# add the minimum runtime to use for UWP targets
|
||||
FLAGS="$FLAGS -Wl,-lwindowsapp"
|
||||
LINKER_FLAGS="$LINKER_FLAGS --start-no-unused-arguments"
|
||||
LINKER_FLAGS="$LINKER_FLAGS -Wl,-lwindowsapp"
|
||||
# This still requires that the toolchain (in particular, libc++.a) has
|
||||
# been built targeting UCRT originally.
|
||||
FLAGS="$FLAGS -Wl,-lucrtapp"
|
||||
LINKER_FLAGS="$LINKER_FLAGS -Wl,-lucrtapp"
|
||||
LINKER_FLAGS="$LINKER_FLAGS --end-no-unused-arguments"
|
||||
|
||||
# Force the Universal C Runtime
|
||||
FLAGS="$FLAGS -D_UCRT"
|
||||
;;
|
||||
@@ -96,4 +104,4 @@ FLAGS="$FLAGS -stdlib=libc++"
|
||||
FLAGS="$FLAGS -fuse-ld=lld"
|
||||
FLAGS="$FLAGS --end-no-unused-arguments"
|
||||
|
||||
$CCACHE "$CLANG" $FLAGS "$@"
|
||||
$CCACHE "$CLANG" $FLAGS "$@" $LINKER_FLAGS
|
||||
Reference in new issue
Block a user