Ignore:
Timestamp:
Aug 3, 2011, 11:51:30 AM (14 years ago)
Author:
bird
Message:

tools/G*: debug splitting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/tools/GCC32.kmk

    r2431 r2541  
    5959TOOL_GCC32_LD_SYSMOD_MAP ?=
    6060endif
     61if1of ($(KBUILD_HOST), solaris)
     62 TOOL_GCC32_OBJCOPY ?= gobjcopy$(HOSTSUFF_EXE)
     63else
     64 TOOL_GCC32_OBJCOPY ?= objcopy$(HOSTSUFF_EXE)
     65endif
     66
    6167ifdef SLKRUNS
    62 TOOL_GCC32_CC  += -fmessage-length=0
    63 TOOL_GCC32_CXX += -fmessage-length=0
     68 TOOL_GCC32_CC  += -fmessage-length=0
     69 TOOL_GCC32_CXX += -fmessage-length=0
    6470endif
    6571
     
    227233        $(QUIET)$(APPEND) -n $(out).ar-script \
    228234                $(foreach o,$(objs), 'ADDMOD $(o)') \
    229                 $(foreach o,$(othersrc), 'ADDLIB $(o)')
     235                $(foreach o,$(filter-out %.def %.imp,$(othersrc)), 'ADDLIB $(o)')
     236        $(if $(filter %.def %.imp,$(othersrc))\
     237                ,$(TOOL_GCC32_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp,$(othersrc))\
     238                 $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
    230239        $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
    231240        $(QUIET)$(APPEND) $(out).ar-script 'END'
     
    249258TOOL_GCC32_LINK_PROGRAM_OUTPUT =
    250259TOOL_GCC32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
    251 TOOL_GCC32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     260TOOL_GCC32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
     261TOOL_GCC32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
     262TOOL_GCC32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
     263                $(filter %.def, $(othersrc))
    252264TOOL_GCC32_LINK_PROGRAM_DEPORD =
    253265define TOOL_GCC32_LINK_PROGRAM_CMDS
     
    256268                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
    257269                $(call TOOL_GCC32_LD_MAP,$(outbase).map)
     270 ifeq ($(ld_debug),split)
     271        $(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
     272        $(CHMOD) a-x $(outbase).debug
     273        $(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
     274 endif
    258275endef
    259276
     
    274291TOOL_GCC32_LINK_DLL_OUTPUT =
    275292TOOL_GCC32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
    276 TOOL_GCC32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     293TOOL_GCC32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
     294TOOL_GCC32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
     295TOOL_GCC32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
     296                $(filter %.def, $(othersrc))
    277297TOOL_GCC32_LINK_DLL_DEPORD =
    278298define TOOL_GCC32_LINK_DLL_CMDS
     
    283303                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
    284304                $(call TOOL_GCC32_LD_MAP,$(outbase).map)
     305 ifeq ($(ld_debug),split)
     306        $(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
     307        $(CHMOD) a-x $(outbase).debug
     308        $(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
     309 endif
    285310endef
    286311
     
    301326TOOL_GCC32_LINK_SYSMOD_OUTPUT =
    302327TOOL_GCC32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
    303 TOOL_GCC32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     328TOOL_GCC32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
     329TOOL_GCC32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
     330TOOL_GCC32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
     331                $(filter %.def, $(othersrc))
    304332TOOL_GCC32_LINK_SYSMOD_DEPORD =
    305333define TOOL_GCC32_LINK_SYSMOD_CMDS
    306334        $(QUIET)$(TOOL_GCC32_LD_SYSMOD) $(TOOL_GCC32_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
     335                $(filter %.def, $(othersrc))\
    307336                $(foreach p,$(libpath), -L$(p))\
    308337                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
    309338                $(call TOOL_GCC32_LD_SYSMOD_MAP,$(outbase).map)
    310 endef
    311 
     339 ifeq ($(ld_debug),split)
     340        $(TOOL_GCC32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
     341        $(CHMOD) a-x $(outbase).debug
     342        $(TOOL_GCC32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
     343 endif
     344endef
     345
Note: See TracChangeset for help on using the changeset viewer.