mirror of
https://github.com/rui314/mold.git
synced 2024-11-11 05:46:58 +03:00
[Mach-O] Add the -platform_version option
This commit is contained in:
parent
2589190724
commit
48e7616263
@ -112,9 +112,9 @@ static std::vector<u8> create_build_version_cmd(Context &ctx) {
|
||||
|
||||
cmd.cmd = LC_BUILD_VERSION;
|
||||
cmd.cmdsize = buf.size();
|
||||
cmd.platform = PLATFORM_MACOS;
|
||||
cmd.minos = 0xb0000;
|
||||
cmd.sdk = 0xb0300;
|
||||
cmd.platform = ctx.arg.platform;
|
||||
cmd.minos = ctx.arg.platform_min_version;
|
||||
cmd.sdk = ctx.arg.platform_sdk_version;
|
||||
cmd.ntools = 1;
|
||||
|
||||
BuildToolVersion &tool = *(BuildToolVersion *)(buf.data() + sizeof(cmd));
|
||||
|
19
test/macho/platform-version.sh
Executable file
19
test/macho/platform-version.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
mold=`pwd`/../../ld64.mold
|
||||
echo -n "Testing $(basename -s .sh $0) ... "
|
||||
t=$(pwd)/../../out/test/macho/$(basename -s .sh $0)
|
||||
mkdir -p $t
|
||||
|
||||
cat <<EOF | cc -o $t/a.o -c -xc -
|
||||
int main() {}
|
||||
EOF
|
||||
|
||||
clang -fuse-ld=$mold -o $t/exe $t/a.o -Wl,-platform_version,macos,13.5,12.0
|
||||
|
||||
otool -l $t/exe > $t/log
|
||||
fgrep -q 'minos 13.5' $t/log
|
||||
fgrep -q 'sdk 12.0' $t/log
|
||||
|
||||
echo OK
|
Loading…
Reference in New Issue
Block a user