Skip to content
This repository was archived by the owner on Oct 31, 2021. It is now read-only.

Commit 8bb5a13

Browse files
Vainilla dyld
0 parents  commit 8bb5a13

File tree

1,428 files changed

+346552
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,428 files changed

+346552
-0
lines changed

APPLE_LICENSE

+367
Large diffs are not rendered by default.

bin/expand.rb

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'yaml'
4+
5+
if ENV["DRIVERKITROOT"]
6+
$availCmd = ENV["SDKROOT"] + ENV["DRIVERKITROOT"] + "/usr/local/libexec/availability.pl";
7+
else
8+
$availCmd = ENV["SDKROOT"] + "/usr/local/libexec/availability.pl";
9+
end
10+
11+
def versionString(vers)
12+
uvers = ""
13+
if vers =~ /^(\d+)$/
14+
uvers = "#{$1}_0"
15+
elsif vers =~ /^(\d+).(\d+)$/
16+
uvers = "#{$1}_#{$2}"
17+
elsif vers =~ /^(\d+).(\d+).(\d+)$/
18+
if $3 == 0
19+
uvers = "#{$1}_#{$2}"
20+
else
21+
uvers = "#{$1}_#{$2}_#{$3}"
22+
end
23+
end
24+
uvers
25+
end
26+
27+
def versionHex(vers)
28+
major = 0;
29+
minor = 0;
30+
revision = 0;
31+
32+
if vers =~ /^(\d+)$/
33+
major = $1.to_i;
34+
elsif vers =~ /^(\d+).(\d+)$/
35+
major = $1.to_i;
36+
minor = $2.to_i;
37+
elsif vers =~ /^(\d+).(\d+).(\d+)$/
38+
major = $1.to_i;
39+
minor = $2.to_i;
40+
revision = $3.to_i;
41+
end
42+
"0x00#{major.to_s(16).rjust(2, '0')}#{minor.to_s(16).rjust(2, '0')}#{revision.to_s(16).rjust(2, '0')}"
43+
end
44+
45+
def expandVersions(prefix, arg)
46+
versionList = `#{$availCmd} #{arg}`.gsub(/\s+/m, ' ').strip.split(" ")
47+
versionList.each { |version|
48+
puts "#define #{prefix}#{versionString(version)}".ljust(48, ' ') + versionHex(version)
49+
}
50+
end
51+
52+
def expandPlatformVersions(prefix, platform, arg)
53+
versionList = `#{$availCmd} #{arg}`.gsub(/\s+/m, ' ').strip.split(" ")
54+
versionList.each { |version|
55+
puts "static dyld_build_version_t dyld_platform_version_#{prefix}_#{versionString(version)}".ljust(72, ' ') + "= { .platform = #{platform}, .version = #{versionHex(version)} };"
56+
}
57+
end
58+
59+
def versionSetsForOSes(versionSets, key, platform, target)
60+
puts "#if #{target}"
61+
versionSets.each { |k,v|
62+
puts "#define dyld_#{k}_os_versions dyld_platform_version_#{platform}_#{versionString(v[key].to_s)}"
63+
}
64+
puts "#endif /* #{target} */"
65+
end
66+
67+
def expandVersionSets()
68+
versionSets = YAML.load(`#{$availCmd} --sets`)
69+
versionSetsForOSes(versionSets, "macos", "macOS", "TARGET_OS_OSX")
70+
versionSetsForOSes(versionSets, "ios", "iOS", "TARGET_OS_IOS")
71+
versionSetsForOSes(versionSets, "tvos", "tvOS", "TARGET_OS_TV")
72+
versionSetsForOSes(versionSets, "watchos", "watchOS", "TARGET_OS_WATCH")
73+
versionSetsForOSes(versionSets, "bridgeos", "bridgeOS", "TARGET_OS_BRIDGE")
74+
end
75+
76+
ARGF.each do |line|
77+
if line =~ /^\/\/\@MAC_VERSION_DEFS\@$/
78+
expandVersions("DYLD_MACOSX_VERSION_", "--macosx")
79+
elsif line =~ /^\/\/\@IOS_VERSION_DEFS\@$/
80+
expandVersions("DYLD_IOS_VERSION_", "--ios")
81+
elsif line =~ /^\/\/\@WATCHOS_VERSION_DEFS\@$/
82+
expandVersions("DYLD_WATCHOS_VERSION_", "--watchos")
83+
elsif line =~ /^\/\/\@TVOS_VERSION_DEFS\@$/
84+
expandVersions("DYLD_TVOS_VERSION_", "--appletvos")
85+
elsif line =~ /^\/\/\@BRIDGEOS_VERSION_DEFS\@$/
86+
expandVersions("DYLD_BRIDGEOS_VERSION_", "--bridgeos")
87+
elsif line =~ /^\/\/\@MACOS_PLATFORM_VERSION_DEFS\@$/
88+
expandPlatformVersions("macOS", "PLATFORM_MACOS", "--macosx")
89+
elsif line =~ /^\/\/\@IOS_PLATFORM_VERSION_DEFS\@$/
90+
expandPlatformVersions("iOS", "PLATFORM_IOS", "--ios")
91+
elsif line =~ /^\/\/\@WATCHOS_PLATFORM_VERSION_DEFS\@$/
92+
expandPlatformVersions("watchOS", "PLATFORM_WATCHOS", "--watchos")
93+
elsif line =~ /^\/\/\@TVOS_PLATFORM_VERSION_DEFS\@$/
94+
expandPlatformVersions("tvOS", "PLATFORM_TVOS", "--appletvos")
95+
elsif line =~ /^\/\/\@BRIDGEOS_PLATFORM_VERSION_DEFS\@$/
96+
expandPlatformVersions("bridgeOS", "PLATFORM_BRIDGEOS", "--bridgeos")
97+
elsif line =~ /^\/\/\@VERSION_SET_DEFS\@$/
98+
expandVersionSets()
99+
else
100+
puts line
101+
end
102+
end

bin/set-alt-dyld

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/perl -w
2+
3+
use strict;
4+
undef $/;
5+
6+
if(@ARGV == 0)
7+
{
8+
print "Usage: $0 <macho-executable> [<macho-executable> ...]\n";
9+
exit 1;
10+
}
11+
12+
my $arg;
13+
foreach $arg (@ARGV)
14+
{
15+
open IN, "<$arg" or die $!;
16+
my $in = <IN>;
17+
close IN or die $!;
18+
19+
if($in =~ s{/usr/lib/dyld}{/usr/local/dy})
20+
{
21+
open OUT, ">$arg" or die $!;
22+
print OUT $in;
23+
close OUT or die $!;
24+
}
25+
else
26+
{
27+
print STDERR "ERROR: $arg\n";
28+
exit 1;
29+
}
30+
}

configs/base.xcconfig

Whitespace-only changes.

configs/closured.xcconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
CODE_SIGN_ENTITLEMENTS[sdk=embedded*] = dyld3/closured/closured_entitlements.plist

configs/dyld.xcconfig

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ALIGNMENT[arch=armv7s] = -Wl,-segalign,0x4000
2+
3+
ENTRY[sdk=*simulator*] = -Wl,-e,_start_sim
4+
ENTRY[sdk=iphoneos*] = -Wl,-e,__dyld_start
5+
ENTRY[sdk=macosx*] = -Wl,-e,__dyld_start
6+
7+
OTHER_CODE_SIGN_FLAGS[sdk=*simulator*] = --entitlements $(SRCROOT)/dyld_sim-entitlements.plist
8+
OTHER_CODE_SIGN_FLAGS[sdk=iphoneos*] =
9+
OTHER_CODE_SIGN_FLAGS[sdk=macosx*] =
10+
11+
12+
EXPORTED_SYMBOLS_FILE[sdk=*simulator*] = $(SRCROOT)/src/dyld_sim.exp
13+
EXPORTED_SYMBOLS_FILE[sdk=iphoneos*] = $(SRCROOT)/src/dyld.exp
14+
EXPORTED_SYMBOLS_FILE[sdk=macosx*] = $(SRCROOT)/src/dyld.exp
15+
16+
PRODUCT_NAME[sdk=*simulator*] = dyld_sim
17+
PRODUCT_NAME[sdk=iphoneos*] = dyld
18+
PRODUCT_NAME[sdk=macosx*] = dyld
19+
20+
INSTALL_PATH = /usr/lib
21+
22+
//:configuration = Debug
23+
GCC_PREPROCESSOR_DEFINITIONS = DYLD_VERSION=$(RC_ProjectSourceVersion) BUILDING_DYLD=1 DEBUG=1
24+
25+
//:configuration = Release
26+
GCC_PREPROCESSOR_DEFINITIONS = DYLD_VERSION=$(RC_ProjectSourceVersion) BUILDING_DYLD=1

configs/libdyld.xcconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
LIBSYSTEM_LIBS[sdk=*simulator*] = -Wl,-upward-lsystem_sim_platform -Wl,-upward-lsystem_malloc -Wl,-upward-lsystem_c -Wl,-upward-lsystem_sim_pthread -Wl,-upward-lxpc -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_sim_kernel -Wl,-upward-lsystem_sandbox -Wl,-upward-ldispatch -Wl,-upward-lcorecrypto -Wl,-upward-lcompiler_rt
3+
LIBSYSTEM_LIBS[sdk=embedded*] = -Wl,-upward-lsystem_platform -Wl,-upward-lsystem_malloc -Wl,-upward-lsystem_c -Wl,-upward-lsystem_pthread -Wl,-upward-lxpc -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_kernel -Wl,-upward-lsystem_sandbox -Wl,-upward-ldispatch -Wl,-upward-lcorecrypto -Wl,-upward-lcompiler_rt
4+
LIBSYSTEM_LIBS[sdk=macosx*] = -Wl,-upward-lsystem_platform -Wl,-upward-lsystem_malloc -Wl,-upward-lsystem_c -Wl,-upward-lsystem_pthread -Wl,-upward-lxpc -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_kernel -Wl,-upward-lsystem_sandbox -Wl,-upward-ldispatch -Wl,-upward-lcorecrypto -Wl,-upward-lcompiler_rt
5+
LIBSYSTEM_LIBS[sdk=driverkit*] = -Wl,-upward-lsystem_platform -Wl,-upward-lsystem_malloc -Wl,-upward-lsystem_c -Wl,-upward-lsystem_pthread -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_kernel -Wl,-upward-lcompiler_rt
6+
7+
INSTALL_PATH = /usr/lib/system
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
#include "<DEVELOPER_DIR>/AppleInternal/XcodeConfig/PlatformSupportHost.xcconfig"
3+
4+
5+
//:configuration = Debug
6+
GCC_PREPROCESSOR_DEFINITIONS = BUILDING_CACHE_BUILDER=1 DEBUG=1
7+
8+
//:configuration = Release
9+
GCC_PREPROCESSOR_DEFINITIONS = BUILDING_CACHE_BUILDER=1

0 commit comments

Comments
 (0)