Fix linking libLTO on 64-bit Cygwin (#91)

This commit is contained in:
Thomas Pöchtrager 2016-10-31 12:51:08 +01:00
parent 957825330d
commit 2b3387844c

View File

@ -36,14 +36,23 @@ echo " LLVM*;" >> cyglto.exports
echo " local: *;" >> cyglto.exports
echo "};" >> cyglto.exports
if [ $ARCH == "x86_64" ]; then
# https://github.com/tpoechtrager/osxcross/issues/91
mkdir -p llvm/LTO
echo "#undef off_t" > llvm/LTO/LTOModule.h
echo "#define off_t long long" >> llvm/LTO/LTOModule.h
echo "#include_next \"llvm/LTO/LTOModule.h\"" >> llvm/LTO/LTOModule.h
CXXFLAGS="-I $TMP $CXXFLAGS"
fi
popd &>/dev/null
set -x
g++ -shared \
-L$LIBDIR -I$INCDIR $CXXFLAGS $LDFLAGS \
-Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \
$TMP/lto.cpp $TMP/LTODisassembler.cpp -Wl,-version-script,$TMP/cyglto.exports \
-Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \
-o /bin/cygLTO.dll -Wl,--out-implib,/lib/libLTO.dll.a
rm -rf $TMP