Yocto Project Documentation
 help / color / mirror / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: docs@lists.yoctoproject.org
Cc: Antonin Godard <antonin.godard@bootlin.com>,
	Mathieu Othacehe <othacehe@gnu.org>
Subject: [PATCH v2 1/2] profile-manual: Document the PACKAGE_KEEP_SECTIONS variable.
Date: Wed,  5 Feb 2025 16:49:56 +0100	[thread overview]
Message-ID: <20250205154957.24148-2-othacehe@gnu.org> (raw)
In-Reply-To: <20250205154957.24148-1-othacehe@gnu.org>

Document the 'PACKAGE_KEEP_SECTIONS' variable that can be used to keep some
specific ELF sections while stripping binaries and libraries.

That one can then be used to keep the .debug_frame section around for
example, this way:

PACKAGE_KEEP_SECTIONS = ".debug_frame"

By using libunwind + minidebuginfo, that provides a way for users to get
debug_frame based backtraces on target.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
 documentation/profile-manual/intro.rst |  6 ++++++
 documentation/ref-manual/variables.rst | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/documentation/profile-manual/intro.rst b/documentation/profile-manual/intro.rst
index 317912552..a7243c1ca 100644
--- a/documentation/profile-manual/intro.rst
+++ b/documentation/profile-manual/intro.rst
@@ -75,3 +75,9 @@ Additionally, in order to generate the right type of debug info, we also need to
 set :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file::
 
    PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'
+
+When you are building a stripped image, you can also keep some specific ELF
+sections in the image by setting :term:`PACKAGE_KEEP_SECTIONS` in the
+``local.conf`` file::
+
+   PACKAGE_KEEP_SECTIONS = ".debug_frame"
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 47d4e814f..6743b1a9f 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -6243,6 +6243,18 @@ system and gives an overview of their function and contents.
       install, the build system does not generate an error. This variable
       is generally not user-defined.
 
+   :term:`PACKAGE_KEEP_SECTIONS`
+      Specifies a list of ELF sections that should be kept when stripping
+      during package creation. You can set this variable in your
+      ``local.conf`` file.
+
+      For example, the following::
+
+        PACKAGE_KEEP_SECTIONS = ".debug_frame"
+
+      will result in passing the ``--keep-section=.debug_frame`` argument to
+      the ``strip`` command.
+
    :term:`PACKAGE_PREPROCESS_FUNCS`
       Specifies a list of functions run to pre-process the
       :term:`PKGD` directory prior to splitting the files out
-- 
2.47.1



  reply	other threads:[~2025-02-05 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 15:49 [PATCH v2 0/2] debugging: Document how to get backtraces on target Mathieu Othacehe
2025-02-05 15:49 ` Mathieu Othacehe [this message]
2025-02-05 15:49 ` [PATCH v2 2/2] dev-manual/debugging: Add a "Backtraces or target" section Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250205154957.24148-2-othacehe@gnu.org \
    --to=othacehe@gnu.org \
    --cc=antonin.godard@bootlin.com \
    --cc=docs@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox