[Lldb-commits] [PATCH] D20386: Correct makefile.rules to use arm/aarch64 target specific AR and OBJCOPY

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 03:35:01 PDT 2016


omjavaid updated this revision to Diff 67669.
omjavaid added a comment.
Herald added a subscriber: srhines.

Updated with suggestion incorporated.

Here's what I am getting on different inputs:

Testing make clean CC=gcc
ar
objcopy

Testing make clean CC=clang
ar
objcopy

Testing make clean CC=gcc-5
ar
objcopy

Testing make clean CC=clang-3.8
ar
objcopy

Testing make clean CC=arm-linux-gnueabihf-gcc ARCH=arm
arm-linux-gnueabihf-ar
arm-linux-gnueabihf-objcopy

Testing make clean CC=arm-linux-gnueabihf-gcc-5 ARCH=arm
arm-linux-gnueabihf-ar
arm-linux-gnueabihf-objcopy

Testing make clean CC=/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-gcc ARCH=arm
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-ar
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-objcopy

Testing make clean CC=/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-gcc-4.9 ARCH=arm
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-ar
/home/omair/work/toolchains/arm32-android-toolchain/bin/arm-linux-androideabi-objcopy


https://reviews.llvm.org/D20386

Files:
  packages/Python/lldbsuite/test/make/Makefile.rules

Index: packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -265,7 +265,32 @@
                                         $(subst cc,c++,$(1))))))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1)))
 
-OBJCOPY := $(CROSS_COMPILE)objcopy
+ifneq "$(OS)" "Darwin"
+    CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
+                                 $(findstring clang,$(CC)), \
+                                 $(if $(findstring gcc,$(CC)), \
+                                      $(findstring gcc,$(CC)), \
+                                      cc)))
+
+    CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC))))
+
+    replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
+                           $(subst $(3),$(1),$(2)), \
+                           $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)))))
+
+    ifeq "$(notdir $(CC))" "$(CC)"
+        replace_cc_with = $(call replace_with,$(1),$(CC),$(CLANG_OR_GCC))
+    else
+        replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC)))
+    endif
+
+    OBJCOPY = $(call replace_cc_with,objcopy)
+    AR = $(call replace_cc_with,ar)
+endif
+
+ifdef PIE
+    LDFLAGS += -pie
+endif
 
 #----------------------------------------------------------------------
 # Windows specific options
@@ -285,27 +310,6 @@
 endif
 
 #----------------------------------------------------------------------
-# Android specific options
-#----------------------------------------------------------------------
-ifeq "$(OS)" "Android"
-    ifdef PIE
-        LDFLAGS += -pie
-    endif
-    replace_with = $(if $(findstring clang,$(1)), \
-                        $(subst clang,$(2),$(1)), \
-                        $(if $(findstring gcc,$(1)), \
-                             $(subst gcc,$(2),$(1)), \
-                             $(subst cc,$(2),$(1))))
-    ifeq "$(notdir $(CC))" "$(CC)"
-        replace_cc_with = $(call replace_with,$(CC),$(1))
-    else
-        replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir $(CC)),$(1)))
-    endif
-    OBJCOPY = $(call replace_cc_with,objcopy)
-    AR = $(call replace_cc_with,ar)
-endif
-
-#----------------------------------------------------------------------
 # C++ standard library options
 #----------------------------------------------------------------------
 ifeq (1,$(USE_LIBSTDCPP))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20386.67669.patch
Type: text/x-patch
Size: 2623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160811/6cf103cf/attachment-0001.bin>


More information about the lldb-commits mailing list