update cctools to 870 and ld64 to 242

OSXCross *should* now work on Linux ARM devices with this update.

Port changes:

* commit f7818cbf61074ea6fbb56de1b50c0973afe3428f
| Author: Thomas Pöchtrager
| Date:   Fri Jul 17 19:34:57 2015 +0200
|
|    add preliminary llvm-3.8 support
|
* commit 8482a95745f54062de974e65fdd28b0389f3c6a5
| Author: Thomas Pöchtrager
| Date:   Sat Jul 11 09:32:55 2015 +0200
|
|     * get rid of the openssl dependency
|     * make libuuid optional (based on http://git.io/vqbwu)
|
* commit a8e002367d64c5e3e3a195bba37aa1ccb306f897
| Author: Thomas Pöchtrager
| Date:   Sat Jul 11 08:45:49 2015 +0200
|
|     * undo unnecessary changes done by the original porter
|     * add cctools-port comments to changed code
|     * add codelite project
|
* commit 2b050dc41d1ae375a5af36b751d479be4513a6f3
| Author: Thomas Pöchtrager
| Date:   Tue Jun 23 19:31:00 2015 +0200
|
|     ios-toolchain: remove 'CC=cc' - just causes troubles
|
* commit f7f7c6180e5b7ae2897e3617e3475811c88a5173
| Author: Thomas Pöchtrager
| Date:   Sat May 30 15:51:27 2015 +0200
|
|     silence gcc 5.1 warnings
|
* commit 359b40b5bd40d86e0d1c9d40fb7bb2297130e903
| Author: Thomas Pöchtrager
| Date:   Sun Apr 19 21:33:15 2015 +0200
|
|     use KERN_PROC_ARGV instead of KERN_PROC_ENV
|
* commit 7a9b23fbb24c7250cb4caae2d97b79afbdefe503
| Author: Thomas Pöchtrager
| Date:   Sun Apr 19 20:35:01 2015 +0200
|
|     _NSGetExecutablePath() should now work properly on openbsd
|
* commit 47c29e6a7701a16268da57412a68e133818a32dd
| Author: Thomas Pöchtrager
| Date:   Sat Apr 11 18:34:58 2015 +0200
|
|     clang 3.6 miscompiles ld64 on armhf (even at -O0); enforce gcc on arm until
|     i can figure out what's going on there
|
|     probably related:
|     https://github.com/raspberrypi/linux/issues/766
|     https://github.com/tpoechtrager/cctools-port/issues/1#issuecomment-59118615
|
|     backtrace:
|
|     https://gist.github.com/tpoechtrager/d68c8352a3fd32165af4
|
* commit 5e5b511a3eebd3fa9ece49bead85a1be29a25dfb
| Author: Thomas Pöchtrager
| Date:   Thu Mar 19 21:28:44 2015 +0100
|
|     fix more potential -D_FORTIFY_SOURCE crashers
|
* commit 5098fc9f6dfba7eac18f5ae55b7e361314e0fb7b
| Author: Thomas Pöchtrager
| Date:   Thu Mar 19 21:14:13 2015 +0100
|
|     strip: don't crash with -D_FORTIFY_SOURCE enabled (ubuntu gcc)
|
* commit 268c3de73b173673dc9ae932ab802f42247570ff
| Author: Thomas Pöchtrager
| Date:   Wed Mar 18 21:29:21 2015 +0100
|
|     add arm to the tested host architectures
|
* commit ade8d819ad8fd2d04978a2da22e5efe06dc40dad
| Author: Thomas Pöchtrager
| Date:   Wed Mar 18 21:29:06 2015 +0100
|
|     ios-toolchain: set COMPILER_PATH
|
* commit 700c6fd644f78b9427163e9f444fc15f2c73ed28
| Author: Thomas Pöchtrager
| Date:   Wed Mar 18 20:28:27 2015 +0100
|
|     configure.ac: target_cpu -> host_cpu
|
* commit bf9ac6a2c5846af3c2112c483a612937d8e3a037
| Author: Thomas Pöchtrager <tpoechtrager@users.noreply.github.com>
| Date:   Sun Mar 15 22:43:36 2015 +0100
|
|     update README
|
* commit 253ec0ff238ebc3b359d7f4fe2edc38b0aa3e428
| Author: Thomas Pöchtrager
| Date:   Sun Mar 15 22:26:45 2015 +0100
|
|     typo
|
* commit 42109667d4b080bbc8091235c036ed418d369d13
| Author: Thomas Pöchtrager
| Date:   Sun Mar 15 22:21:16 2015 +0100
|
|     * linux ppc/ppc64 & arm/arm64/aarch64 port
|       (compiles now - everything else is *untested*)
|
|     other changes:
|
|     * rename 'machochecker' to 'machocheck'
|     * get rid of duplicate $CFLAGS
|     * fix a typo in the ios toolchain README
|     * package.sh: remove the autom4te.cache directory
|
* commit 0c32be78e979641095a92480786a621e65282b92
| Author: Thomas Pöchtrager
| Date:   Mon Mar 9 20:01:33 2015 +0100
|
|     misc fixes:
|     * fix gcc warnings (even though they are not my fault)
|     * fix a typo in include/foreign/i386/_types.h (__INT64_TYPE_ -> __INT64_TYPE__)
|     * fix the cygwin + clang<=3.4 build
|
* commit 3f00c16b0fce9a7a151a88114209f17a46711637
| Author: Thomas Pöchtrager
| Date:   Sun Mar 8 20:49:50 2015 +0100
|
|     be more precise about the gcc requirement
|
* commit 1b9a93057b856c92190f3f8d32e507539f4669cd
| Author: Thomas Pöchtrager
| Date:   Sun Mar 8 20:09:11 2015 +0100
|
|     update README
|
* commit 3cc1ba6fc7c862de258e7a29c840ea7d5eb04be1
| Author: Thomas Pöchtrager
| Date:   Sun Mar 8 17:47:09 2015 +0100
|
|     * windows (cygwin), openbsd and dragonflybsd port
|     * gcc compiler support
|     * add --with-llvm-config option
|     * fix 'ld: malformed 32-bit x.y.z version number: 3.19.0-7-generic'
|
* commit 7a2d21ca7f4e42c70c8ff85ec3e37ac6ef9d0de7
| Author: Thomas Pöchtrager
| Date:   Tue Feb 24 21:58:10 2015 +0100
|
|     map -> version-script
|
* commit 5135fb2541876f0af185589890f9e21b98ceb39c
| Author: Thomas Pöchtrager
| Date:   Tue Feb 24 21:49:55 2015 +0100
|
|     an attempt to fix the otool disassembler
|
* commit 219f5f53ea42361ccb2c75bed311f1d57ce68966
| Author: Thomas Pöchtrager
| Date:   Mon Feb 23 21:32:47 2015 +0100
|
|     ar, lipo, otool (etc.) should also be linked with -rpath for libLTO
|
* commit 1efff3733f1cb483b27e18d6d14cd7ccf5571627
| Author: Thomas Pöchtrager
| Date:   Mon Feb 23 21:32:11 2015 +0100
|
|     add support for llvm 3.7
|
* commit 8b6beadd337ac7e5d1d58d438e9afcd5165d1200
| Author: Thomas Pöchtrager
| Date:   Mon Feb 23 21:31:34 2015 +0100
|
|     silence/fix -Wabsolute-value warnings
|
* commit 59d21d2c793c51d205c8b4ab14b9b28e63c72445 (tag: 862-ld64-241.9-2)
| Author: Thomas Pöchtrager
| Date:   Sun Dec 28 18:09:43 2014 +0100
|
|     ios-toolchain: build.sh: ignore 'git clean' return status
|
* commit 3d198530ae4c031e904f29414c7c46ac547d90b7
| Author: Thomas Pöchtrager
| Date:   Sun Dec 28 17:48:45 2014 +0100
|
|     ios-toolchain: take care of IPHONEOS_DEPLOYMENT_TARGET (env)
|
* commit 23658f2f20778374b43dcd80717b4f47845c2297
| Author: Thomas Pöchtrager
| Date:   Sun Dec 28 17:48:28 2014 +0100
|
|     the ios 8.1 sdk has mach_vm_trunc_page and mach_vm_round_page already defined
|
* commit 70b87ceec059f632641b41dfd2d9e63dbd069a0c
| Author: Thomas Pöchtrager
| Date:   Sat Dec 27 12:33:50 2014 +0100
|
|     ios-toolchain: cleanup
|
* commit 9c0f520110f7f57a1060ac66329c55f8f71ecd8c
| Author: Thomas Pöchtrager
| Date:   Sat Dec 27 12:25:26 2014 +0100
|
|     ios-toolchain: use -mlinker-version=241.9 in the 241.9 branch
|
* commit 8b0cbdaf820ee40fcb1e2e209cb6f858ffb8aa90
| Author: Thomas Pöchtrager
| Date:   Sat Dec 27 12:00:19 2014 +0100
|
|     strchr -> strrchr
|
* commit e9f701822aa209cf435c4b26eb4c7ab01001f5cb
| Author: Thomas Pöchtrager
| Date:   Sat Dec 27 11:47:02 2014 +0100
|
|     add scripts / wrapper to build a simple ios toolchain
|
* commit cf456225d3551a8782c5222133455bb9139ecad5
| Author: Thomas Pöchtrager
| Date:   Fri Dec 26 10:55:34 2014 +0100
|
|     define _GNU_SOURCE for strnlen()
|
* commit 211fe3927f5d6c132d72164e898d146fcdf7577e
| Author: sezero <sezero@users.noreply.github.com>
| Date:   Wed Dec 24 12:20:01 2014 +0200
|
|     autogen.sh fixes: run libtoolize 'after' creating the m4 directory. run aclocal with '-I m4' switches.
|
* commit a4f9fd8ad09cafb94bf465ae4e914f086458e5cc
| Author: Thomas Pöchtrager <tpoechtrager@users.noreply.github.com>
| Date:   Wed Dec 24 11:35:37 2014 +0100
|
|     Update README.md
|
* commit 2201b7b4cbc3a3b29aa7d8e7ccf2576f1847a3e6
| Author: Thomas Pöchtrager
| Date:   Fri Nov 21 22:58:16 2014 +0100
|
|     add '-L/usr/pkg/lib' for NetBSD
|
* commit a303cc27ace751059caa27a34e5d9ae5cd0825ac
| Author: Thomas Pöchtrager
| Date:   Fri Nov 21 22:10:18 2014 +0100
|
|     update README
|
This commit is contained in:
Thomas Pöchtrager 2015-07-17 23:25:59 +02:00
parent 6c7ed2bd27
commit 6a35a0bf84
12 changed files with 57 additions and 341 deletions

View File

@ -29,8 +29,12 @@ Move your packaged SDK to the tarballs/ directory.
Then ensure you have the following installed on your Linux/BSD box:
`Clang 3.2+`, `llvm-devel`, `patch`, `libxml2-devel` (<=10.5 only),
`uuid-devel`, `openssl-devel` and the `bash shell`.
`Clang 3.2+`, `patch`, `libxml2-devel` (<=10.6 only) and the `bash shell`.
Optional:
`llvm-devel`: For Link Time Optimization support
`uuid-devel`: For ld64 `-random_uuid` support
\--
You can run 'sudo tools/get\_dependencies.sh' to get these automatically.
@ -198,6 +202,14 @@ can be overriden by explicitly passing `-stdlib=libstdc++` to clang.
x86\_64h defaults to `Mac OS X 10.8` and requires clang 3.5+.
x86\_64h = x86\_64 with optimizations for the Intel Haswell Architecture.
### BUILDING OSXCROSS WITH GCC: ###
You can build OSXCross with GCC this way:
`CC=gcc CXX=g++ ./build.sh`
You will need gcc/g++/gcc-objc 4.6+.
### LICENSE: ####
* scripts/wrapper: GPLv2
* cctools/ld64: APSL 2.0

View File

@ -114,6 +114,7 @@ mkdir -p $SDK_DIR
require $CC
require $CXX
require clang
require patch
require sed
@ -135,7 +136,7 @@ if [ "$PLATFORM" == "Darwin" ]; then
CXX+=" -stdlib=libc++"
fi
res=`check_cxx_stdlib`
res=$(check_cxx_stdlib)
if [ "$PLATFORM" == "Darwin" ]; then
CXX=$PREVCXX
@ -143,18 +144,19 @@ if [ "$PLATFORM" == "Darwin" ]; then
fi
if [ $res -ne 0 ]; then
echo "Your C++ standard library is either broken or too old to build ld64-241.9"
echo "Building ld64-134.9 instead"
echo ""
echo "Your C++ standard library is either broken or too old to build ld64-241.9" 1>&2
echo "Building ld64-134.9 instead" 1>&2
echo "" 1>&2
sleep 3
LINKER_VERSION=134.9
else
LINKER_VERSION=241.9
LINKER_VERSION=242
fi
CCTOOLS="cctools-862-ld64-$LINKER_VERSION"
CCTOOLS="cctools-870-ld64-$LINKER_VERSION"
CCTOOLS_TARBALL=$(ls $TARBALL_DIR/$CCTOOLS*.tar.* | head -n1)
CCTOOLS_REVHASH=$(echo $(basename "$CCTOOLS_TARBALL") | tr '_' ' ' | tr '.' ' ' | awk '{print $3}')
CCTOOLS_REVHASH=$(echo $(basename "$CCTOOLS_TARBALL") | tr '_' '\n' | \
tr '.' '\n' | tail -n3 | head -n1)
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
@ -169,14 +171,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-strnlen.patch
patch -p0 < $PATCH_DIR/cctools-ld64-llvm-3.7.patch
patch -p0 < $PATCH_DIR/cctools-ld64-abs-warning.patch
patch -p0 < $PATCH_DIR/cctools-ld64-rpath.patch
pushd .. &>/dev/null
patch -p0 < $PATCH_DIR/cctools-ld64-otool-disasm.patch
chmod +x tools/fix_liblto.sh
popd &>/dev/null
echo ""
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET"
[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+=" --enable-lto=no"

View File

@ -1,38 +0,0 @@
--- as/arm.c
+++ as/arm.c
@@ -17839,7 +17839,7 @@
{
bfd_vma insn;
bfd_vma encoded_addend;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = abs ((int)value);
/* Check that the absolute value of the addend can be
expressed as an 8-bit constant plus a rotation. */
@@ -17884,7 +17884,7 @@
#endif
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = abs ((int)value);
/* Check that the absolute value of the addend can be
encoded in 12 bits. */
@@ -17927,7 +17927,7 @@
#endif
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = abs ((int)value);
/* Check that the absolute value of the addend can be
encoded in 8 bits. */
@@ -17971,7 +17971,7 @@
#endif
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = abs ((int)value);
/* Check that the absolute value of the addend is a multiple of
four and, when divided by four, fits in 8 bits. */

View File

@ -1,49 +0,0 @@
--- configure
+++ configure
@@ -8147,6 +8147,10 @@
$RM -r conftest*
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
if test -n "$compiler"; then
lt_prog_compiler_no_builtin_flag=
@@ -16686,10 +16690,12 @@
if test "x$enable_lto" = "xyes"; then
for ac_prog in llvm-config \
- llvm-config-3.6 llvm-config-3.5 llvm-config-3.4 \
- llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 \
- llvm-config36 llvm-config35 llvm-config34 \
- llvm-config33 llvm-config32 llvm-config31
+ llvm-config-3.7 llvm-config-3.6 llvm-config-3.5 \
+ llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 \
+ llvm-config-3.1 \
+ llvm-config37 llvm-config36 llvm-config35 \
+ llvm-config34 llvm-config33 llvm-config32 \
+ llvm-config31
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
--- m4/llvm.m4
+++ m4/llvm.m4
@@ -8,10 +8,12 @@
if test "x$enable_lto" = "xyes"; then
AC_PATH_PROGS(LLVM_CONFIG,
[llvm-config \
- llvm-config-3.6 llvm-config-3.5 llvm-config-3.4 \
- llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 \
- llvm-config36 llvm-config35 llvm-config34 \
- llvm-config33 llvm-config32 llvm-config31],
+ llvm-config-3.7 llvm-config-3.6 llvm-config-3.5 \
+ llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 \
+ llvm-config-3.1 \
+ llvm-config37 llvm-config36 llvm-config35 \
+ llvm-config34 llvm-config33 llvm-config32 \
+ llvm-config31],
no)
if test "x$LLVM_CONFIG" != "xno"; then

View File

@ -1,139 +0,0 @@
diff --git cctools/libstuff/llvm.c cctools/libstuff/llvm.c
index 447140d..26b0a66 100644
--- cctools/libstuff/llvm.c
+++ cctools/libstuff/llvm.c
@@ -14,7 +14,11 @@
* plan to include it (along with the current libLTO APIs) in a generic
* libLLVM.dylib.
*/
+#ifdef __APPLE__
+#define LIB_LLVM "libLTO.dylib"
+#else
#define LIB_LLVM "libLTO.so"
+#endif /* __APPLE__ */
static int tried_to_load_llvm = 0;
static void *llvm_handle = NULL;
@@ -62,12 +66,20 @@ static void load_llvm(void)
p[1] = '\0';
llvm_path = makestr(prefix, "../lib/" LIB_LLVM, NULL);
+#ifdef __APPLE__
llvm_handle = dlopen(llvm_path, RTLD_NOW);
if(llvm_handle == NULL){
free(llvm_path);
llvm_path = NULL;
- llvm_handle = dlopen("/usr/lib/llvm/" LIB_LLVM, RTLD_NOW);
+ llvm_handle = dlopen("/Applications/Xcode.app/Contents/"
+ "Developer/Toolchains/XcodeDefault."
+ "xctoolchain/usr/lib/" LIB_LLVM,
+ RTLD_NOW);
}
+#else
+ llvm_handle = dlopen(LIB_LLVM, RTLD_NOW);
+#endif /* __APPLE__ */
+
if(llvm_handle == NULL)
return;
@@ -80,6 +92,13 @@ static void load_llvm(void)
createCPU = dlsym(llvm_handle, "LLVMCreateDisasmCPU");
version = dlsym(llvm_handle, "lto_get_version");
+#ifndef __APPLE__
+ if(create == NULL){
+ fprintf(stderr, "Your " LIB_LLVM " lacks required symbols.\n");
+ fprintf(stderr, "Please run: tools/fix_liblto.sh (or http://git.io/AyZP) to fix libLTO.\n");
+ }
+#endif /* __APPLE__ */
+
if(create == NULL ||
dispose == NULL ||
disasm == NULL){
diff --git tools/fix_liblto.sh tools/fix_liblto.sh
new file mode 100755
index 0000000..6cb05e8
--- /dev/null
+++ tools/fix_liblto.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+## http://llvm.org/PR22677
+
+pushd "${0%/*}" &>/dev/null
+
+if [ $(uname -s) == "Darwin" ]; then
+ echo "Darwin works out of the box."
+ exit 1
+fi
+
+if [ -z "$LLVM_CONFIG" ]; then
+ LLVM_CONFIG=llvm-config
+fi
+
+which $LLVM_CONFIG &>/dev/null
+
+if [ $? -ne 0 ]; then
+ echo -n "Cannot find $LLVM_CONFIG, you may want to try " 1>&2
+ echo "LLVM_CONFIG=llvm-config<suffix> $0" 1>&2
+ exit 1
+fi
+
+LIBDIR=$($LLVM_CONFIG --libdir)
+INCDIR=$($LLVM_CONFIG --includedir)
+
+V="$(readelf -Ws $LIBDIR/libLTO.so 2>/dev/null | grep LLVMCreateDisasm)"
+
+if [ -n "$V" ]; then
+ echo "No fix needed."
+ exit 1
+fi
+
+VERSION=$($LLVM_CONFIG --version | awk -F \. {'print $1$2'} | sed 's/svn//g')
+
+if [ $VERSION -lt 34 ]; then
+ echo "This tool requires LLVM 3.4 or later." 1>&2
+ exit 1
+fi
+
+LIBS=$($LLVM_CONFIG --libs all)
+SYSLIBS=$($LLVM_CONFIG --system-libs 2>/dev/null || echo "-ldl -lz -ltinfo -pthread")
+CXXFLAGS=$($LLVM_CONFIG --cxxflags)
+
+if [ $VERSION -ge 35 ]; then
+ SYSLIBS+=" -ledit"
+fi
+
+set -e
+TMP=$(mktemp -d)
+set +e
+
+pushd $TMP &>/dev/null
+wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.cpp
+wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/LTODisassembler.cpp
+wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.exports
+
+echo "{" > lto.ls
+echo " global:" >> lto.ls
+while read p; do
+ echo " $p;" >> lto.ls
+done < lto.exports
+echo " LLVM*;" >> lto.ls
+echo " local: *;" >> lto.ls
+echo "};" >> lto.ls
+popd &>/dev/null
+
+set -x
+
+clang++ -shared \
+ -L$LIBDIR -I$INCDIR -Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \
+ $CXXFLAGS $TMP/lto.cpp $TMP/LTODisassembler.cpp -Wl,-version-script,$TMP/lto.ls \
+ -Wl,-no-undefined -fno-rtti -fPIC -o libLTO.so
+
+rm -r $TMP
+
+mv -f libLTO.so $LIBDIR || {
+ set +x
+ echo "Try again as root."
+ echo "Or run the following command by hand: mv $PWD/libLTO.so $LIBDIR"
+ exit 1
+}

View File

@ -1,29 +0,0 @@
--- configure
+++ configure
@@ -16789,7 +16789,6 @@
LTO_LIB="-L${LLVM_LIB_DIR} -lLTO"
if test "x$rpathlink" = "xyes"; then
LTO_RPATH="-Wl,-rpath,$LLVM_LIB_DIR,--enable-new-dtags"
- LTO_LIB="$LTO_RPATH $LTO_LIB"
fi
LTO_DEF=-DLTO_SUPPORT
# DO NOT include the LLVM include dir directly,
@@ -16813,6 +16812,8 @@
+LDFLAGS="$LDFLAGS $LTO_RPATH"
+
### Check endianness ###
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
--- m4/llvm.m4
+++ m4/llvm.m4
@@ -27,7 +27,6 @@
[ LTO_LIB="-L${LLVM_LIB_DIR} -lLTO"
if test "x$rpathlink" = "xyes"; then
LTO_RPATH="-Wl,-rpath,$LLVM_LIB_DIR,--enable-new-dtags"
- LTO_LIB="$LTO_RPATH $LTO_LIB"
fi
LTO_DEF=-DLTO_SUPPORT
# DO NOT include the LLVM include dir directly,

View File

@ -1,67 +0,0 @@
diff --git cctools/include/foreign/i386/_types.h cctools/include/foreign/i386/_types.h
index 601b196..8bffd6f 100644
--- cctools/include/foreign/i386/_types.h
+++ cctools/include/foreign/i386/_types.h
@@ -33,6 +33,15 @@
* flotaing point and other arithmetic types, as needed, later.
*/
+/*
+ * Silence old glibc -Wtypedef-redefinition warnings.
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtypedef-redefinition"
+#endif
+
#ifdef __GNUC__
typedef __signed char __int8_t;
#else /* !__GNUC__ */
@@ -121,4 +130,8 @@ typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
#endif /* _BSD_I386__TYPES_H_ */
diff --git cctools/ld64/src/3rd/strlcat.c cctools/ld64/src/3rd/strlcat.c
index ef1a10a..faf09e3 100644
--- cctools/ld64/src/3rd/strlcat.c
+++ cctools/ld64/src/3rd/strlcat.c
@@ -23,6 +23,14 @@
#ifndef __APPLE__
+/*
+ * Otherwise string.h may hide strnlen().
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include <string.h>
size_t
diff --git cctools/otool/ofile_print.c cctools/otool/ofile_print.c
index 3eb6506..4e9493a 100644
--- cctools/otool/ofile_print.c
+++ cctools/otool/ofile_print.c
@@ -201,6 +201,14 @@
#define __dr6 dr6
#define __dr7 dr7
+/*
+ * Otherwise string.h may hide strnlen().
+ * https://github.com/tpoechtrager/cctools-port/pull/8
+ */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

Binary file not shown.

Binary file not shown.

View File

@ -11,13 +11,45 @@ PATCH_DIR=$BASE_DIR/patches
SDK_DIR=$TARGET_DIR/SDK
if [ -z "$USESYSTEMCOMPILER" ]; then
export CC=clang
export CXX=clang++
# Default to gcc on some OSs rather than clang due to either
# libstdc++ issues (clang uses an outdated version on those)
# or some other incompatibilities
case "$PLATFORM" in
CYGWIN* | DragonFly )
cc=gcc
cxx=g++
;;
OpenBSD )
cc=egcc
cxx=eg++
;;
Darwin )
cc=clang
cxx=clang++
;;
* )
case "$ARCH" in
arm* )
cc=gcc
cxx=g++
;;
* )
cc=clang
cxx=clang++
;;
esac
;;
esac
[ -z "$CC" ] && export CC=$cc
[ -z "$CXX" ] && export CXX=$cxx
elif [ -n "$CC" -o -n "$CXX" ]; then
echo "CC/CXX should not be set, continuing in 5 seconds..." 1>&2
sleep 5
fi
# enable debug messages
test -n "$OCDEBUG" && set -x