make/common/NativeCompilation.gmk

changeset 2236
19e8754f5415
parent 2221
888144400d97
child 2316
64a3eeabf6e5
child 2403
5af73acc6b6c
     1.1 --- a/make/common/NativeCompilation.gmk	Mon Jul 16 15:37:08 2018 +0100
     1.2 +++ b/make/common/NativeCompilation.gmk	Tue Jul 17 12:55:54 2018 +0200
     1.3 @@ -260,6 +260,10 @@
     1.4      $1_CC:=$(CC)
     1.5    endif
     1.6  
     1.7 +  ifeq ($$($1_STRIP_POLICY),)
     1.8 +    $1_STRIP_POLICY:=$$(STRIP_POLICY)
     1.9 +  endif
    1.10 +
    1.11    # Make sure the dirs exist.
    1.12    $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
    1.13    $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
    1.14 @@ -455,28 +459,34 @@
    1.15          ifneq ($(OPENJDK_TARGET_OS), macosx)   # OBJCOPY is not used on MacOS X
    1.16            ifneq ($(OPENJDK_TARGET_OS), windows)  # nor on Windows
    1.17              ifeq ($(OPENJDK_TARGET_OS), solaris)
    1.18 -              # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    1.19 -              # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
    1.20 -              # empty section headers until a fixed $(OBJCOPY) is available.
    1.21 -              # An empty section header has sh_addr == 0 and sh_size == 0.
    1.22 -              # This problem has only been seen on Solaris X64, but we call this tool
    1.23 -              # on all Solaris builds just in case.
    1.24 -              #
    1.25 -              # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    1.26 -              # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    1.27 -              $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
    1.28 +              ifneq ($$($1_STRIP_POLICY), no_strip)
    1.29 +                # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    1.30 +                # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
    1.31 +                # empty section headers until a fixed $(OBJCOPY) is available.
    1.32 +                # An empty section header has sh_addr == 0 and sh_size == 0.
    1.33 +                # This problem has only been seen on Solaris X64, but we call this tool
    1.34 +                # on all Solaris builds just in case.
    1.35 +                #
    1.36 +                # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    1.37 +                # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    1.38 +                $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
    1.39  				$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
    1.40  		$(RM) $$@
    1.41  		$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
    1.42  		$(OBJCOPY) --only-keep-debug $$< $$@
    1.43  		$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
    1.44 +              endif
    1.45              else # not solaris
    1.46 -              $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
    1.47 +              ifneq ($$($1_STRIP_POLICY), no_strip)
    1.48 +                $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
    1.49  		$(RM) $$@
    1.50  		$(OBJCOPY) --only-keep-debug $$< $$@
    1.51  		$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
    1.52 +              endif
    1.53              endif # Touch to not retrigger rule on rebuild
    1.54 +            ifneq ($$($1_STRIP_POLICY), no_strip)
    1.55  		$(TOUCH) $$@
    1.56 +            endif
    1.57            endif # !windows
    1.58          endif # !macosx
    1.59  
    1.60 @@ -500,7 +510,9 @@
    1.61              $1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
    1.62                  $$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
    1.63            else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
    1.64 -            $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
    1.65 +            ifneq ($$($1_STRIP_POLICY), no_strip)
    1.66 +              $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
    1.67 +            endif
    1.68            endif
    1.69          endif
    1.70        endif
    1.71 @@ -539,28 +551,34 @@
    1.72          ifneq ($(OPENJDK_TARGET_OS), macosx)   # OBJCOPY is not used on MacOS X
    1.73            ifneq ($(OPENJDK_TARGET_OS), windows)  # nor on Windows
    1.74              ifeq ($(OPENJDK_TARGET_OS), solaris)
    1.75 -              # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    1.76 -              # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
    1.77 -              # empty section headers until a fixed $(OBJCOPY) is available.
    1.78 -              # An empty section header has sh_addr == 0 and sh_size == 0.
    1.79 -              # This problem has only been seen on Solaris X64, but we call this tool
    1.80 -              # on all Solaris builds just in case.
    1.81 -              #
    1.82 -              # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    1.83 -              # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    1.84 -              $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
    1.85 +              ifneq ($$($1_STRIP_POLICY), no_strip)
    1.86 +                # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    1.87 +                # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
    1.88 +                # empty section headers until a fixed $(OBJCOPY) is available.
    1.89 +                # An empty section header has sh_addr == 0 and sh_size == 0.
    1.90 +                # This problem has only been seen on Solaris X64, but we call this tool
    1.91 +                # on all Solaris builds just in case.
    1.92 +                #
    1.93 +                # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    1.94 +                # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    1.95 +                $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
    1.96  				$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
    1.97  		$(RM) $$@
    1.98  		$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
    1.99  		$(OBJCOPY) --only-keep-debug $$< $$@
   1.100  		$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
   1.101 +              endif
   1.102              else # not solaris
   1.103 -              $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
   1.104 +              ifneq ($$($1_STRIP_POLICY), no_strip)
   1.105 +                $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
   1.106  		$(RM) $$@
   1.107  		$(OBJCOPY) --only-keep-debug $$< $$@
   1.108  		$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
   1.109 +              endif
   1.110              endif
   1.111 +            ifneq ($$($1_STRIP_POLICY), no_strip)
   1.112  		$(TOUCH) $$@
   1.113 +            endif
   1.114            endif # !windows
   1.115          endif # !macosx
   1.116  
   1.117 @@ -584,7 +602,9 @@
   1.118              $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
   1.119                  $$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
   1.120            else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
   1.121 -            $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
   1.122 +            ifneq ($$($1_STRIP_POLICY), no_strip)
   1.123 +              $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
   1.124 +            endif
   1.125            endif
   1.126          endif
   1.127        endif

mercurial