[PATCH] D12401: Handling i686 architecture in makefiles for clang.

Nishanth H. Kottary via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 02:32:52 PDT 2015


nishanth-kottary created this revision.
nishanth-kottary added reviewers: samsonov, loladiro.
nishanth-kottary added a subscriber: cfe-commits.
nishanth-kottary set the repository for this revision to rL LLVM.

This is a part of D12316. Added i686 names for 32bit runtime configs so that built files will have the appropriate names.

Repository:
  rL LLVM

http://reviews.llvm.org/D12401

Files:
  runtime/compiler-rt/Makefile

Index: runtime/compiler-rt/Makefile
===================================================================
--- runtime/compiler-rt/Makefile
+++ runtime/compiler-rt/Makefile
@@ -121,13 +121,29 @@
     $(1) $$cflags $(2) -o /dev/null > /dev/null 2> /dev/null ; \
     echo $$?)
 
+# Finding CompilerTargetArch copied from clang_linux.mk
+CompilerTargetTriple := $(shell \
+	LANG=C $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2)
+ifeq ($(CompilerTargetTriple),)
+$(error "unable to infer compiler target triple for $(CC)")
+endif
+
+# Define configs only if arch in triple is i386 or x86_64
+CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple)))
+
 # We try to build 32-bit runtimes both on 32-bit hosts and 64-bit hosts.
-Runtime32BitConfigs = \
+Runtime32Bit-i386Configs = \
 	builtins-i386.a profile-i386.a
+Runtime32Bit-i686Configs = \
+	builtins-i686.a profile-i686.a
 
 # We currently only try to generate runtime libraries on x86.
 ifeq ($(ARCH),x86)
-RuntimeLibrary.linux.Configs += $(Runtime32BitConfigs)
+ifeq ($(CompilerTargetArch), i386)
+RuntimeLibrary.linux.Configs += $(Runtime32Bit-i386Configs)
+else ifeq ($(CompilerTargetArch), i686)
+RuntimeLibrary.linux.Configs += $(Runtime32Bit-i686Configs)
+endif
 endif
 
 ifeq ($(ARCH),x86_64)
@@ -139,7 +155,7 @@
 # executable.
 test_source = $(LLVM_SRC_ROOT)/tools/clang/runtime/compiler-rt/clang_linux_test_input.c
 ifeq ($(call TryCompile,$(ToolDir)/clang,$(test_source),-m32),0)
-RuntimeLibrary.linux.Configs += $(Runtime32BitConfigs)
+RuntimeLibrary.linux.Configs += $(Runtime32Bit-i386Configs)
 endif
 endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12401.33306.patch
Type: text/x-patch
Size: 1588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150827/25966aa3/attachment.bin>


More information about the cfe-commits mailing list