|
Boost-Build : |
Subject: Re: [Boost-build] Stripping in release variant
From: Juraj IvanÄiÄ (juraj.ivancic_at_[hidden])
Date: 2009-12-17 05:04:09
Juraj IvanÄiÄ wrote:
> Now that the new builtin feature (strip) is available, is there any
> chance that msvc toolset also benefits from this? I'd really like BB
> to be able to produce stripped PDBs (w. /PDBSTRIPPED linker option).
I went ahead and added support for stripped PDBs in msvc. I added a
subfeature for <debug-symbols>on, so that a stripped PDB can be created
by passing <debug-symbols>on-strip. Could someone (Volodya) have a look
and possibly apply this?
Index: tools/msvc.jam
===================================================================
--- tools/msvc.jam (revision 58425)
+++ tools/msvc.jam (working copy)
@@ -442,7 +442,13 @@
if <embed-manifest>on in $(properties)
{
msvc.manifest $(targets) : $(sources) : $(properties) ;
- }
+ }
+
+ if <debug-symbols-on:strip-pdb>strip in $(properties)
+ {
+ PDB_MAIN on $(<[1]) = $(<[1]:S=.dummy.pdb) ;
+ PDB_STRIPPED on $(<[1]) = $(<[1]:S=.pdb) ;
+ }
}
rule link.dll ( targets + : sources * : properties * )
@@ -452,6 +458,12 @@
{
msvc.manifest.dll $(targets) : $(sources) : $(properties) ;
}
+
+ if <debug-symbols-on:strip-pdb>strip in $(properties)
+ {
+ PDB_MAIN on $(<[1]) = $(<[1]:S=.dummy.pdb) ;
+ PDB_STRIPPED on $(<[1]) = $(<[1]:S=.pdb) ;
+ }
}
# Incremental linking a DLL causes no end of problems: if the actual exports do
@@ -464,11 +476,15 @@
# assemblies and Windows native DLLs. The manifests are embedded as resources
# and are useful in any PE target (both DLL and EXE).
+# MSVC linker does now allow creating stripped PDB without creating regular
+# PDB. In case you do not specify non-stripped PDB name (w. /PDB) exe base name
+# will be used. Therefore to create a stripped pdb with exe base name you must
+# specify /PDB with a dummy file name.
if [ os.name ] in NT
{
- actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE
+ actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE PDB_MAIN PDB_STRIPPED
{
- $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")"
+ $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib" $(.nl)/PDB:"$(PDB_MAIN)" $(.nl)/PDBSTRIPPED:"$(PDB_STRIPPED)")"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
}
@@ -479,9 +495,9 @@
)
}
- actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE
+ actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE PDB_MAIN PDB_STRIPPED
{
- $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")"
+ $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib" $(.nl)/PDB:"$(PDB_MAIN)" $(.nl)/PDBSTRIPPED:"$(PDB_STRIPPED)")"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
}
@@ -494,9 +510,9 @@
}
else
{
- actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE
+ actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE PDB_MAIN PDB_STRIPPED
{
- $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")"
+ $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib" $(.nl)/PDB:"$(PDB_MAIN)" $(.nl)/PDBSTRIPPED:"$(PDB_STRIPPED)")"
}
actions manifest
@@ -506,9 +522,9 @@
fi
}
- actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE
+ actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE PDB_MAIN PDB_STRIPPED
{
- $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")"
+ $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib" $(.nl)/PDB:"$(PDB_MAIN)" $(.nl)/PDBSTRIPPED:"$(PDB_STRIPPED)")"
}
actions manifest.dll
@@ -1090,6 +1106,9 @@
toolset.add-requirements
<toolset>msvc,<runtime-link>shared:<threading>multi ;
+ # Allow creating stripped pdb files.
+ feature.subfeature debug-symbols on : strip-pdb : strip : incidental optional ;
+
# Declare msvc toolset specific features.
{
feature.feature debug-store : object database : propagated ;
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk