diff options
author | Sam Bingner <sam@bingner.com> | 2019-12-19 18:05:41 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-12-19 18:05:41 -1000 |
commit | 40ab2d5572cf8b77065a73ec2b40e9e47afcb7a3 (patch) | |
tree | 3ff52888d53783ed321c22d7ada40dba18a6dcce /data | |
parent | e9c5d02e14b87f22c28605169df783feb8de7898 (diff) |
Update ld64 to support arm64e
Diffstat (limited to 'data')
l--------- | data/ld64/_metadata/_llvm10.dep | 1 | ||||
-rw-r--r-- | data/ld64/_metadata/depends | 1 | ||||
l--------- | data/ld64/_metadata/libtapi.dep | 1 | ||||
l--------- | data/ld64/_metadata/llvm-clang.dep | 1 | ||||
-rw-r--r-- | data/ld64/arm64e.diff | 135 | ||||
-rw-r--r-- | data/ld64/errnotapi.diff | 12 | ||||
-rw-r--r-- | data/ld64/make.sh | 2 | ||||
-rw-r--r-- | data/ld64/makefile.diff | 2 | ||||
-rw-r--r-- | data/ld64/typos.diff | 65 |
9 files changed, 151 insertions, 69 deletions
diff --git a/data/ld64/_metadata/_llvm10.dep b/data/ld64/_metadata/_llvm10.dep new file mode 120000 index 000000000..6e1043dea --- /dev/null +++ b/data/ld64/_metadata/_llvm10.dep @@ -0,0 +1 @@ +../../_llvm10
\ No newline at end of file diff --git a/data/ld64/_metadata/depends b/data/ld64/_metadata/depends new file mode 100644 index 000000000..54fa59262 --- /dev/null +++ b/data/ld64/_metadata/depends @@ -0,0 +1 @@ +liblto10, libtapi10 diff --git a/data/ld64/_metadata/libtapi.dep b/data/ld64/_metadata/libtapi.dep deleted file mode 120000 index 5c5ceb1d6..000000000 --- a/data/ld64/_metadata/libtapi.dep +++ /dev/null @@ -1 +0,0 @@ -../../libtapi
\ No newline at end of file diff --git a/data/ld64/_metadata/llvm-clang.dep b/data/ld64/_metadata/llvm-clang.dep deleted file mode 120000 index cc064c14a..000000000 --- a/data/ld64/_metadata/llvm-clang.dep +++ /dev/null @@ -1 +0,0 @@ -../../llvm-clang
\ No newline at end of file diff --git a/data/ld64/arm64e.diff b/data/ld64/arm64e.diff new file mode 100644 index 000000000..0b76998d2 --- /dev/null +++ b/data/ld64/arm64e.diff @@ -0,0 +1,135 @@ +diff -ur ld64-450.3/src/abstraction/MachOFileAbstraction.hpp ld64-450.3+iOS/src/abstraction/MachOFileAbstraction.hpp +--- ld64-450.3/src/abstraction/MachOFileAbstraction.hpp 2019-04-09 13:33:07.000000000 -1000 ++++ ld64-450.3+iOS/src/abstraction/MachOFileAbstraction.hpp 2019-12-09 16:47:35.000000000 -1000 +@@ -667,6 +667,9 @@ + #if SUPPORT_ARCH_arm64v8 + { "arm64v8", CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_V8, "arm64v8-", "aarch64-", true, false }, + #endif ++#if SUPPORT_ARCH_arm64e ++ { "arm64e", CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64E, "arm64e-", "aarch64-", true, false }, ++#endif + { NULL, 0, 0, NULL, NULL, false, false } + }; + +diff -ur ld64-450.3/src/create_configure ld64-450.3+iOS/src/create_configure +--- ld64-450.3/src/create_configure 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/create_configure 2019-12-09 16:46:32.000000000 -1000 +@@ -11,12 +11,12 @@ + fi + + if [ -z "${RC_SUPPORTED_ARCHS}" ]; then +- RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64" ++ RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64 arm64e" + fi + + for ANARCH in ${RC_SUPPORTED_ARCHS} + do +- KNOWN_ARCHS=",armv4t,armv5,armv6,armv7,armv7f,armv7k,armv7s,armv6m,armv7m,armv7em,armv8,arm64,arm64v8,i386,x86_64,x86_64h," ++ KNOWN_ARCHS=",armv4t,armv5,armv6,armv7,armv7f,armv7k,armv7s,armv6m,armv7m,armv7em,armv8,arm64,arm64v8,arm64e,i386,x86_64,x86_64h," + FOUND=`echo "$KNOWN_ARCHS" | grep ",$ANARCH,"` + if [ $FOUND ]; then + echo "#define SUPPORT_ARCH_$ANARCH 1" >> ${DERIVED_FILE_DIR}/configure.h +diff -ur ld64-450.3/src/ld/Architectures.hpp ld64-450.3+iOS/src/ld/Architectures.hpp +--- ld64-450.3/src/ld/Architectures.hpp 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/ld/Architectures.hpp 2019-12-09 16:46:32.000000000 -1000 +@@ -61,7 +61,10 @@ + typedef Pointer64<LittleEndian> P; + }; + +- ++struct arm64e ++{ ++ typedef Pointer64<LittleEndian> P; ++}; + + #endif // __ARCHITECTURES__ + +diff -ur ld64-450.3/src/ld/Options.cpp ld64-450.3+iOS/src/ld/Options.cpp +--- ld64-450.3/src/ld/Options.cpp 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/ld/Options.cpp 2019-12-09 16:46:32.000000000 -1000 +@@ -621,14 +621,14 @@ + if ( platforms().contains(ld::kPlatform_iOS) && (platforms().minOS(ld::kPlatform_iOS) == 0) && (fOutputKind != Options::kObjectFile) ) { + #if defined(DEFAULT_IPHONEOS_MIN_VERSION) + warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION); +- setVersionMin(ld::kPlatformiOS, DEFAULT_IPHONEOS_MIN_VERSION); ++ setVersionMin(ld::kPlatform_iOS, DEFAULT_IPHONEOS_MIN_VERSION); + #else + warning("-ios_version_min not specified, assuming 6.0"); + setVersionMin(ld::kPlatform_iOS, "6.0"); + #endif + } + #if SUPPORT_ARCH_arm64e +- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) { ++ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) { + fSupportsAuthenticatedPointers = true; + } + #endif +@@ -4412,7 +4412,7 @@ + if ( (fOutputKind != Options::kObjectFile) && (fOutputKind != Options::kPreload) ) { + #if defined(DEFAULT_IPHONEOS_MIN_VERSION) + warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION); +- setVersionMin(ld::kPlatformiOS, DEFAULT_IPHONEOS_MIN_VERSION); ++ setVersionMin(ld::kPlatform_iOS, DEFAULT_IPHONEOS_MIN_VERSION); + #else + if ( fSubArchitecture == CPU_SUBTYPE_ARM_V7K ) { + warning("-watchos_version_min not specified, assuming 2.0"); +@@ -4749,7 +4749,7 @@ + break; + case Options::kDyld: + // arm64e has support for compressed LINKEDIT. +- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) ++ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) + break; + case Options::kPreload: + case Options::kStaticExecutable: +@@ -4814,7 +4814,7 @@ + + if (fArchitecture == CPU_TYPE_ARM64) { + #if SUPPORT_ARCH_arm64e +- if (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ++ if (fSubArchitecture == CPU_SUBTYPE_ARM64E) + { + // FIXME: Move some of these to arm64 + fNoLazyBinding = true; +@@ -4873,7 +4873,7 @@ + fUseLinkedListBinding = true; + fNoLazyBinding = true; + #if SUPPORT_ARCH_arm64e +- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) ++ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) + fSupportsAuthenticatedPointers = true; + #endif + break; +@@ -5267,7 +5267,7 @@ + } + else if ( platforms().minOS(ld::iOS_10_0) ) { + #if SUPPORT_ARCH_arm64e +- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) { ++ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) { + fUnalignedPointerTreatment = Options::kUnalignedPointerError; + } else + #endif +diff -ur ld64-450.3/src/ld/passes/objc.cpp ld64-450.3+iOS/src/ld/passes/objc.cpp +--- ld64-450.3/src/ld/passes/objc.cpp 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/ld/passes/objc.cpp 2019-12-09 16:46:32.000000000 -1000 +@@ -1322,7 +1322,7 @@ + #if SUPPORT_ARCH_arm64 + case CPU_TYPE_ARM64: + #if SUPPORT_ARCH_arm64e +- if (opts.subArchitecture() == CPU_SUBTYPE_ARM64_E) { ++ if (opts.subArchitecture() == CPU_SUBTYPE_ARM64E) { + doPass<arm64e, true>(opts, state); + break; + } +diff -ur ld64-450.3/src/ld/passes/stubs/stubs.cpp ld64-450.3+iOS/src/ld/passes/stubs/stubs.cpp +--- ld64-450.3/src/ld/passes/stubs/stubs.cpp 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/ld/passes/stubs/stubs.cpp 2019-12-09 16:46:32.000000000 -1000 +@@ -235,7 +235,7 @@ + #if SUPPORT_ARCH_arm64 + case CPU_TYPE_ARM64: + #if SUPPORT_ARCH_arm64e +- if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM64_E) && _options.useAuthenticatedStubs() ) { ++ if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM64E) && _options.useAuthenticatedStubs() ) { + if ( (_options.outputKind() == Options::kKextBundle) && _options.kextsUseStubs() ) + return new ld::passes::stubs::arm64e::NonLazyStubAtom(*this, target, weakImport); + else if ( usingCompressedLINKEDIT() && !forLazyDylib && _options.noLazyBinding() && !stubToResolver ) diff --git a/data/ld64/errnotapi.diff b/data/ld64/errnotapi.diff new file mode 100644 index 000000000..3d8ef7076 --- /dev/null +++ b/data/ld64/errnotapi.diff @@ -0,0 +1,12 @@ +diff -ur ld64-450.3/src/ld/Options.cpp ld64-450.3+iOS/src/ld/Options.cpp +--- ld64-450.3/src/ld/Options.cpp 2019-04-09 13:33:08.000000000 -1000 ++++ ld64-450.3+iOS/src/ld/Options.cpp 2019-12-19 16:59:45.000000000 -1000 +@@ -852,6 +852,8 @@ + fTAPIFiles.emplace_back(interface, path, name.c_str()); + } + } ++#else ++#error WHERE IS MY TAPI! + #endif + } + diff --git a/data/ld64/make.sh b/data/ld64/make.sh index 2899de1e8..36975e9b2 100644 --- a/data/ld64/make.sh +++ b/data/ld64/make.sh @@ -1,5 +1,5 @@ pkg:setup -pkg:make VERSION="$(pkg: cat %/_metadata/version)" LDFLAGS="-L$(PKG_DEST_ llvm-clang)/usr/local/lib" +pkg:make VERSION="$(pkg: cat %/_metadata/version)" LDFLAGS="-L$(PKG_DEST_ _llvm10)/usr/lib/llvm-10/lib" pkg:install pkg: mkdir -p /usr/libexec pkg: mv /usr/bin/ld64 /usr/libexec/ld64 diff --git a/data/ld64/makefile.diff b/data/ld64/makefile.diff index a8775e620..517791a30 100644 --- a/data/ld64/makefile.diff +++ b/data/ld64/makefile.diff @@ -19,7 +19,7 @@ diff -uNr ld64-274.2/Makefile ld64-274.2+iPhone/Makefile + mkdir include + +include/configure.h: include -+ DERIVED_FILE_DIR="$(DERIVED_FILE_DIR)" IPHONEOS_DEPLOYMENT_TARGET="11.0" src/create_configure ++ DERIVED_FILE_DIR="$(DERIVED_FILE_DIR)" IPHONEOS_DEPLOYMENT_TARGET="7.0" src/create_configure + +include/compile_stubs.h: include + echo "static const char *compile_stubs = " > $(DERIVED_FILE_DIR)/compile_stubs.h diff --git a/data/ld64/typos.diff b/data/ld64/typos.diff deleted file mode 100644 index 72ade08e2..000000000 --- a/data/ld64/typos.diff +++ /dev/null @@ -1,65 +0,0 @@ -diff -ur ld64-450.3/src/ld/Options.cpp ld64-450.3+iOS/src/ld/Options.cpp ---- ld64-450.3/src/ld/Options.cpp 2019-04-09 13:33:08.000000000 -1000 -+++ ld64-450.3+iOS/src/ld/Options.cpp 2019-12-02 11:30:53.000000000 -1000 -@@ -621,14 +621,14 @@ - if ( platforms().contains(ld::kPlatform_iOS) && (platforms().minOS(ld::kPlatform_iOS) == 0) && (fOutputKind != Options::kObjectFile) ) { - #if defined(DEFAULT_IPHONEOS_MIN_VERSION) - warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION); -- setVersionMin(ld::kPlatformiOS, DEFAULT_IPHONEOS_MIN_VERSION); -+ setVersionMin(ld::kPlatform_iOS, DEFAULT_IPHONEOS_MIN_VERSION); - #else - warning("-ios_version_min not specified, assuming 6.0"); - setVersionMin(ld::kPlatform_iOS, "6.0"); - #endif - } - #if SUPPORT_ARCH_arm64e -- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) { -+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) { - fSupportsAuthenticatedPointers = true; - } - #endif -@@ -4412,7 +4412,7 @@ - if ( (fOutputKind != Options::kObjectFile) && (fOutputKind != Options::kPreload) ) { - #if defined(DEFAULT_IPHONEOS_MIN_VERSION) - warning("-ios_version_min not specified, assuming " DEFAULT_IPHONEOS_MIN_VERSION); -- setVersionMin(ld::kPlatformiOS, DEFAULT_IPHONEOS_MIN_VERSION); -+ setVersionMin(ld::kPlatform_iOS, DEFAULT_IPHONEOS_MIN_VERSION); - #else - if ( fSubArchitecture == CPU_SUBTYPE_ARM_V7K ) { - warning("-watchos_version_min not specified, assuming 2.0"); -@@ -4749,7 +4749,7 @@ - break; - case Options::kDyld: - // arm64e has support for compressed LINKEDIT. -- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) -+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) - break; - case Options::kPreload: - case Options::kStaticExecutable: -@@ -4814,7 +4814,7 @@ - - if (fArchitecture == CPU_TYPE_ARM64) { - #if SUPPORT_ARCH_arm64e -- if (fSubArchitecture == CPU_SUBTYPE_ARM64_E) -+ if (fSubArchitecture == CPU_SUBTYPE_ARM64E) - { - // FIXME: Move some of these to arm64 - fNoLazyBinding = true; -@@ -4873,7 +4873,7 @@ - fUseLinkedListBinding = true; - fNoLazyBinding = true; - #if SUPPORT_ARCH_arm64e -- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) -+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) - fSupportsAuthenticatedPointers = true; - #endif - break; -@@ -5267,7 +5267,7 @@ - } - else if ( platforms().minOS(ld::iOS_10_0) ) { - #if SUPPORT_ARCH_arm64e -- if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64_E) ) { -+ if ( (fArchitecture == CPU_TYPE_ARM64) && (fSubArchitecture == CPU_SUBTYPE_ARM64E) ) { - fUnalignedPointerTreatment = Options::kUnalignedPointerError; - } else - #endif |