wrappers: Use clang config files for defaults
This makes these defaults more easy to get picked up in various use cases, when not directly executing a compiler.
This commit is contained in:
1 parent
0ebb52ae0e
commit
e2e9216853
10 files changed
+34
-39
No files matched your search
+1
-1
@@ -24,7 +24,7 @@ ARG CFGUARD_ARGS=--enable-cfguard
|
||||
|
||||
# Build everything that uses the llvm monorepo. We need to build the mingw runtime before the compiler-rt/libunwind/libcxxabi/libcxx runtimes.
|
||||
COPY build-llvm.sh build-lldb-mi.sh strip-llvm.sh install-wrappers.sh build-mingw-w64.sh build-mingw-w64-tools.sh build-compiler-rt.sh build-libcxx.sh build-mingw-w64-libraries.sh build-openmp.sh ./
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h wrappers/*.cfg ./wrappers/
|
||||
RUN ./build-llvm.sh $TOOLCHAIN_PREFIX && \
|
||||
./build-lldb-mi.sh $TOOLCHAIN_PREFIX && \
|
||||
./strip-llvm.sh $TOOLCHAIN_PREFIX && \
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ ARG TOOLCHAIN_ARCHS="i686 x86_64 armv7 aarch64"
|
||||
COPY build-mingw-w64.sh build-mingw-w64-tools.sh ./
|
||||
RUN ./build-mingw-w64-tools.sh $CROSS_TOOLCHAIN_PREFIX --skip-include-triplet-prefix --host=$HOST
|
||||
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h wrappers/*.cfg ./wrappers/
|
||||
COPY install-wrappers.sh .
|
||||
RUN ./install-wrappers.sh $CROSS_TOOLCHAIN_PREFIX --host=$HOST
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ RUN ./strip-llvm.sh $TOOLCHAIN_PREFIX
|
||||
ARG TOOLCHAIN_ARCHS="i686 x86_64 armv7 aarch64"
|
||||
|
||||
# Install the usual $TUPLE-clang binaries
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/
|
||||
COPY wrappers/*.sh wrappers/*.c wrappers/*.h wrappers/*.cfg ./wrappers/
|
||||
COPY install-wrappers.sh ./
|
||||
RUN ./install-wrappers.sh $TOOLCHAIN_PREFIX
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ fi
|
||||
|
||||
mkdir -p "$PREFIX/bin"
|
||||
cp wrappers/*-wrapper.sh "$PREFIX/bin"
|
||||
for arch in $ARCHS; do
|
||||
cp wrappers/$arch-w64-mingw32.cfg $PREFIX/bin
|
||||
done
|
||||
if [ -n "$HOST" ] && [ -n "$EXEEXT" ]; then
|
||||
# TODO: If building natively on msys, pick up the default HOST value from there.
|
||||
WRAPPER_FLAGS="$WRAPPER_FLAGS -DDEFAULT_TARGET=\"$HOST\""
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-target aarch64-w64-mingw32
|
||||
-rtlib=compiler-rt
|
||||
-unwindlib=libunwind
|
||||
-stdlib=libc++
|
||||
-fuse-ld=lld
|
||||
# SEH is the default for aarch64.
|
||||
@@ -0,0 +1,6 @@
|
||||
-target armv7-w64-mingw32
|
||||
-rtlib=compiler-rt
|
||||
-unwindlib=libunwind
|
||||
-stdlib=libc++
|
||||
-fuse-ld=lld
|
||||
# SEH is the default for armv7.
|
||||
@@ -50,7 +50,7 @@ int _tmain(int argc, TCHAR* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
int max_arg = argc + 22;
|
||||
int max_arg = argc + 18;
|
||||
const TCHAR **exec_argv = malloc((max_arg + 1) * sizeof(*exec_argv));
|
||||
int arg = 0;
|
||||
if (getenv("CCACHE"))
|
||||
@@ -66,16 +66,6 @@ int _tmain(int argc, TCHAR* argv[]) {
|
||||
else if (!_tcscmp(exe, _T("c11")))
|
||||
exec_argv[arg++] = _T("-std=c11");
|
||||
|
||||
if (!_tcscmp(arch, _T("i686"))) {
|
||||
// Dwarf is the default for i686.
|
||||
} else if (!_tcscmp(arch, _T("x86_64"))) {
|
||||
// SEH is the default for x86_64.
|
||||
} else if (!_tcscmp(arch, _T("armv7"))) {
|
||||
// SEH is the default for armv7.
|
||||
} else if (!_tcscmp(arch, _T("aarch64"))) {
|
||||
// SEH is the default for aarch64.
|
||||
}
|
||||
|
||||
if (target_os && !_tcscmp(target_os, _T("mingw32uwp"))) {
|
||||
// the UWP target is for Windows 10
|
||||
exec_argv[arg++] = _T("-D_WIN32_WINNT=0x0A00");
|
||||
@@ -88,12 +78,8 @@ int _tmain(int argc, TCHAR* argv[]) {
|
||||
exec_argv[arg++] = _T("-D_UCRT");
|
||||
}
|
||||
|
||||
exec_argv[arg++] = _T("-target");
|
||||
exec_argv[arg++] = target;
|
||||
exec_argv[arg++] = _T("-rtlib=compiler-rt");
|
||||
exec_argv[arg++] = _T("-unwindlib=libunwind");
|
||||
exec_argv[arg++] = _T("-stdlib=libc++");
|
||||
exec_argv[arg++] = _T("-fuse-ld=lld");
|
||||
exec_argv[arg++] = _T("--config");
|
||||
exec_argv[arg++] = concat(arch, _T("-w64-mingw32.cfg"));
|
||||
exec_argv[arg++] = _T("--end-no-unused-arguments");
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
|
||||
@@ -67,20 +67,6 @@ c11)
|
||||
FLAGS="$FLAGS -std=c11"
|
||||
;;
|
||||
esac
|
||||
case $ARCH in
|
||||
i686)
|
||||
# Dwarf is the default for i686.
|
||||
;;
|
||||
x86_64)
|
||||
# SEH is the default for x86_64.
|
||||
;;
|
||||
armv7)
|
||||
# SEH is the default for armv7.
|
||||
;;
|
||||
aarch64)
|
||||
# SEH is the default for aarch64.
|
||||
;;
|
||||
esac
|
||||
LINKER_FLAGS=""
|
||||
case $TARGET_OS in
|
||||
mingw32uwp)
|
||||
@@ -106,11 +92,7 @@ mingw32uwp)
|
||||
;;
|
||||
esac
|
||||
|
||||
FLAGS="$FLAGS -target $TARGET"
|
||||
FLAGS="$FLAGS -rtlib=compiler-rt"
|
||||
FLAGS="$FLAGS -unwindlib=libunwind"
|
||||
FLAGS="$FLAGS -stdlib=libc++"
|
||||
FLAGS="$FLAGS -fuse-ld=lld"
|
||||
FLAGS="$FLAGS --config $ARCH-w64-mingw32.cfg"
|
||||
FLAGS="$FLAGS --end-no-unused-arguments"
|
||||
|
||||
$CCACHE "$CLANG" $FLAGS "$@" $LINKER_FLAGS
|
||||
@@ -0,0 +1,6 @@
|
||||
-target i686-w64-mingw32
|
||||
-rtlib=compiler-rt
|
||||
-unwindlib=libunwind
|
||||
-stdlib=libc++
|
||||
-fuse-ld=lld
|
||||
# Dwarf is the default for i686.
|
||||
@@ -0,0 +1,6 @@
|
||||
-target x86_64-w64-mingw32
|
||||
-rtlib=compiler-rt
|
||||
-unwindlib=libunwind
|
||||
-stdlib=libc++
|
||||
-fuse-ld=lld
|
||||
# SEH is the default for x86_64.
|
||||
Reference in new issue
Block a user