diff options
author | Andrew Childs <lorne@cons.org.nz> | 2021-01-31 15:12:28 +0900 |
---|---|---|
committer | Andrew Childs <lorne@cons.org.nz> | 2021-04-11 09:47:09 +0900 |
commit | 6605fadc687b2e3f3f3d611556ba36ff30eaf612 (patch) | |
tree | 3c6aa831dedd56c1a8033028daccaf7606ca0f68 /pkgs/build-support/bintools-wrapper/ld-wrapper.sh | |
parent | 44f09ccabf645d1f079f71b541d7f1ac0a6b8848 (diff) |
bintools-wrapper: default platform versions for darwin
Instead of always supplying flags, apply the flags as defaults. Use clang's native flags instead of lifting the linker flags from binutils with `-Wl,`. If a project is using clang to drive linking, make clang do the right thing with MACOSX_DEPLOYMENT_TARGET. This can be overridden by command line arguments. This will cause modern clang to pass `-platform_version 10.12 0.0.0`, since it doesn't know about the SDK settings. Older versions of clang will pass down `-macos_version_min` flags with no sdk version. At the linker layer, apply a default value for anything left ambiguous. If nothing is specified, pass a full `-platform_version`. If only `-macos_version_min` is specified, then lock down the sdk_version explicitly with `-sdk_version`. If a min version and sdk version is passed, do nothing.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/ld-wrapper.sh')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/ld-wrapper.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index 9d02f99851a57..7ccf5510c8808 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -78,6 +78,14 @@ fi extraAfter+=($NIX_LDFLAGS_AFTER_@suffixSalt@) +# These flags *must not* be pulled up to -Wl, flags, so they can't go in +# add-flags.sh. They must always be set, so must not be disabled by +# NIX_LDFLAGS_SET. +if [ -e @out@/nix-support/add-local-ldflags-before.sh ]; then + source @out@/nix-support/add-local-ldflags-before.sh +fi + + # Specify the target emulation if nothing is passed in ("-m" overrides this # environment variable). Ensures we never blindly fallback on targeting the host # platform. |