LLVM_TARGET fixes

This commit is contained in:
Cody P Schafer
2014-11-20 20:31:26 -05:00
parent 94b93d5eeb
commit 9f180fdf7b
2 changed files with 34 additions and 4 deletions
@@ -1,13 +1,40 @@
From 0f6c3e00618fae91987e7d5bf52dbd63ec291f99 Mon Sep 17 00:00:00 2001
From 12749fc8ec3f110d3fb8057b955c7fab98f85730 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Thu, 20 Nov 2014 15:56:58 -0500
Subject: [PATCH] mk/rt: use CFG_LLVM_TARGET instead of plain target when
calling llc
---
mk/rt.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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.
---
mk/main.mk | 7 +++++--
mk/rt.mk | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/mk/main.mk b/mk/main.mk
index 3df4d3b..2e759a1 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -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 :=
diff --git a/mk/rt.mk b/mk/rt.mk
index a7d6a6e..38aec83 100644
--- a/mk/rt.mk
+3
View File
@@ -214,6 +214,7 @@ def rust_gen_mk_cfg(d, thing):
arch = arch_for(d, thing)
sys = sys_for(d, thing)
prefix = prefix_for(d, thing)
llvm_target = d.getVarFlag('LLVM_TARGET', arch, True)
ldflags = ' '.join(ldflags_for(d, thing, arch))
p = d.getVar('S', True) + '/mk/cfg/'
@@ -230,6 +231,8 @@ def rust_gen_mk_cfg(d, thing):
# all targets define it.
'-e', 's/^CROSS_PREFIX_{}.*$//'.format(sys),
'-e', '2 a CROSS_PREFIX_{} := {}'.format(sys, prefix),
'-e', 's/^CFG_LLVM_TARGET_.*$//',
'-e' '2 a CFG_LLVM_TARGET_{} := {}'.format(sys, llvm_target),
'-e', 's/^CC_{}=.*$/CC_{} := gcc/'.format(sys, sys),
'-e', 's/^CXX_{}.*$/CXX_{} := g++/'.format(sys, sys),
'-e', 's/^CPP_{}.*$/CPP_{} := gcc -E/'.format(sys, sys),