| Message ID | 20250825165026.681972-1-Deepesh.Varatharajan@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | gcc: remove .gnu_debuglink from SDK toolchain binaries | expand |
On Mon, Aug 25, 2025 at 9:51 AM Varatharajan, Deepesh via lists.openembedded.org <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: > > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > SDK toolchain binaries (nativesdk and cross-canadian gcc) currently > contain a .gnu_debuglink section pointing to separate debug symbols. > These symbols are not required in SDK builds, as SDK users do not > need production debug information on the target, only the compiler > and headers for development. > > Including .gnu_debuglink increases disk usage for distributed SDKs > without providing any benefit for SDK consumers and so removed. I need to understand the problem a bit better. Is the system not able to specify ignoring debug info from SDK, if we include debuginfo with the binaries how does it change things ? > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > --- > meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc > index 8d95698743..3793aff0a1 100644 > --- a/meta/recipes-devtools/gcc/gcc-common.inc > +++ b/meta/recipes-devtools/gcc/gcc-common.inc > @@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () { > cleanup_installed_include_fixed () { > find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f > } > + > +# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds > +# (covers both nativesdk gcc and cross-canadian gcc) > +INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1" > +INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1" > -- > 2.49.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#222417): https://lists.openembedded.org/g/openembedded-core/message/222417 > Mute This Topic: https://lists.openembedded.org/mt/114885056/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On 26-08-2025 08:29, Khem Raj wrote: > CAUTION: This email comes from a non Wind River email account! > Do not click links or open attachments unless you recognize the sender and know the content is safe. > > On Mon, Aug 25, 2025 at 9:51 AM Varatharajan, Deepesh via > lists.openembedded.org > <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: >> From: Deepesh Varatharajan<Deepesh.Varatharajan@windriver.com> >> >> SDK toolchain binaries (nativesdk and cross-canadian gcc) currently >> contain a .gnu_debuglink section pointing to separate debug symbols. >> These symbols are not required in SDK builds, as SDK users do not >> need production debug information on the target, only the compiler >> and headers for development. >> >> Including .gnu_debuglink increases disk usage for distributed SDKs >> without providing any benefit for SDK consumers and so removed. > I need to understand the problem a bit better. Is the system not able to > specify ignoring debug info from SDK, if we include debuginfo with the > binaries how does it change things ? Hi Khem, The |meta-mingw| layer currently sets |INHIBIT_PACKAGE_DEBUG_SPLIT = "1"| in its |"gcc-cross-canadian_%.bbappend|", which results in the |".gnu_debuglink"| section being stripped from the cross-canadian GCC binaries. This behavior leads to inconsistencies in the generated SDKs depending on whether the |meta-mingw| layer is included or not. So the idea is to make this behaviour as default in the gcc-common.inc file for both nativesdk and cross-canadian GCC. To ensure consistent SDK behavior and to reduce SDK size. The below are the differences in binaries : Binary Before After Diff (bytes) -------------------------- --------- -------- ----------- nativesdk x86_64-pokysdk-linux-gcc 2165192 2165080 -112 nativesdk x86_64-pokysdk-linux-g++ 2169288 2169176 -112 cross-canadian x86_64-poky-linux-gcc 2165216 2165112 -104 cross-canadian x86_64-poky-linux-g++ 2173408 2173304 -104 Regards, Deepesh > >> Signed-off-by: Deepesh Varatharajan<Deepesh.Varatharajan@windriver.com> >> --- >> meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc >> index 8d95698743..3793aff0a1 100644 >> --- a/meta/recipes-devtools/gcc/gcc-common.inc >> +++ b/meta/recipes-devtools/gcc/gcc-common.inc >> @@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () { >> cleanup_installed_include_fixed () { >> find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f >> } >> + >> +# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds >> +# (covers both nativesdk gcc and cross-canadian gcc) >> +INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1" >> +INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1" >> -- >> 2.49.0 >> >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#222417):https://lists.openembedded.org/g/openembedded-core/message/222417 >> Mute This Topic:https://lists.openembedded.org/mt/114885056/1997914 >> Group Owner:openembedded-core+owner@lists.openembedded.org >> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] >> -=-=-=-=-=-=-=-=-=-=-=- >>
On Thu, 2025-08-28 at 17:09 +0530, Varatharajan, Deepesh via lists.openembedded.org wrote: > > On 26-08-2025 08:29, Khem Raj wrote: > > On Mon, Aug 25, 2025 at 9:51 AM Varatharajan, Deepesh via > > lists.openembedded.org > > <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: > > > > > > > > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > > > > > SDK toolchain binaries (nativesdk and cross-canadian gcc) currently > > > contain a .gnu_debuglink section pointing to separate debug symbols. > > > These symbols are not required in SDK builds, as SDK users do not > > > need production debug information on the target, only the compiler > > > and headers for development. > > > > > > Including .gnu_debuglink increases disk usage for distributed SDKs > > > without providing any benefit for SDK consumers and so removed. > > > > > > > I need to understand the problem a bit better. Is the system not able to > > specify ignoring debug info from SDK, if we include debuginfo with the > > binaries how does it change things ? > > > The meta-mingw layer currently sets INHIBIT_PACKAGE_DEBUG_SPLIT = "1" in its > "gcc-cross-canadian_%.bbappend", which results in the ".gnu_debuglink" section being > stripped from the cross-canadian GCC binaries. This behavior leads to inconsistencies > in the generated SDKs depending on whether the meta-mingw layer is included or not. > > So the idea is to make this behaviour as default in the gcc-common.inc file for both nativesdk > and cross-canadian GCC. To ensure consistent SDK behavior and to reduce SDK size. > > > The below are the differences in binaries : > > Binary Before After Diff (bytes) > -------------------------- --------- -------- ----------- > nativesdk x86_64-pokysdk-linux-gcc 2165192 2165080 -112 > nativesdk x86_64-pokysdk-linux-g++ 2169288 2169176 -112 > cross-canadian x86_64-poky-linux-gcc 2165216 2165112 -104 > cross-canadian x86_64-poky-linux-g++ 2173408 2173304 -104 Please do not use the mingw layer as a reference for anything! It takes various shortcuts to make things work on a problematic and quite different platform and it's hacks shouldn't be taken and applied generically. The debug link sections are only a handful of bytes and the size of these should not matter compared to the size of the SDK. They do provide valuable information about which debug symbols match the binaries so "after the fact" you could find debug symbols to debug a segfault thanks to our reproducible builds (for example). In general we always generate debug symbols and package them separately for target binaries (which includes nativesdk). Mingw doesn't do this for various reasons, probably breakage if it's binaries are stripped. Cheers, Richard
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index 8d95698743..3793aff0a1 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc @@ -144,3 +144,8 @@ remove_sysroot_paths_from_checksum_options () { cleanup_installed_include_fixed () { find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f } + +# Disable splitting debug symbols into separate -dbg packages for SDK-related gcc builds +# (covers both nativesdk gcc and cross-canadian gcc) +INHIBIT_PACKAGE_DEBUG_SPLIT:class-nativesdk = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT:class-cross-canadian = "1"