mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-03 22:45:56 +01:00
work around a recent clang change
This commit is contained in:
parent
cb5b96dd1e
commit
9264fa6ead
1
build.sh
1
build.sh
@ -179,6 +179,7 @@ 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
|
||||
echo ""
|
||||
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET"
|
||||
[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+=" --enable-lto=no"
|
||||
|
49
patches/cctools-ld64-llvm-3.7.patch
Normal file
49
patches/cctools-ld64-llvm-3.7.patch
Normal 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
|
@ -246,7 +246,7 @@ const std::string Target::getFullCompilerName() const {
|
||||
return compiler;
|
||||
}
|
||||
|
||||
bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
||||
bool Target::findClangIntrinsicHeaders(std::string &path) {
|
||||
std::string clangbin;
|
||||
static std::stringstream dir;
|
||||
|
||||
@ -257,11 +257,13 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
||||
if (clangbin.empty())
|
||||
return false;
|
||||
|
||||
static ClangVersion clangversion;
|
||||
static ClangVersion *clangversion;
|
||||
static std::string pathtmp;
|
||||
|
||||
clangversion = &this->clangversion;
|
||||
|
||||
clear(dir);
|
||||
clangversion = ClangVersion();
|
||||
*clangversion = ClangVersion();
|
||||
pathtmp.clear();
|
||||
|
||||
auto check = []()->bool {
|
||||
@ -283,8 +285,8 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
||||
file << "/xmmintrin.h";
|
||||
|
||||
if (fileExists(file.str())) {
|
||||
if (cv > clangversion) {
|
||||
clangversion = cv;
|
||||
if (cv > *clangversion) {
|
||||
*clangversion = cv;
|
||||
pathtmp.swap(intrindir);
|
||||
}
|
||||
return true;
|
||||
@ -308,7 +310,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
||||
return true;
|
||||
});
|
||||
|
||||
return clangversion != ClangVersion();
|
||||
return *clangversion != ClangVersion();
|
||||
};
|
||||
|
||||
dir << clangbin << "/../lib/clang";
|
||||
@ -341,7 +343,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
||||
}
|
||||
|
||||
path.swap(pathtmp);
|
||||
return clangversion != ClangVersion();
|
||||
return *clangversion != ClangVersion();
|
||||
}
|
||||
|
||||
void Target::setupGCCLibs(Arch arch) {
|
||||
@ -612,6 +614,19 @@ bool Target::setup() {
|
||||
// Use libs from './build_gcc' installation
|
||||
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()) {
|
||||
|
||||
|
@ -134,7 +134,7 @@ struct Target {
|
||||
const std::string &getTriple() const { return triple; }
|
||||
|
||||
const std::string getFullCompilerName() const;
|
||||
bool findClangIntrinsicHeaders(std::string &path) const;
|
||||
bool findClangIntrinsicHeaders(std::string &path);
|
||||
|
||||
void setupGCCLibs(Arch arch);
|
||||
bool setup();
|
||||
@ -145,8 +145,9 @@ struct Target {
|
||||
std::string target;
|
||||
OSVersion OSNum;
|
||||
StdLib stdlib;
|
||||
bool usegcclibs;
|
||||
ClangVersion clangversion;
|
||||
GCCVersion gccversion;
|
||||
bool usegcclibs;
|
||||
bool nocodegen;
|
||||
std::string compiler;
|
||||
std::string triple;
|
||||
|
Loading…
Reference in New Issue
Block a user