Skip to content

Commit f351b69

Browse files
committed
Revert "Build compiler-rt/builtins with MSVC"
This reverts commit b09e8f5.
1 parent 9e99367 commit f351b69

File tree

2 files changed

+34
-51
lines changed

2 files changed

+34
-51
lines changed

configure

+19-27
Original file line numberDiff line numberDiff line change
@@ -1498,9 +1498,25 @@ do
14981498
done
14991499
fi
15001500

1501-
# We need the generator later on for compiler-rt even if LLVM's not built
1502-
if [ ${is_msvc} -ne 0 ]
1501+
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -ne 0 ]
15031502
then
1503+
msg "configuring LLVM for $t with cmake"
1504+
1505+
CMAKE_ARGS="-DLLVM_INCLUDE_TESTS=OFF"
1506+
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
1507+
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
1508+
else
1509+
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
1510+
fi
1511+
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
1512+
then
1513+
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
1514+
else
1515+
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
1516+
fi
1517+
1518+
msg "configuring LLVM with:"
1519+
msg "$CMAKE_ARGS"
15041520
case "$CFG_MSVC_ROOT" in
15051521
*14.0*)
15061522
generator="Visual Studio 14 2015"
@@ -1522,32 +1538,8 @@ do
15221538
err "can only build LLVM for x86 platforms"
15231539
;;
15241540
esac
1525-
CFG_CMAKE_GENERATOR=$generator
1526-
putvar CFG_CMAKE_GENERATOR
1527-
fi
1528-
1529-
if [ ${do_reconfigure} -ne 0 ] && [ ${is_msvc} -ne 0 ]
1530-
then
1531-
msg "configuring LLVM for $t with cmake"
1532-
1533-
CMAKE_ARGS="-DLLVM_INCLUDE_TESTS=OFF"
1534-
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
1535-
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
1536-
else
1537-
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
1538-
fi
1539-
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
1540-
then
1541-
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
1542-
else
1543-
CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
1544-
fi
1545-
1546-
msg "configuring LLVM with:"
1547-
msg "$CMAKE_ARGS"
1548-
15491541
(cd $LLVM_BUILD_DIR && "$CFG_CMAKE" $CFG_LLVM_SRC_DIR \
1550-
-G "$CFG_CMAKE_GENERATOR" \
1542+
-G "$generator" \
15511543
$CMAKE_ARGS)
15521544
need_ok "LLVM cmake configure failed"
15531545
fi

mk/rt.mk

+15-24
Original file line numberDiff line numberDiff line change
@@ -216,31 +216,22 @@ COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
216216
COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
217217
COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
218218

219-
ifeq ($$(findstring msvc,$(1)),msvc)
220-
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
221-
@$$(call E, cmake: compiler-rt)
222-
$$(Q)cd "$$(COMPRT_BUILD_DIR_$(1))"; $$(CFG_CMAKE) "$(S)src/compiler-rt" \
223-
-DCMAKE_BUILD_TYPE=$$(LLVM_BUILD_CONFIG_MODE) \
224-
-DLLVM_CONFIG_PATH=$$(LLVM_CONFIG_$(1)) \
225-
-G"$$(CFG_CMAKE_GENERATOR)"
226-
$$(Q)$$(CFG_CMAKE) --build "$$(COMPRT_BUILD_DIR_$(1))" \
227-
--target lib/builtins/builtins \
228-
--config $$(LLVM_BUILD_CONFIG_MODE) \
229-
-- //v:m //nologo
230-
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/lib/windows/$$(LLVM_BUILD_CONFIG_MODE)/clang_rt.builtins-$$(HOST_$(1)).lib $$@
231-
else
219+
# Note that on MSVC-targeting builds we hardwire CC/AR to gcc/ar even though
220+
# we're targeting MSVC. This is because although compiler-rt has a CMake build
221+
# config I can't actually figure out how to use it, so I'm not sure how to use
222+
# cl.exe to build the objects. Additionally, the compiler-rt library when built
223+
# with gcc has the same ABI as cl.exe, so they're largely compatible
232224
COMPRT_CC_$(1) := $$(CC_$(1))
233225
COMPRT_AR_$(1) := $$(AR_$(1))
234-
# We chomp -Werror here because GCC warns about the type signature of
235-
# builtins not matching its own and the build fails. It's a bit hacky,
236-
# but what can we do, we're building libclang-rt using GCC ......
237-
COMPRT_CFLAGS_$(1) := $$(subst -Werror,,$$(CFG_GCCISH_CFLAGS_$(1))) -std=c99
238-
239-
# FreeBSD Clang's packaging is problematic; it doesn't copy unwind.h to
240-
# the standard include directory. This should really be in our changes to
241-
# compiler-rt, but we override the CFLAGS here so there isn't much choice
242-
ifeq ($$(findstring freebsd,$(1)),freebsd)
243-
COMPRT_CFLAGS_$(1) += -I/usr/include/c++/v1
226+
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1))
227+
ifeq ($$(findstring msvc,$(1)),msvc)
228+
COMPRT_CC_$(1) := gcc
229+
COMPRT_AR_$(1) := ar
230+
ifeq ($$(findstring i686,$(1)),i686)
231+
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -m32
232+
else
233+
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -m64
234+
endif
244235
endif
245236

246237
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
@@ -255,7 +246,7 @@ $$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
255246
TargetTriple=$(1) \
256247
triple-builtins
257248
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/builtins/libcompiler_rt.a $$@
258-
endif
249+
259250
################################################################################
260251
# libbacktrace
261252
#

0 commit comments

Comments
 (0)