72 # LD - The Linker |
72 # LD - The Linker |
73 # AR - Static linker |
73 # AR - Static linker |
74 # AS - Assembler |
74 # AS - Assembler |
75 # MT - Windows MT tool |
75 # MT - Windows MT tool |
76 # RC - Windows RC tool |
76 # RC - Windows RC tool |
|
77 # OBJCOPY - The objcopy tool for debug symbol handling |
77 # STRIP - The tool to use for stripping debug symbols |
78 # STRIP - The tool to use for stripping debug symbols |
78 # SYSROOT_CFLAGS - Compiler flags for using the specific sysroot |
79 # SYSROOT_CFLAGS - Compiler flags for using the specific sysroot |
79 # SYSROOT_LDFLAGS - Linker flags for using the specific sysroot |
80 # SYSROOT_LDFLAGS - Linker flags for using the specific sysroot |
80 DefineNativeToolchain = $(NamedParamsMacroTemplate) |
81 DefineNativeToolchain = $(NamedParamsMacroTemplate) |
81 define DefineNativeToolchainBody |
82 define DefineNativeToolchainBody |
88 $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) |
89 $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) |
89 $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) |
90 $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) |
90 $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) |
91 $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) |
91 $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) |
92 $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) |
92 $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) |
93 $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) |
|
94 $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_EXTENDS)_OBJCOPY)) |
93 $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP)) |
95 $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP)) |
94 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) |
96 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) |
95 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) |
97 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) |
96 endif |
98 endif |
97 endef |
99 endef |
116 LD := $(LDCXX), \ |
119 LD := $(LDCXX), \ |
117 )) |
120 )) |
118 |
121 |
119 # Create a toolchain with the BUILD compiler, used for build tools that |
122 # Create a toolchain with the BUILD compiler, used for build tools that |
120 # are to be run during the build. |
123 # are to be run during the build. |
121 # The BUILD_SYSROOT_*FLAGS variables are empty for now. |
|
122 $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \ |
124 $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \ |
123 CC := $(BUILD_CC), \ |
125 CC := $(BUILD_CC), \ |
124 CXX := $(BUILD_CXX), \ |
126 CXX := $(BUILD_CXX), \ |
125 LD := $(BUILD_LD), \ |
127 LD := $(BUILD_LD), \ |
126 AR := $(BUILD_AR), \ |
128 AR := $(BUILD_AR), \ |
127 AS := $(BUILD_AS), \ |
129 AS := $(BUILD_AS), \ |
|
130 OBJCOPY := $(BUILD_OBJCOPY), \ |
|
131 STRIP := $(BUILD_STRIP), \ |
128 SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \ |
132 SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \ |
129 SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \ |
133 SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \ |
130 )) |
134 )) |
131 |
135 |
132 # BUILD toolchain with the C++ linker |
136 # BUILD toolchain with the C++ linker |
435 $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) |
439 $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) |
436 $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) |
440 $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) |
437 $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) |
441 $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) |
438 $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) |
442 $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) |
439 $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) |
443 $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) |
|
444 $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_TOOLCHAIN)_OBJCOPY)) |
440 $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP)) |
445 $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP)) |
441 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) |
446 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) |
442 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) |
447 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) |
443 |
448 |
444 ifneq ($$($1_MANIFEST), ) |
449 ifneq ($$($1_MANIFEST), ) |
718 else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) |
723 else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) |
719 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo |
724 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo |
720 # Setup the command line creating debuginfo files, to be run after linking. |
725 # Setup the command line creating debuginfo files, to be run after linking. |
721 # It cannot be run separately since it updates the original target file |
726 # It cannot be run separately since it updates the original target file |
722 $1_CREATE_DEBUGINFO_CMDS := \ |
727 $1_CREATE_DEBUGINFO_CMDS := \ |
723 $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \ |
728 $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \ |
724 $(CD) $$($1_OUTPUT_DIR) && \ |
729 $(CD) $$($1_OUTPUT_DIR) && \ |
725 $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET) |
730 $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET) |
726 |
731 |
727 else ifeq ($(OPENJDK_TARGET_OS), macosx) |
732 else ifeq ($(OPENJDK_TARGET_OS), macosx) |
728 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM |
733 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM |
729 # On Macosx, the debuginfo generation doesn't touch the linked binary, but |
734 # On Macosx, the debuginfo generation doesn't touch the linked binary, but |
730 # to avoid always relinking, touch it anyway to force a later timestamp than |
735 # to avoid always relinking, touch it anyway to force a later timestamp than |