build: Use llvm-mc as our assembler
LLVM's assembler understands .cfi pseudo-ops on the mac, which we need in order to generate frames that can be DWARF-unwound
This commit is contained in:
parent
638b51488f
commit
4699b6865f
6 changed files with 26 additions and 6 deletions
|
@ -223,6 +223,7 @@ CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
|
|||
|
||||
# Any rules that depend on LLVM should depend on LLVM_CONFIG
|
||||
LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config
|
||||
LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc
|
||||
LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
|
||||
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
|
||||
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
|
||||
|
|
|
@ -178,6 +178,7 @@ CFG_INFO := $(info cfg: using $(CFG_C_COMPILER))
|
|||
ifeq ($(CFG_C_COMPILER),clang)
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
CPP=cpp
|
||||
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
|
||||
CFG_GCCISH_LINK_FLAGS += -g
|
||||
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
||||
|
@ -202,6 +203,7 @@ else
|
|||
ifeq ($(CFG_C_COMPILER),gcc)
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
CPP=cpp
|
||||
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
|
||||
CFG_GCCISH_LINK_FLAGS += -g
|
||||
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
||||
|
@ -228,3 +230,16 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
# We're using llvm-mc as our assembler because it supports
|
||||
# .cfi pseudo-ops on mac
|
||||
define CFG_MAKE_ASSEMBLER
|
||||
CFG_ASSEMBLE_$(1)=$$(CPP) $$(2) | \
|
||||
$$(LLVM_MC_$$(CFG_HOST_TRIPLE)) \
|
||||
-assemble \
|
||||
-filetype=obj \
|
||||
-triple=$(1) \
|
||||
-o=$$(1)
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET_TRIPLES),\
|
||||
$(eval $(call CFG_MAKE_ASSEMBLER,$(target))))
|
4
mk/rt.mk
4
mk/rt.mk
|
@ -136,9 +136,9 @@ rt/$(1)/%.o: rt/%.cpp $$(MKFILE_DEPS)
|
|||
@$$(call E, compile: $$@)
|
||||
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1))) $$<
|
||||
|
||||
rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS)
|
||||
rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) $$(LLVM_CONFIG_$$(CFG_HOST_TRIPLE))
|
||||
@$$(call E, compile: $$@)
|
||||
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1))) $$<
|
||||
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
|
||||
|
||||
rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: \
|
||||
rt/$(1)/arch/$$(HOST_$(1))/morestack.o
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
|
||||
.globl UPCALL_NEW_STACK
|
||||
.globl UPCALL_DEL_STACK
|
||||
#ifndef __APPLE__
|
||||
.globl RUST_GET_TASK
|
||||
.globl UPCALL_CALL_C_STACK
|
||||
#endif
|
||||
.globl MORESTACK
|
||||
|
||||
// FIXME: What about _WIN32?
|
||||
|
|
|
@ -91,7 +91,7 @@ MORESTACK:
|
|||
movq UPCALL_NEW_STACK@GOTPCREL(%rip), %rsi
|
||||
movq %rsp, %rdi
|
||||
#ifdef __APPLE__
|
||||
call UPCALL_CALL_C@GOTPCREL
|
||||
call UPCALL_CALL_C
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
call UPCALL_CALL_C@PLT
|
||||
|
@ -124,7 +124,7 @@ MORESTACK:
|
|||
movq UPCALL_DEL_STACK@GOTPCREL(%rip), %rsi
|
||||
movq $0, %rdi
|
||||
#ifdef __APPLE__
|
||||
call UPCALL_CALL_C@GOTPCREL
|
||||
call UPCALL_CALL_C
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
call UPCALL_CALL_C@PLT
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
#define RUSTRT_RBX 0
|
||||
#define RUSTRT_RSP 1
|
||||
#define RUSTRT_RBP 2
|
||||
#define RUSTRT_ARG0 3 // RCX on Windows, RDI elsewhere
|
||||
// RCX on Windows, RDI elsewhere
|
||||
#define RUSTRT_ARG0 3
|
||||
#define RUSTRT_R12 4
|
||||
#define RUSTRT_R13 5
|
||||
#define RUSTRT_R14 6
|
||||
#define RUSTRT_R15 7
|
||||
#define RUSTRT_IP 8
|
||||
#define RUSTRT_XXX 9 // Not used, just padding
|
||||
// Not used, just padding
|
||||
#define RUSTRT_XXX 9
|
||||
#define RUSTRT_XMM0 10
|
||||
#define RUSTRT_XMM1 12
|
||||
#define RUSTRT_XMM2 14
|
||||
|
|
Loading…
Add table
Reference in a new issue