cctools 855 + ld64 236.3

also add 'cctools 855 + ld64 134.9' as fallback for systems without
an up-to-date C++ standard library
This commit is contained in:
Thomas Pöchtrager 2014-05-10 16:17:16 +02:00
parent ef6bfe6952
commit 4a685dbe73
10 changed files with 56 additions and 324 deletions

View File

@ -1,3 +1,8 @@
/******************************* v0.8 *******************************/
changed:
* updated cctools to 855 with ld64-236.3 (Xcode 5.1)
/******************************* v0.7 *******************************/
added:
@ -15,6 +20,7 @@ changed:
implemented in the wrapper
* <arch>-apple-darwinXX-cc/c++ defaults now to clang
* switched to two-space indents
* gcc 4.8.2 -> gcc 4.9.0
fixed:
* 'MACOSX_DEPLOYMENT_TARGET' env var is now handled correctly
@ -34,7 +40,7 @@ added:
changed:
* attempt to make the toolchain less path dependent
* update cctools to 845
* updated cctools to 845
fixed:
* help clang to find its own intrinsic headers
@ -64,7 +70,7 @@ added:
* comments to build.sh
changed:
* update cctools to 839 with ld64-134.9
* updated cctools to 839 with ld64-134.9
fixed:
* check if MacOSX package is present in tarballs

View File

@ -146,8 +146,8 @@ However, there are several ways to override the default value:
can be overriden by explicitly passing `-stdlib=libstdc++` to clang.
### LICENSE: ####
* bash scripts: GPLv2
* cctools: APSL 2.0
* scripts/wrapper: GPLv2
* cctools/ld64: APSL 2.0
* xar: New BSD
* bc: GPLv3

View File

@ -76,15 +76,8 @@ if [ -z "$OSX_VERSION_MIN" ]; then
fi
fi
# ld version
if [ "$PLATFORM" == "Darwin" ]; then
LINKER_VERSION="`get_ld_version`"
else
LINKER_VERSION=134.9
fi
# Don't change this
OSXCROSS_VERSION=0.7
OSXCROSS_VERSION=0.8
TARBALL_DIR=$BASE_DIR/tarballs
BUILD_DIR=$BASE_DIR/build
@ -152,14 +145,22 @@ source $BASE_DIR/tools/trap_exit.sh
# CCTOOLS
if [ "$PLATFORM" != "Darwin" ]; then
if [ "`ls $TARBALL_DIR/cctools*.tar.* | wc -l | tr -d ' '`" != "1" ]; then
res=`check_cxx_stdlib`
if [ $res -ne 0 ]; then
echo "Your C++ standard library is either broken or too old to build ld64-236.3"
echo "Building ld64-134.9 instead"
echo ""
echo "There should only be one cctools*.tar.* archive in the tarballs directory"
echo ""
exit 1
sleep 3
LINKER_VERSION=134.9
else
LINKER_VERSION=236.3
fi
CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
CCTOOLS="cctools-855-ld64-$LINKER_VERSION"
CCTOOLS_TARBALL=`ls $TARBALL_DIR/$CCTOOLS*.tar.* | head -n1`
CCTOOLS_REVHASH=`echo "$CCTOOLS_TARBALL" head -n1 | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
@ -167,24 +168,18 @@ rm -rf cctools*
rm -rf xar*
rm -rf bc*
extract $TARBALL_DIR/cctools*.tar.xz 1 1 1
extract $CCTOOLS_TARBALL 1
pushd cctools*/cctools &>/dev/null
pushd .. &>/dev/null
patch -p0 -l < $PATCH_DIR/cctools-63f6742.patch
if [ "$PLATFORM" == "Linux" ]; then
patch -p0 < $PATCH_DIR/cctools-old-linux.patch
fi
popd &>/dev/null
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
patch -p0 < $PATCH_DIR/cctools-ld64-3.patch
echo ""
./autogen.sh
echo ""
echo "if you see automake warnings, ignore them"
echo "automake 1.14+ is supposed to print a lot of warnings"
echo ""
./configure --prefix=$TARGET_DIR --target=x86_64-apple-$TARGET
$MAKE -j$JOBS
$MAKE install -j$JOBS
@ -200,6 +195,9 @@ done
popd &>/dev/null
fi
else
# Darwin
LINKER_VERSION="`get_ld_version`"
fi
# CCTOOLS END
@ -321,7 +319,7 @@ export OSXCROSS_LINKER_VERSION=$LINKER_VERSION
if [ "$PLATFORM" != "Darwin" ]; then
# libLTO.so
export OSXCROSS_LIBLTO_PATH=`cat $BUILD_DIR/cctools*/cctools/tmp/ldpath`
export OSXCROSS_LIBLTO_PATH=`cat $BUILD_DIR/cctools*/cctools/tmp/ldpath 2>/dev/null`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OSXCROSS_LIBLTO_PATH"
fi

View File

@ -1,289 +0,0 @@
commit 63f674235b363b7d762d075b4f1eddc09d10686b
Author: Thomas Pöchtrager <t.poechtrager@gmail.com>
Date: Mon Mar 24 21:16:34 2014 +0100
support NetBSD
diff --git cctools/ar/contents.c cctools/ar/contents.c
index b5bf05d..9df1a33 100644
--- cctools/ar/contents.c
+++ cctools/ar/contents.c
@@ -81,7 +81,9 @@ static char rcsid[] = "$OpenBSD: contents.c,v 1.2 1996/06/26 05:31:19 deraadt Ex
#include "archive.h"
#include "extern.h"
+#ifndef HAVE_STRMODE
extern void strmode(int mode, char *p);
+#endif
/*
* contents --
diff --git cctools/configure.ac cctools/configure.ac
index 31f075b..17c0d09 100644
--- cctools/configure.ac
+++ cctools/configure.ac
@@ -10,11 +10,10 @@ AC_ARG_PROGRAM
CC=clang
CXX=clang++
-CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null` -O3"
-CXXFLAGS="$CXXFLAGS `cat tmp/cxxflags 2>/dev/null` -O3"
+CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null` -isystem /usr/local/include -isystem /usr/pkg/include -O3"
+CXXFLAGS="$CXXFLAGS `cat tmp/cxxflags 2>/dev/null` -isystem /usr/local/include -isystem /usr/pkg/include -O3"
LDFLAGS="$LDFLAGS -L/usr/local/lib `cat tmp/ldflags 2>/dev/null`"
export LD_LIBRARY_PATH="`cat tmp/ldpath 2>/dev/null`"
-export C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/local/include"
CPP="clang -E"
@@ -225,6 +224,17 @@ AC_COMPILE_IFELSE(
)
CFLAGS=$ORIGCFLAGS
+ORIGCFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -Wno-char-subscripts"
+AC_MSG_CHECKING([if -Wno-char-subscripts is supported])
+AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
+ [WARNINGS="$WARNINGS -Wno-char-subscripts"
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])]
+)
+CFLAGS=$ORIGCFLAGS
+
AC_SUBST([WARNINGS], [$WARNINGS])
@@ -251,6 +261,8 @@ AC_SUBST(CRYPT_LIBS)
AC_C_BIGENDIAN([AC_SUBST([ENDIAN_FLAG],[-D__BIG_ENDIAN__=1])],
[AC_SUBST([ENDIAN_FLAG],[-D__LITTLE_ENDIAN__=1])])
+AC_CHECK_FUNCS([strmode])
+
AC_CONFIG_FILES([Makefile libstuff/Makefile])
AC_CONFIG_FILES([ar/Makefile])
AC_CONFIG_FILES([as/Makefile])
diff --git cctools/include/foreign/i386/endian.h cctools/include/foreign/i386/endian.h
index 2dbebcb..2fbd938 100644
--- cctools/include/foreign/i386/endian.h
+++ cctools/include/foreign/i386/endian.h
@@ -96,9 +96,9 @@
#define BYTE_ORDER __DARWIN_BYTE_ORDER
-#ifndef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/_endian.h>
-#endif /* !__FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
#endif /* !_I386__ENDIAN_H_ */
diff --git cctools/include/foreign/i386/signal.h cctools/include/foreign/i386/signal.h
index d729a28..5ddde95 100644
--- cctools/include/foreign/i386/signal.h
+++ cctools/include/foreign/i386/signal.h
@@ -40,9 +40,9 @@ typedef int sig_atomic_t;
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <sys/appleapiopts.h>
-#endif /* __FreeBSD__ */
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
#ifdef __APPLE_API_OBSOLETE
diff --git cctools/include/foreign/i386/types.h cctools/include/foreign/i386/types.h
index 80e9e80..13d95ec 100644
--- cctools/include/foreign/i386/types.h
+++ cctools/include/foreign/i386/types.h
@@ -67,6 +67,9 @@
#define _MACHTYPES_H_
#ifndef __ASSEMBLER__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+#include_next <machine/types.h> /* __cpu_simple_lock_t */
+#endif /* __NetBSD__ || __OpenBSD__ */
#include <i386/_types.h>
#include <sys/cdefs.h>
/*
@@ -90,9 +93,17 @@ typedef int int32_t;
typedef unsigned int u_int32_t;
#ifndef _INT64_T
#define _INT64_T
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
typedef long long int64_t;
+#else
+typedef long int64_t;
+#endif /* ! __NetBSD__ && !__OpenBSD__ */
#endif
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
typedef unsigned long long u_int64_t;
+#else
+typedef unsigned long u_int64_t;
+#endif /* ! __NetBSD__ && !__OpenBSD__ */
#if __LP64__
typedef int64_t register_t;
diff --git cctools/include/foreign/mach/vm_inherit.h cctools/include/foreign/mach/vm_inherit.h
index d6440e4..27cf97b 100644
--- cctools/include/foreign/mach/vm_inherit.h
+++ cctools/include/foreign/mach/vm_inherit.h
@@ -72,7 +72,11 @@
* vm_inherit_t inheritance codes.
*/
-typedef unsigned int vm_inherit_t; /* might want to change this */
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+typedef int vm_inherit_t; /* might want to change this */
+#else
+typedef unsigned int vm_inherit_t; /* might want to change this */
+#endif /* __NetBSD__ || __OpenBSD__ */
/*
* Enumeration of valid values for vm_inherit_t.
diff --git cctools/include/foreign/mach/vm_prot.h cctools/include/foreign/mach/vm_prot.h
index 6fe17d4..e5c8c12 100644
--- cctools/include/foreign/mach/vm_prot.h
+++ cctools/include/foreign/mach/vm_prot.h
@@ -88,6 +88,7 @@ typedef int vm_prot_t;
* The default protection for newly-created virtual memory
*/
+#undef VM_PROT_DEFAULT
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
/*
diff --git cctools/include/foreign/machine/_limits.h cctools/include/foreign/machine/_limits.h
index ef021a2..61ceec2 100644
--- cctools/include/foreign/machine/_limits.h
+++ cctools/include/foreign/machine/_limits.h
@@ -25,7 +25,7 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include_next <machine/_limits.h>
#else
#ifndef _BSD_MACHINE__LIMITS_H_
@@ -42,4 +42,4 @@
#endif
#endif /* _BSD_MACHINE__LIMITS_H_ */
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
diff --git cctools/include/foreign/machine/_types.h cctools/include/foreign/machine/_types.h
index d1b89b4..789a323 100644
--- cctools/include/foreign/machine/_types.h
+++ cctools/include/foreign/machine/_types.h
@@ -25,7 +25,7 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__)
#include_next <machine/_types.h>
#else
#ifndef _BSD_MACHINE__TYPES_H_
diff --git cctools/include/foreign/machine/endian.h cctools/include/foreign/machine/endian.h
index 9fd936a..2341cdd 100644
--- cctools/include/foreign/machine/endian.h
+++ cctools/include/foreign/machine/endian.h
@@ -28,7 +28,7 @@
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include_next <machine/endian.h>
#else
#ifndef _BSD_MACHINE_ENDIAN_H_
@@ -45,4 +45,4 @@
#endif
#endif /* _BSD_MACHINE_ENDIAN_H_ */
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
diff --git cctools/ld64/src/3rd/helper.c cctools/ld64/src/3rd/helper.c
index b75c215..d387c54 100644
--- cctools/ld64/src/3rd/helper.c
+++ cctools/ld64/src/3rd/helper.c
@@ -14,7 +14,7 @@
#include <sys/time.h>
#include <assert.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/sysctl.h>
#endif
@@ -27,6 +27,8 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg)
{
#ifdef __FreeBSD__
__assert(msg, file, line, func);
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
+ __assert(msg, line, file);
#else
__assert(msg, file, line);
#endif /* __FreeBSD__ */
diff --git cctools/ld64/src/ld/ld.cpp cctools/ld64/src/ld/ld.cpp
index ee337a0..45b7f95 100644
--- cctools/ld64/src/ld/ld.cpp
+++ cctools/ld64/src/ld/ld.cpp
@@ -37,9 +37,9 @@
#include <errno.h>
#include <limits.h>
#include <unistd.h>
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <execinfo.h>
-#endif /* __FreeBSD__ */
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
#include <mach/mach_time.h>
#include <mach/vm_statistics.h>
#include <mach/mach_init.h>
@@ -757,7 +757,7 @@ int main(int argc, const char* argv[])
// implement assert() function to print out a backtrace before aborting
void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
{
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
Snapshot *snapshot = Snapshot::globalSnapshot;
snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
@@ -783,7 +783,7 @@ void __assert_rtn(const char* func, const char* file, int line, const char* fail
snapshot->recordAssertionMessage("%d %p %s + %ld\n", i, callStack[i], symboName, offset);
}
fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
-#endif /* __FreeBSD__ */
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
exit(1);
}
diff --git cctools/libstuff/dylib_roots.c cctools/libstuff/dylib_roots.c
index eb661b0..74b6519 100644
--- cctools/libstuff/dylib_roots.c
+++ cctools/libstuff/dylib_roots.c
@@ -32,6 +32,7 @@
#include <fts.h>
#endif
#include <sys/errno.h>
+#include <errno.h>
#include "stuff/bool.h"
#include "stuff/SymLoc.h"
#include "stuff/ofile.h"
diff --git tools/find_lto_header.sh tools/find_lto_header.sh
index 665683d..6ce5979 100755
--- tools/find_lto_header.sh
+++ tools/find_lto_header.sh
@@ -26,6 +26,7 @@ try "-3.2"
try "-3.3"
try "-3.4"
try "-3.5"
+try "-devel"
try "32"
try "33"

View File

@ -1,10 +0,0 @@
--- ld64/src/ld/parsers/macho_relocatable_file.cpp 2013-11-11 20:31:31.178808527 +0100
+++ ld64/src/ld/parsers/macho_relocatable_file.cpp 2013-11-11 20:31:39.126808228 +0100
@@ -3709,6 +3709,7 @@
template <typename A>
void CFISection<A>::warnFunc(void* ref, uint64_t funcAddr, const char* msg)
{
+ return;
Parser<A>* parser = (Parser<A>*)ref;
if ( ! parser->convertUnwindInfo() )
return;

Binary file not shown.

Binary file not shown.

16
tools/stdlib-test.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <utility>
template <typename V> struct Node {
V value;
template <typename... Args>
Node(Args &&... args)
: value(std::forward<Args>(args)...) {}
};
void foo(std::pair<int const, int> const &p) {
Node<std::pair<int const, int>> node(p);
}
int main() { return 0; }

View File

@ -94,6 +94,17 @@ function verbose_cmd()
eval "$@"
}
function check_cxx_stdlib()
{
set +e
$CXX $CXXFLAGS -std=gnu++0x $BASE_DIR/tools/stdlib-test.cpp -S -o- \
2>$BUILD_DIR/stdlib-test.log 1>/dev/null
echo "$?"
set -e
}
function test_compiler()
{
echo -ne "testing $1 ... "