Index: tools/build/v2/tools/gcc.jam =================================================================== --- tools/build/v2/tools/gcc.jam (revision 50700) +++ tools/build/v2/tools/gcc.jam (working copy) @@ -195,6 +195,18 @@ ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ; } + # - The objcopy helper. + local objcopy = + [ common.get-invocation-command gcc + : objcopy : [ feature.get-values : $(options) ] : $(bin) : search-path ] ; + toolset.flags gcc.archive .OBJCOPY $(condition) : $(objcopy[1]) ; + toolset.flags gcc.link .OBJCOPY $(condition) : $(objcopy[1]) ; + if $(.debug-configuration) + { + ECHO notice: using gcc objcopy :: $(condition) :: $(objcopy[1]) ; + } + + # - The resource compiler. local rc = [ common.get-invocation-command-nodefault gcc @@ -733,6 +745,10 @@ { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) + "$(.OBJCOPY)" --only-keep-debug "$(<)" "$(<).debug" + "$(.OBJCOPY)" --strip-debug "$(<)" + "$(.OBJCOPY)" --add-gnu-debuglink="$(<).debug" "$(<)" + chmod -x "$(<).debug" } # Default value. Mostly for the sake of intel-linux that inherits from gcc, but @@ -743,6 +759,8 @@ toolset.flags gcc.archive AROPTIONS ; +.OBJCOPY = objcopy ; + rule archive ( targets * : sources * : properties * ) { # Always remove archive and start again. Here is the rationale from @@ -780,6 +798,10 @@ actions piecemeal archive { "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" + "$(.OBJCOPY)" --only-keep-debug "$(<)" "$(<).debug" + "$(.OBJCOPY)" --strip-debug "$(<)" + "$(.OBJCOPY)" --add-gnu-debuglink="$(<).debug" "$(<)" + } @@ -794,6 +816,11 @@ actions link.dll bind LIBRARIES { "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) + + "$(.OBJCOPY)" --only-keep-debug "$(<[-1])" "$(<[-1]).debug" + "$(.OBJCOPY)" --strip-debug "$(<[-1])" + "$(.OBJCOPY)" --add-gnu-debuglink="$(<[-1]).debug" "$(<[-1])" + chmod -x "$(<[-1]).debug" } rule setup-threading ( targets * : sources * : properties * )