Skip to content

Commit

Permalink
mk/rt: use CFG_LLVM_TARGET instead of plain target when calling llc
Browse files Browse the repository at this point in the history
We add CFG_LLVM_TARGET_$(target) (which can be defined in any of the
mk/cfg/* files) and supply a default to the plain target name

CFG_LLVM_TARGET mirrors the value of llvm_target (aka llvm-target) in
the librustc_back runtime target specification.
  • Loading branch information
codyps committed Nov 20, 2014
1 parent 9c320dd commit 12749fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions mk/main.mk
Expand Up @@ -190,11 +190,14 @@ endif
# Target-and-rule "utility variables"
######################################################################

define DEF_X
define DEF_FOR_TARGET
X_$(1) := $(CFG_EXE_SUFFIX_$(1))
ifndef CFG_LLVM_TARGET_$(1)
CFG_LLVM_TARGET_$(1) := $(1)
endif
endef
$(foreach target,$(CFG_TARGET), \
$(eval $(call DEF_X,$(target))))
$(eval $(call DEF_FOR_TARGET,$(target))))

# "Source" files we generate in builddir along the way.
GENERATED :=
Expand Down
2 changes: 1 addition & 1 deletion mk/rt.mk
Expand Up @@ -75,7 +75,7 @@ $$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.ll $$(MKFILE_DEPS) \
@mkdir -p $$(@D)
@$$(call E, compile: $$@)
$$(Q)$$(LLC_$$(CFG_BUILD)) $$(CFG_LLC_FLAGS_$(1)) \
-filetype=obj -mtriple=$(1) -relocation-model=pic -o $$@ $$<
-filetype=obj -mtriple=$$(CFG_LLVM_TARGET_$(1)) -relocation-model=pic -o $$@ $$<

$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
@mkdir -p $$(@D)
Expand Down

0 comments on commit 12749fc

Please sign in to comment.