osxcross/patches/cctools-ld64-misc-fixes-1.patch
Thomas Pöchtrager 591f8c76d1 Misc cctools-port fixes
* Build cmpdylib & inout too
* Remove unused ld_classic sources
* ios-toolchain: Use llvm-dsymutil when possible
* Build ctf_insert & check_dylib binaries (fixes tpoechtrager/cctools-port/issues/24)
* Fix for tpoechtrager/cctools-port/issues/24
2016-10-29 19:48:48 +02:00

84 lines
2.7 KiB
Diff

diff --git cctools/ld64/src/3rd/helper.h cctools/ld64/src/3rd/helper.h
index 7649666..a705ac3 100644
--- cctools/ld64/src/3rd/helper.h
+++ cctools/ld64/src/3rd/helper.h
@@ -32,7 +32,7 @@ typedef char uuid_string_t__[37];
#endif
#ifdef __NetBSD__
-#define stoi(a,b) atoi(a.c_str()); do { const char *p = a.c_str(); *b = 0; while (isdigit(*p++)) (*b)++; } while (0)
+#define stoi(a,b) atoi(a.c_str()); do { if (!b) break; const char *p = a.c_str(); *b = 0; while (isdigit(*p++)) (*b)++; } while (0)
#endif
#include <dlfcn.h>
diff --git cctools/ld64/src/ld/parsers/libunwind/InternalMacros.h cctools/ld64/src/ld/parsers/libunwind/InternalMacros.h
index 25c1631..4e01e00 100644
--- cctools/ld64/src/ld/parsers/libunwind/InternalMacros.h
+++ cctools/ld64/src/ld/parsers/libunwind/InternalMacros.h
@@ -46,8 +46,15 @@ struct v128 { unsigned int vec[4]; };
#define EXPORT __attribute__((visibility("default")))
+#if 0 // ld64-port
#define COMPILE_TIME_ASSERT( expr ) \
extern int compile_time_assert_failed[ ( expr ) ? 1 : -1 ] __attribute__( ( unused ) );
+#endif
+
+// ld64-port start
+#define COMPILE_TIME_ASSERT( expr ) \
+ static_assert(expr, "");
+// ld64-port end
#define ABORT(msg) __assert_rtn(__func__, __FILE__, __LINE__, msg)
diff --git cctools/ld64/src/ld/passes/bitcode_bundle.cpp cctools/ld64/src/ld/passes/bitcode_bundle.cpp
index 162fc77..d4d7509 100644
--- cctools/ld64/src/ld/passes/bitcode_bundle.cpp
+++ cctools/ld64/src/ld/passes/bitcode_bundle.cpp
@@ -53,13 +53,6 @@ extern "C" {
static unsigned int lto_api_version() {
return LTO_API_VERSION;
}
-
-#if LTO_API_VERSION < 11
-static lto_code_gen_t lto_codegen_create_in_local_context() {
- // ::lto_api_version() < 14 makes this function unreachable
- __builtin_unreachable();
-}
-#endif
#endif
// ld64-port end
diff --git cctools/libstuff/ofile.c cctools/libstuff/ofile.c
index 35121ce..1b9199c 100644
--- cctools/libstuff/ofile.c
+++ cctools/libstuff/ofile.c
@@ -1965,6 +1965,8 @@ struct ofile *ofile)
struct ar_hdr *ar_hdr;
uint32_t ar_name_size, member_name_offset, n;
+ ar_name_size = 0; /* cctools-port */
+
/*
* Get the address and size of the archive.
*/
diff --git cctools/misc/nm.c cctools/misc/nm.c
index e398f30..c860ae2 100644
--- cctools/misc/nm.c
+++ cctools/misc/nm.c
@@ -527,7 +527,13 @@ void *cookie)
llvm_bundle_found = FALSE;
#endif /* LTO_SUPPORT */
- memset(&process_flags, '\0', sizeof(process_flags)); /* cctools-port */
+ /* cctools-port start */
+ memset(&process_flags, '\0', sizeof(process_flags));
+#ifdef LTO_SUPPORT
+ llvm_bundle_pointer = NULL;
+ llvm_bundle_size = 0;
+#endif /* LTO_SUPPORT */
+ /* cctools-port end */
cmd_flags = (struct cmd_flags *)cookie;