work around a recent clang change

This commit is contained in:
Thomas Pöchtrager 2015-02-17 19:51:17 +01:00
parent cb5b96dd1e
commit 9264fa6ead
4 changed files with 75 additions and 9 deletions

View File

@ -179,6 +179,7 @@ popd &>/dev/null
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
patch -p1 < $PATCH_DIR/cctools-ld64-strnlen.patch patch -p1 < $PATCH_DIR/cctools-ld64-strnlen.patch
patch -p0 < $PATCH_DIR/cctools-ld64-llvm-3.7.patch
echo "" echo ""
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET" CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET"
[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+=" --enable-lto=no" [ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+=" --enable-lto=no"

View File

@ -0,0 +1,49 @@
--- 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

@ -246,7 +246,7 @@ const std::string Target::getFullCompilerName() const {
return compiler; return compiler;
} }
bool Target::findClangIntrinsicHeaders(std::string &path) const { bool Target::findClangIntrinsicHeaders(std::string &path) {
std::string clangbin; std::string clangbin;
static std::stringstream dir; static std::stringstream dir;
@ -257,11 +257,13 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
if (clangbin.empty()) if (clangbin.empty())
return false; return false;
static ClangVersion clangversion; static ClangVersion *clangversion;
static std::string pathtmp; static std::string pathtmp;
clangversion = &this->clangversion;
clear(dir); clear(dir);
clangversion = ClangVersion(); *clangversion = ClangVersion();
pathtmp.clear(); pathtmp.clear();
auto check = []()->bool { auto check = []()->bool {
@ -283,8 +285,8 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
file << "/xmmintrin.h"; file << "/xmmintrin.h";
if (fileExists(file.str())) { if (fileExists(file.str())) {
if (cv > clangversion) { if (cv > *clangversion) {
clangversion = cv; *clangversion = cv;
pathtmp.swap(intrindir); pathtmp.swap(intrindir);
} }
return true; return true;
@ -308,7 +310,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
return true; return true;
}); });
return clangversion != ClangVersion(); return *clangversion != ClangVersion();
}; };
dir << clangbin << "/../lib/clang"; dir << clangbin << "/../lib/clang";
@ -341,7 +343,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
} }
path.swap(pathtmp); path.swap(pathtmp);
return clangversion != ClangVersion(); return *clangversion != ClangVersion();
} }
void Target::setupGCCLibs(Arch arch) { void Target::setupGCCLibs(Arch arch) {
@ -612,6 +614,19 @@ bool Target::setup() {
// Use libs from './build_gcc' installation // Use libs from './build_gcc' installation
setupGCCLibs(targetarch[0]); setupGCCLibs(targetarch[0]);
} }
#ifndef __APPLE__
// TODO: Need a way to distinguish between vanilla and Xcode clang
// versions.
if (clangversion >= ClangVersion(3, 7, 0) &&
!getenv("OSXCROSS_NO_DEF_SIZED_DELETE")) {
// Will run into linker errors otherwise with not so recent libc++
// and libstdc++ versions.
if (!usegcclibs || gccversion < GCCVersion(5, 0, 0))
fargs.push_back("-fdef-sized-delete");
}
#endif
} }
} else if (isGCC()) { } else if (isGCC()) {

View File

@ -134,7 +134,7 @@ struct Target {
const std::string &getTriple() const { return triple; } const std::string &getTriple() const { return triple; }
const std::string getFullCompilerName() const; const std::string getFullCompilerName() const;
bool findClangIntrinsicHeaders(std::string &path) const; bool findClangIntrinsicHeaders(std::string &path);
void setupGCCLibs(Arch arch); void setupGCCLibs(Arch arch);
bool setup(); bool setup();
@ -145,8 +145,9 @@ struct Target {
std::string target; std::string target;
OSVersion OSNum; OSVersion OSNum;
StdLib stdlib; StdLib stdlib;
bool usegcclibs; ClangVersion clangversion;
GCCVersion gccversion; GCCVersion gccversion;
bool usegcclibs;
bool nocodegen; bool nocodegen;
std::string compiler; std::string compiler;
std::string triple; std::string triple;