summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2019-12-02 16:57:52 -1000
committerSam Bingner <sam@bingner.com>2019-12-05 13:30:39 -1000
commitaab8977ee9f4c3b7221a4106866b4f3a79d25a61 (patch)
treee66b40c2abdc399af067d6e7a8809a12aa52a6b9
parent45864b910a6b123659347758aea1a820675851fd (diff)
Update ld64 and compile for AppleTV
-rw-r--r--data/ld64/_metadata/in.1200.000
l---------data/ld64/_metadata/llvm-clang.dep1
-rw-r--r--data/ld64/_metadata/version2
-rw-r--r--data/ld64/arch.diff15
-rw-r--r--data/ld64/baseplatform.diff49
-rw-r--r--data/ld64/ld64-274.2.tar.gzbin671652 -> 0 bytes
-rw-r--r--data/ld64/ld64-450.3.tar.gzbin0 -> 729639 bytes
-rw-r--r--data/ld64/make.sh9
-rw-r--r--data/ld64/makefile.diff8
-rw-r--r--data/ld64/thinlto.diff34
-rw-r--r--data/ld64/typos.diff75
-rw-r--r--data/ld64/version.diff44
-rw-r--r--data/ld64/wrapper.c4
13 files changed, 160 insertions, 81 deletions
diff --git a/data/ld64/_metadata/in.1200.00 b/data/ld64/_metadata/in.1200.00
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/data/ld64/_metadata/in.1200.00
diff --git a/data/ld64/_metadata/llvm-clang.dep b/data/ld64/_metadata/llvm-clang.dep
new file mode 120000
index 000000000..cc064c14a
--- /dev/null
+++ b/data/ld64/_metadata/llvm-clang.dep
@@ -0,0 +1 @@
+../../llvm-clang \ No newline at end of file
diff --git a/data/ld64/_metadata/version b/data/ld64/_metadata/version
index a159459e8..30c71e569 100644
--- a/data/ld64/_metadata/version
+++ b/data/ld64/_metadata/version
@@ -1 +1 @@
-274.2
+450.3
diff --git a/data/ld64/arch.diff b/data/ld64/arch.diff
index e4cd7ab0f..b76ed22b2 100644
--- a/data/ld64/arch.diff
+++ b/data/ld64/arch.diff
@@ -1,13 +1,12 @@
-Only in ld64-274.2+iPhone: InputFiles.o
-diff -ur ld64-274.2/src/ld/InputFiles.cpp ld64-274.2+iPhone/src/ld/InputFiles.cpp
---- ld64-274.2/src/ld/InputFiles.cpp 2016-07-01 15:46:14.000000000 -1000
-+++ ld64-274.2+iPhone/src/ld/InputFiles.cpp 2018-09-05 11:18:34.000000000 -1000
-@@ -881,6 +881,8 @@
- opts.setArchitecture(CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_ALL, Options::kPlatformOSX);
+diff -ur ld64-450.3/src/ld/InputFiles.cpp ld64-450.3+iOS/src/ld/InputFiles.cpp
+--- ld64-450.3/src/ld/InputFiles.cpp 2018-09-26 16:04:04.000000000 -1000
++++ ld64-450.3+iOS/src/ld/InputFiles.cpp 2019-12-02 11:22:19.000000000 -1000
+@@ -899,6 +899,8 @@
+ opts.setArchitecture(CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_ALL, ld::kPlatform_macOS, 0);
#elif __arm__
- opts.setArchitecture(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6, Options::kPlatformOSX);
+ opts.setArchitecture(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6, ld::kPlatform_macOS, 0);
+#elif __arm64__
-+ opts.setArchitecture(CPU_TYPE_ARM64, CPU_SUBTYPE_ARM_V8, Options::kPlatformOSX);
++ opts.setArchitecture(CPU_TYPE_ARM64, CPU_SUBTYPE_ARM_V8, ld::kPlatform_macOS, 0);
#else
#error unknown default architecture
#endif
diff --git a/data/ld64/baseplatform.diff b/data/ld64/baseplatform.diff
new file mode 100644
index 000000000..dffe05724
--- /dev/null
+++ b/data/ld64/baseplatform.diff
@@ -0,0 +1,49 @@
+diff -ur ld64-450.3/src/ld/ld.cpp ld64-450.3+iOS/src/ld/ld.cpp
+--- ld64-450.3/src/ld/ld.cpp 2018-11-02 10:15:44.000000000 -1000
++++ ld64-450.3+iOS/src/ld/ld.cpp 2019-12-02 12:00:34.000000000 -1000
+@@ -89,20 +89,6 @@
+ #include "parsers/lto_file.h"
+ #include "parsers/opaque_section_file.h"
+
+-const ld::Platform ld::basePlatform(const ld::Platform& platform) {
+- switch(platform) {
+- case ld::kPlatform_iOSMac:
+- case ld::kPlatform_iOSSimulator:
+- return ld::kPlatform_iOS;
+- case ld::kPlatform_watchOSSimulator:
+- return kPlatform_watchOS;
+- case ld::kPlatform_tvOSSimulator:
+- return ld::kPlatform_tvOS;
+- default:
+- return platform;
+- }
+-}
+-
+ const ld::VersionSet ld::File::_platforms;
+
+ struct PerformanceStatistics {
+diff -ur ld64-450.3/src/ld/ld.hpp ld64-450.3+iOS/src/ld/ld.hpp
+--- ld64-450.3/src/ld/ld.hpp 2019-04-09 13:33:08.000000000 -1000
++++ ld64-450.3+iOS/src/ld/ld.hpp 2019-12-02 12:02:30.000000000 -1000
+@@ -58,7 +58,20 @@
+ kPlatform_watchOSSimulator=9
+ };
+
+-const ld::Platform basePlatform(const ld::Platform& platform);
++inline const ld::Platform basePlatform(const ld::Platform& platform) {
++ switch(platform) {
++ case ld::kPlatform_iOSMac:
++ case ld::kPlatform_iOSSimulator:
++ return ld::kPlatform_iOS;
++ case ld::kPlatform_watchOSSimulator:
++ return kPlatform_watchOS;
++ case ld::kPlatform_tvOSSimulator:
++ return ld::kPlatform_tvOS;
++ default:
++ return platform;
++ }
++}
++
+
+ typedef std::set<Platform> PlatformSet;
+
diff --git a/data/ld64/ld64-274.2.tar.gz b/data/ld64/ld64-274.2.tar.gz
deleted file mode 100644
index 039b85144..000000000
--- a/data/ld64/ld64-274.2.tar.gz
+++ /dev/null
Binary files differ
diff --git a/data/ld64/ld64-450.3.tar.gz b/data/ld64/ld64-450.3.tar.gz
new file mode 100644
index 000000000..03f07f1b7
--- /dev/null
+++ b/data/ld64/ld64-450.3.tar.gz
Binary files differ
diff --git a/data/ld64/make.sh b/data/ld64/make.sh
index 35f143104..2899de1e8 100644
--- a/data/ld64/make.sh
+++ b/data/ld64/make.sh
@@ -1,10 +1,11 @@
pkg:setup
-pkg:make
+pkg:make VERSION="$(pkg: cat %/_metadata/version)" LDFLAGS="-L$(PKG_DEST_ llvm-clang)/usr/local/lib"
pkg:install
-pkg: mv /usr/bin/ld64 /usr/bin/ld64_
+pkg: mkdir -p /usr/libexec
+pkg: mv /usr/bin/ld64 /usr/libexec/ld64
pkg: ln -s ld64 /usr/bin/ld
pkg: "${PKG_TARG}-gcc" %/wrapper.c -o /usr/bin/ld64
if [[ -f "${PKG_BASE}/arch/${PKG_ARCH}/${PKG_CFTARG}/entitlement.xml" ]]; then
- pkg: mkdir -p /usr/share/ldid
- cp "${PKG_BASE}/arch/${PKG_ARCH}/${PKG_CFTARG}/entitlement.xml" "${PKG_DEST}/usr/share/ldid/entitlements.xml"
+ pkg: mkdir -p /usr/share/entitlements
+ cp "${PKG_BASE}/arch/${PKG_ARCH}/${PKG_CFTARG}/entitlement.xml" "${PKG_DEST}/usr/share/entitlements/ld64.xml"
fi
diff --git a/data/ld64/makefile.diff b/data/ld64/makefile.diff
index 72994fe68..a8775e620 100644
--- a/data/ld64/makefile.diff
+++ b/data/ld64/makefile.diff
@@ -29,19 +29,19 @@ diff -uNr ld64-274.2/Makefile ld64-274.2+iPhone/Makefile
+$(LD_OBJS): $(DEPS)
+
+%.cpp.o: %.cpp
-+ $(CXX) -std=c++11 -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"274.2\"
++ $(CXX) -std=c++11 -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"$(VERSION)\"
+
+%.c.o: %.c
-+ $(CC) -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"274.2\"
++ $(CC) -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"$(VERSION)\"
+
+ld64: $(LD_OBJS)
-+ $(CXX) -o $@ $^ -ltapi -lLTO -lxar
++ $(CXX) -o $@ $^ $(LDFLAGS) -ltapi -lLTO -lxar
+
+libld64.a: $(filter-out src/ld/ld.cpp.o, $(LD_OBJS))
+ ar -r libld64.a $^
+
+$(OTHERS): % : src/other/%.cpp libld64.a
-+ $(CXX) -o $@ $^ -ltapi -lLTO -lxar -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld
++ $(CXX) -std=c++11 -o $@ $^ $(LDFLAGS) -ltapi -lLTO -lxar -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld
+
+libprunetrie.a: src/other/PruneTrie.cpp.o
+ ar -r libprunetrie.a $^
diff --git a/data/ld64/thinlto.diff b/data/ld64/thinlto.diff
deleted file mode 100644
index 0466146c2..000000000
--- a/data/ld64/thinlto.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-diff -ur ld64-274.2/src/ld/parsers/lto_file.cpp ld64-274.2+iPhone/src/ld/parsers/lto_file.cpp
---- ld64-274.2/src/ld/parsers/lto_file.cpp 2016-10-21 10:04:17.000000000 -1000
-+++ ld64-274.2+iPhone/src/ld/parsers/lto_file.cpp 2018-09-05 11:48:40.000000000 -1000
-@@ -291,12 +291,14 @@
- std::vector<const ld::Atom*>& newAtoms,
- std::vector<const char*>& additionalUndefines);
-
-+#if LTO_API_VERSION >= 18
- static thinlto_code_gen_t init_thinlto_codegen(const std::vector<File*>& files,
- const std::vector<const ld::Atom*>& allAtoms,
- ld::Internal& state,
- const OptimizeOptions& options,
- CStringToAtom& deadllvmAtoms,
- CStringToAtom& llvmAtoms);
-+#endif
-
- static std::vector<File*> _s_files;
- static bool _s_llvmOptionsProcessed;
-@@ -1028,6 +1030,7 @@
- return true;
- }
-
-+#if LTO_API_VERSION >= 18
- // Create the ThinLTO codegenerator
- thinlto_code_gen_t Parser::init_thinlto_codegen(const std::vector<File*>& files,
- const std::vector<const ld::Atom*>& allAtoms,
-@@ -1178,6 +1181,7 @@
-
- return thingenerator;
- }
-+#endif
-
- // Full LTO processing
- bool Parser::optimizeThinLTO(const std::vector<File*>& files,
diff --git a/data/ld64/typos.diff b/data/ld64/typos.diff
index 697745f1c..72ade08e2 100644
--- a/data/ld64/typos.diff
+++ b/data/ld64/typos.diff
@@ -1,12 +1,65 @@
-diff -ur ld64-274.2/src/ld/parsers/textstub_dylib_file.cpp ld64-274.2+iPhone/src/ld/parsers/textstub_dylib_file.cpp
---- ld64-274.2/src/ld/parsers/textstub_dylib_file.cpp 2016-07-26 11:15:31.000000000 -1000
-+++ ld64-274.2+iPhone/src/ld/parsers/textstub_dylib_file.cpp 2018-09-05 12:09:16.000000000 -1000
-@@ -29,7 +29,7 @@
- #include <vector>
+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 @@
- #include "Architectures.hpp"
--#include "bitcode.hpp"
-+#include "Bitcode.hpp"
- #include "MachOFileAbstraction.hpp"
- #include "MachOTrie.hpp"
- #include "generic_dylib_file.hpp"
+ 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 --git a/data/ld64/version.diff b/data/ld64/version.diff
index 017fe256c..e693d3009 100644
--- a/data/ld64/version.diff
+++ b/data/ld64/version.diff
@@ -1,28 +1,38 @@
-diff -ur ld64-274.2/src/ld/Options.cpp ld64-274.2+iPhone/src/ld/Options.cpp
---- ld64-274.2/src/ld/Options.cpp 2017-01-20 12:24:09.000000000 -1000
-+++ ld64-274.2+iPhone/src/ld/Options.cpp 2018-09-05 18:36:45.000000000 -1000
-@@ -45,6 +45,8 @@
- #include "MachOFileAbstraction.hpp"
- #include "Snapshot.h"
+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:40:11.000000000 -1000
+@@ -22,6 +22,8 @@
+ * @APPLE_LICENSE_HEADER_END@
+ */
+const char *ldVersionString = "@(#)PROGRAM:ld PROJECT:ld64-" VERSION "\n";
+
- // from FunctionNameDemangle.h
- extern "C" size_t fnd_get_demangled_name(const char *mangledName, char *outputBuffer, size_t length);
-@@ -3946,7 +3948,6 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -3978,9 +3980,7 @@
addStandardLibraryDirectories = false;
else if ( strcmp(argv[i], "-v") == 0 ) {
fVerbose = true;
- extern const char ldVersionString[];
fprintf(stderr, "%s", ldVersionString);
+- fprintf(stderr, "BUILD " __TIME__ " " __DATE__"\n");
fprintf(stderr, "configured to support archs: %s\n", ALL_SUPPORTED_ARCHS);
// if only -v specified, exit cleanly
-@@ -5864,7 +5865,6 @@
- uint8_t version = depLinkerVersion;
- if ( write(fDependencyFileDescriptor, &version, 1) == -1 )
- throwf("write() to -dependency_info failed, errno=%d", errno);
-- extern const char ldVersionString[];
- if ( write(fDependencyFileDescriptor, ldVersionString, strlen(ldVersionString)+1) == -1 )
- throwf("write() to -dependency_info failed, errno=%d", errno);
- }
+ if ( argc == 2 ) {
+@@ -3994,7 +3994,6 @@
+ }
+ else if ( strcmp(argv[i], "-version_details") == 0 ) {
+ fVerbose = true;
+- extern const char ldVersionString[];
+ fprintf(stdout, "{\n");
+ fprintf(stdout, "\t\"version\": \"%s\",\n", STRINGIFY(LD64_VERSION_NUM));
+ fprintf(stdout, "\t\"architectures\": [\n");
+@@ -6062,7 +6061,6 @@
+ uint8_t version = depLinkerVersion;
+ if ( write(fd, &version, 1) == -1 )
+ throwf("write() to -dependency_info failed, errno=%d", errno);
+- extern const char ldVersionString[];
+ if ( write(fd, ldVersionString, strlen(ldVersionString)+1) == -1 )
+ throwf("write() to -dependency_info failed, errno=%d", errno);
+
diff --git a/data/ld64/wrapper.c b/data/ld64/wrapper.c
index 4e8dfd563..2b0a43a1e 100644
--- a/data/ld64/wrapper.c
+++ b/data/ld64/wrapper.c
@@ -5,7 +5,7 @@
#include <stdio.h>
#define LDID "/usr/bin/ldid"
-#define ENTS "/usr/share/entitlements/global.xml"
+#define ENTS "/usr/share/entitlements/ld64.xml"
int main (int argc, char **argv) {
int argcont;
@@ -26,7 +26,7 @@ int main (int argc, char **argv) {
if (pid > 0) {
waitpid(pid, &status, 0);
} else if (pid == 0) {
- execve("/usr/bin/ld64_", argv, environ);
+ execve("/usr/libexec/ld64", argv, environ);
} else {
fprintf(stderr, "Unable to fork: %s\n", strerror(errno));
exit(-1);