From: Indu Bhagat <indu.bhagat@oracle.com>
To: Fangrui Song <maskray@sourceware.org>,
Florian Weimer <fweimer@redhat.com>
Cc: Binutils <binutils@sourceware.org>, Michael Matz <matz@suse.de>,
Steven Rostedt <rostedt@goodmis.org>,
Matthias Klose <doko@debian.org>,
Sterling Augustine <saugustine@google.com>,
Pavel Labath <labath@google.com>, Sam James <sam@gentoo.org>,
amonakov@ispras.ru
Subject: Re: GNU Tools Cauldron SFrame talk notes
Date: Thu, 23 Oct 2025 14:40:21 -0700 [thread overview]
Message-ID: <e5089b99-c703-4b53-bce9-d06dbb5b1f1a@oracle.com> (raw)
In-Reply-To: <CAN30aBHqk7qg-v4FHy8LNNZstZuKuKx9du7i6BOmV_iYOtjNmQ@mail.gmail.com>
On 10/18/25 10:34 AM, Fangrui Song wrote:
> On Thu, Oct 16, 2025 at 1:14 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * Fangrui Song:
>>
>>> The version mix-and-match problem requires a concrete solution—we cannot
>>> defer it. Concatenation with opt-in indexing is the only viable approach
>>> that handles all scenarios.
>>
>> Is this exactly true? What about generating SFrame data in the linker
>> from the existing DWARF EH data?
>>
>> This would not work automatically for kernel modules because generating
>> SFrame data should not be the default for relocatable links. Maybe an
>> --sframe-index option for ld or objcopy would be acceptable? Kernel
>> modules do not have the usual post-processing problems because they are
>> relocatable, and their build is typically controlled by the kernel's
>> build system.
>>
>> Thanks,
>> Florian
>
> This alternative design makes the assembler's .sframe section
> unnecessary and is worth exploring.
> This design allows the linker to merge and optimize the .eh_frame
> section as usual (which requires CIE and FDE boundary information).
> The linker then analyzes the CFI instructions (a step previously
> unneeded) and generates the .sframe section.
> Since the linker only reads the stable .eh_frame and produces .sframe,
> there's no mix-and-match concern.
>
> CFI instruction decoding introduces additional complexity. However,
> this is balanced by the architectural advantage of centralizing the
> logic;
> it avoids scattering processing code (similar to SHF_MERGE and
> .eh_frame) across the linker code.
> However, this fine-grained knowledge of the format may expose the
> linker to more frequent updates—a serious risk, given that the
> linker's foundational role in the build process demands exceptional
> stability and robustness.
>
I agree with the observation of this route introduces additional
complexity. I'd expect the overhead of parsing DWARF CFI and processing
CFI to generate SFrame data at link time to be more than what we have
today (merging input SFrame data at link-time).
I am also not sure ATM about how will this fit in the linker workflow
(and if managing this itself brings additional section specific handling
in the generic linker parts): There are linker generated .eh_frame
sections (for .plt* sections), which are merged to create the final
.eh_frame output. The suggested process of SFrame data creation will
need to be deferred until such merging of EH Frame data is complete...
> A key related technical point concerns the section flags: we must
> confirm if .sframe truly requires the SHF_ALLOC flag.
> perf supports .debug_frame (tools/perf/util/unwind-libunwind-local.c),
> which does not have the SHF_ALLOC flag. Removing SHF_ALLOC from
> .sframe would significantly simplify the process for any post-link
> tool seeking to append or modify the unwind information, allowing them
> to add new sections with greater ease.
>
SFrame requires SHF_ALLOC.
This ensures that SFrame is available in the program memory.
Non-SHF_ALLOC SFrame will hurt tracers, and in-process stack tracing
usecases, because the cost of mmap is not amortized over the runtime of
the application. Cost is one only aspect; in some critical scenarios at
the time when backtrace is needed, bringing in a section is not viable.
RE: perf supports .debug_frame which is SHF_ALLOC.
There is a difference between status quo and whether the status quo is
the best we can do.
> A more cautious and immediate strategy is available: existing Linux
> distribution post-processing tools can be modified to append the
> .sframe section to executable and shared object files.
@Fangrui,
Do you think this intermediate solution is usable to build the huge
fleet of a variety of userspace packages for a distro ? How can one
then test the fleet with SFrame data ?
> Full .sframe merge into linkers should only be considered after this
> section has conclusively proved its value and stability over
> established unwind mechanisms.
Integrating support for SFrame in GNU ld has undeniably helped with
adoption and maturation of the format, with close attention to feature
set and implementation fixes from the wider GNU/Linux community. The
feature set of V3 is a curated list of developers' inputs and feature
requests possible only because of complete support available in the
assembler/linker.
We are going in circles here again on this one, so I will say no more.
Thanks
Indu
next prev parent reply other threads:[~2025-10-23 21:42 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 23:14 Indu Bhagat
2025-10-09 6:20 ` Fangrui Song
2025-10-10 8:09 ` Indu Bhagat
2025-10-10 14:06 ` Steven Rostedt
2025-10-12 19:25 ` Indu Bhagat
2025-10-10 16:50 ` Fangrui Song
2025-10-12 19:42 ` Indu Bhagat
2025-10-12 20:25 ` Fangrui Song
2025-10-15 19:39 ` Indu Bhagat
2025-10-15 20:03 ` Sterling Augustine
2025-10-16 8:03 ` Fangrui Song
2025-10-16 8:13 ` Florian Weimer
2025-10-18 17:34 ` Fangrui Song
2025-10-23 21:40 ` Indu Bhagat [this message]
2025-10-24 7:35 ` Fangrui Song
2025-11-04 11:41 ` Florian Weimer
2025-10-20 19:57 ` Indu Bhagat
2025-10-21 6:31 ` Fangrui Song
2025-10-21 12:15 ` Jose E. Marchesi
2025-10-22 13:45 ` Tatsuyuki Ishi
2025-10-23 21:47 ` Indu Bhagat
2025-10-24 6:19 ` Fangrui Song
2025-10-24 15:10 ` Tatsuyuki Ishi
2025-10-25 12:46 ` Jose E. Marchesi
2025-10-29 8:33 ` Indu Bhagat
2025-10-29 5:37 ` Indu Bhagat
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=e5089b99-c703-4b53-bce9-d06dbb5b1f1a@oracle.com \
--to=indu.bhagat@oracle.com \
--cc=amonakov@ispras.ru \
--cc=binutils@sourceware.org \
--cc=doko@debian.org \
--cc=fweimer@redhat.com \
--cc=labath@google.com \
--cc=maskray@sourceware.org \
--cc=matz@suse.de \
--cc=rostedt@goodmis.org \
--cc=sam@gentoo.org \
--cc=saugustine@google.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).