Make ld134.9 compile with old compilers

This commit is contained in:
Thomas Pöchtrager 2015-08-29 13:32:10 +02:00
parent 65b384923e
commit 4debfb6b45
2 changed files with 32 additions and 0 deletions

View File

@ -194,6 +194,9 @@ if [ $PLATFORM == "OpenBSD" ] || [ $PLATFORM == "DragonFly" ]; then
patch -p0 < $PATCH_DIR/cctools-ld64-epath.patch patch -p0 < $PATCH_DIR/cctools-ld64-epath.patch
popd &>/dev/null popd &>/dev/null
fi fi
if [ $LINKER_VERSION == "134.9" ]; then
patch -p1 < $PATCH_DIR/cctools-ld64-134.9-old-compiler.patch
fi
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,29 @@
diff --git cctools/ld64/src/ld/code-sign-blobs/memutils.h cctools/ld64/src/ld/code-sign-blobs/memutils.h
index b0421f0..30514d3 100644
--- cctools/ld64/src/ld/code-sign-blobs/memutils.h
+++ cctools/ld64/src/ld/code-sign-blobs/memutils.h
@@ -34,6 +34,7 @@
#include <algorithm>
#ifdef __GLIBCXX__
+#include <stddef.h>
using namespace __gnu_cxx;
#endif
diff --git cctools/ld64/src/ld/parsers/macho_relocatable_file.cpp cctools/ld64/src/ld/parsers/macho_relocatable_file.cpp
index 37cd0f2..e63d1ef 100644
--- cctools/ld64/src/ld/parsers/macho_relocatable_file.cpp
+++ cctools/ld64/src/ld/parsers/macho_relocatable_file.cpp
@@ -1499,6 +1499,12 @@ ld::relocatable::File* Parser<A>::parse(const ParserOptions& opts)
uint32_t countOfCFIs = 0;
if ( _EHFrameSection != NULL )
countOfCFIs = _EHFrameSection->cfiCount();
+#ifdef __clang__
+ // Workaround to get rid of the following clang <= 3.4 error:
+ // macho_relocatable_file.cpp:1506:49: error: variable length array of non-POD element type 'typename CFISection<arm>::CFI_Atom_Info' (aka 'CFI_Atom_Info<mach_o::relocatable::CFISection<arm>::OAS>')
+ // Don't ask me why this fixes the error.
+ typename CFISection<A>::CFI_Atom_Info __clang_workaround[2];
+#endif
typename CFISection<A>::CFI_Atom_Info cfiArray[countOfCFIs];
// stack allocate (if not too large) a copy of __eh_frame to apply relocations to
uint8_t* ehBuffer = NULL;