From 5b6de38dee4f5bd1bb32caa56ee9d547bc2e560e Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Mon, 5 Dec 2022 21:52:16 -0800 Subject: [PATCH 1/3] jamfiles: Export dynamic symbols from unified executables This change ensures that function names are added to the dynamic symbol table so that they can be queried when printing a backtrace from the default condition handler. It also ensures that the copied .dbg files contain only debug information and not program code and initialized data. * sources/jamfiles/posix-build.jam (actions LinkDLL, actions LinkEXE, actions UnifyEXE): Supply the --only-keep-debug option to objcopy when constructing the .dbg file. (actions UnifyEXE): Export symbols in the dynamic symbol table to allow the run-time's backtrace code to find function symbol names. --- sources/jamfiles/posix-build.jam | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sources/jamfiles/posix-build.jam b/sources/jamfiles/posix-build.jam index 47b798368..f1b4589e0 100644 --- a/sources/jamfiles/posix-build.jam +++ b/sources/jamfiles/posix-build.jam @@ -486,7 +486,7 @@ rule LinkDLL { actions together LinkDLL bind NEEDLIBS { $(LINK) -shared -o $(<:Q) $(LINKFLAGS) $(>:Q) -L"$(LIBPATH)" $(NEEDLIBS:Q) $(LINKLIBS) - $(OBJCOPY) $(<:Q) $(<:Q).dbg + $(OBJCOPY) --only-keep-debug $(<:Q) $(<:Q).dbg $(STRIP) -s $(<:Q) $(OBJCOPY) --add-gnu-debuglink=$(<:Q).dbg $(<:Q) } @@ -507,7 +507,7 @@ rule LinkEXE { actions LinkEXE bind NEEDLIBS { $(LINK) -o $(<:Q) $(LINKFLAGS) $(>:Q) -L"$(LIBPATH)" $(NEEDLIBS:Q) $(LINKLIBS) - $(OBJCOPY) $(<:Q) $(<:Q).dbg + $(OBJCOPY) --only-keep-debug $(<:Q) $(<:Q).dbg $(STRIP) -s $(<:Q) $(OBJCOPY) --add-gnu-debuglink=$(<:Q).dbg $(<:Q) } @@ -518,9 +518,9 @@ rule UnifyEXE { } actions UnifyEXE bind NEEDLIBS { - $(UNIFYLINK) -o $(<:Q) $(LINKFLAGS) $(>:Q) -L"$(LIBPATH)" -Wl,--start-group $(NEEDLIBS:Q) $(LINKLIBS) -Wl,--end-group - $(OBJCOPY) $(<:Q) $(<:Q).dbg - $(STRIP) -s $(<:Q) + $(UNIFYLINK) -o $(<:Q) $(LINKFLAGS) -Wl,-E $(>:Q) -L"$(LIBPATH)" -Wl,--start-group $(NEEDLIBS:Q) $(LINKLIBS) -Wl,--end-group + $(OBJCOPY) --only-keep-debug $(<:Q) $(<:Q).dbg + $(STRIP) -g $(<:Q) $(OBJCOPY) --add-gnu-debuglink=$(<:Q).dbg $(<:Q) } From 7bd16ea8e6b72fd980cdb31b30f40b6c6d77823e Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Mon, 5 Dec 2022 22:08:32 -0800 Subject: [PATCH 2/3] jamfiles: Copy runtime libraries for unified executables * sources/jamfiles/posix-build.jam (rule DylanLibrary): Ensure that "batteries included" runtime shared libraries are copied into the lib/ directory when unified exectables are built. --- sources/jamfiles/posix-build.jam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/jamfiles/posix-build.jam b/sources/jamfiles/posix-build.jam index f1b4589e0..21216bb4b 100644 --- a/sources/jamfiles/posix-build.jam +++ b/sources/jamfiles/posix-build.jam @@ -156,7 +156,7 @@ rule DylanLibrary image : version { local _rtlib = $(_i:D=) ; MakeLocate $(_rtlib) : $(LIBDIR) ; File $(_rtlib) : $(_i) ; - Depends $(_dll) : $(_rtlib) ; + Depends $(_dll) $(_ulib) : $(_rtlib) ; } } From b34106767204c3492a6be0d8e6d5d0ccc724e743 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Thu, 2 May 2024 19:56:44 -0700 Subject: [PATCH 3/3] release-notes: Add entries for unified executables improvements * documentation/release-notes/source/2024.2.rst: Add entries. --- documentation/release-notes/source/2024.2.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/release-notes/source/2024.2.rst b/documentation/release-notes/source/2024.2.rst index 1d7a4fb9a..733ecbb30 100644 --- a/documentation/release-notes/source/2024.2.rst +++ b/documentation/release-notes/source/2024.2.rst @@ -20,6 +20,12 @@ this release. Compiler ======== +* Unified executables now export symbols so that call stack dumping + works properly. + +* The build rules for unified executables now properly depend on + copying included run-time libraries such as libunwind. + Tools =====