Update cctools to 877.8 and ld64 to 253.9

This commit is contained in:
Thomas Pöchtrager 2016-05-09 22:18:25 +02:00
parent b89ec78e31
commit 447e99777b
9 changed files with 49 additions and 99 deletions

View File

@ -1,3 +1,9 @@
/****************************** v0.13 ********************************/
changed:
* updated cctools to 877.8
* updated ld64 to 253.9
/****************************** v0.12 ********************************/
changed:

View File

@ -74,7 +74,7 @@ if [ -z "$OSX_VERSION_MIN" ]; then
fi
fi
OSXCROSS_VERSION=0.12
OSXCROSS_VERSION=0.13
X86_64H_SUPPORTED=0
@ -130,8 +130,8 @@ function remove_locks()
source $BASE_DIR/tools/trap_exit.sh
# CCTOOLS
LINKER_VERSION=253.3
CCTOOLS="cctools-877.5-ld64-$LINKER_VERSION"
LINKER_VERSION=253.9
CCTOOLS="cctools-877.8-ld64-$LINKER_VERSION"
CCTOOLS_TARBALL=$(ls $TARBALL_DIR/$CCTOOLS*.tar.* | head -n1)
CCTOOLS_REVHASH=$(echo $(basename "$CCTOOLS_TARBALL") | tr '_' '\n' | \
tr '.' '\n' | tail -n3 | head -n1)
@ -149,9 +149,6 @@ pushd .. &>/dev/null
popd &>/dev/null
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
patch -p1 < $PATCH_DIR/cctools-ld64-linux-ncpus.patch
patch -p1 < $PATCH_DIR/cctools-ld64-qsort_r.patch
patch -p1 < $PATCH_DIR/cctools-ld64-gcc6-build-fix.patch
echo ""
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET "
CONFFLAGS+="--disable-clang-as "

View File

@ -77,16 +77,15 @@ git clean -fdx
touch .clone_complete
git pull
if [ $BRANCH == "release_38" ]; then
patch -p0 < $PATCH_DIR/compiler-rt-llvm38-makefile.patch
fi
$SED -i "s/Configs += ios//g" make/platform/clang_darwin.mk
$SED -i "s/Configs += cc_kext_ios5//g" make/platform/clang_darwin.mk
$SED -i "s/Configs += profile_ios//g" make/platform/clang_darwin.mk
$SED -i "s/Configs += asan_iossim_dynamic//g" make/platform/clang_darwin.mk
if [ -f "$OSXCROSS_SDK/usr/lib/libSystem.B.tbd" ]; then
# https://llvm.org/bugs/show_bug.cgi?id=24776
$SED -i "s/x86_64 x86_64h,/x86_64,/g" make/platform/clang_darwin.mk
fi
# Unbreak the -Werror build.
if [ -f lib/asan/asan_mac.h ]; then
$SED -i "s/ASAN__MAC_H/ASAN_MAC_H/g" lib/asan/asan_mac.h

View File

@ -1,12 +0,0 @@
diff --git cctools/ld64/src/ld/code-sign-blobs/memutils.h cctools/ld64/src/ld/code-sign-blobs/memutils.h
index 6b8697c..7059669 100644
--- cctools/ld64/src/ld/code-sign-blobs/memutils.h
+++ cctools/ld64/src/ld/code-sign-blobs/memutils.h
@@ -31,6 +31,7 @@
//#include <security_utilities/utilities.h>
#include <sys/types.h>
#include <stdlib.h>
+#include <stddef.h> // ld64-port
#include <algorithm>
#ifdef __GLIBCXX__ // ld64-port

View File

@ -1,49 +0,0 @@
diff --git cctools/ld64/src/ld/InputFiles.cpp cctools/ld64/src/ld/InputFiles.cpp
index 13207e5..2b6f7bd 100644
--- cctools/ld64/src/ld/InputFiles.cpp
+++ cctools/ld64/src/ld/InputFiles.cpp
@@ -43,6 +43,15 @@
#include <sys/sysctl.h>
#include <libkern/OSAtomic.h>
+// ld64-port
+#ifdef __linux__
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
+#include <sched.h>
+#endif
+// ld64-port end
+
#include <string>
#include <map>
#include <set>
@@ -913,6 +922,20 @@ InputFiles::InputFiles(Options& opts, const char** archName)
// initialize info for parsing input files on worker threads
unsigned int ncpus;
+#ifdef __linux__ // ld64-port
+ cpu_set_t cs;
+ CPU_ZERO(&cs);
+
+ if (!sched_getaffinity(0, sizeof(cs), &cs)) {
+ ncpus = 0;
+
+ for (int i = 0; i < CPU_SETSIZE; i++)
+ if (CPU_ISSET(i, &cs))
+ ncpus++;
+ } else {
+ ncpus = 1;
+ }
+#else
int mib[2];
size_t len = sizeof(ncpus);
mib[0] = CTL_HW;
@@ -920,6 +943,7 @@ InputFiles::InputFiles(Options& opts, const char** archName)
if (sysctl(mib, 2, &ncpus, &len, NULL, 0) != 0) {
ncpus = 1;
}
+#endif
_availableWorkers = MIN(ncpus, files.size()); // max # workers we permit
_idleWorkers = 0;

View File

@ -1,27 +0,0 @@
commit 86ee16d49f06c07fb7d208d6f082b4a63c077293
Author: Johannes Schickel <lordhoto [AT] gmail>
Date: Fri Feb 12 14:51:14 2016 +0100
Fix build on systems with glibc's qsort_r.
diff --git cctools/ld64/src/3rd/qsort_r.c cctools/ld64/src/3rd/qsort_r.c
index a514ad8..1bae250 100644
--- cctools/ld64/src/3rd/qsort_r.c
+++ cctools/ld64/src/3rd/qsort_r.c
@@ -28,7 +28,6 @@
*/
#define I_AM_QSORT_R
-#define qsort_r qsort_r_local
#include <sys/cdefs.h>
@@ -37,6 +36,8 @@
#include <stdlib.h>
#include <string.h>
+#define qsort_r qsort_r_local
+
#ifndef __FreeBSD__
/* flsl.c */
int

View File

@ -0,0 +1,36 @@
diff --git make/platform/clang_darwin.mk make/platform/clang_darwin.mk
index 9944481..50afa19 100644
--- make/platform/clang_darwin.mk
+++ make/platform/clang_darwin.mk
@@ -17,23 +17,23 @@ CheckArches = \
result=""; \
if [ "X$(3)" != X ]; then \
for arch in $(1); do \
- if $(LD) -v 2>&1 | grep "configured to support" \
- | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \
- if $(CC) -arch $$arch \
+ if $(CC) -arch $$arch -c \
-integrated-as \
$(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \
-isysroot $(3) \
-o /dev/null > /dev/null 2> /dev/null; then \
- result="$$result$$arch "; \
+ if $(LD) -v 2>&1 | grep "configured to support" \
+ | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \
+ result="$$result$$arch "; \
else \
printf 1>&2 \
- "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \
- printf 1>&2 " (clang or system libraries do not support it)\n"; \
+ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\
+ printf 1>&2 " (ld does not support it)\n"; \
fi; \
else \
printf 1>&2 \
- "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\
- printf 1>&2 " (ld does not support it)\n"; \
+ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \
+ printf 1>&2 " (clang does not support it)\n"; \
fi; \
done; \
fi; \

Binary file not shown.