[PATCH v2] Improve building with LTO
Mark Wielaard
mark@klomp.org
Thu Nov 4 12:12:29 GMT 2021
Hi Dmitry,
On Thu, 2021-11-04 at 14:23 +0300, Dmitry V. Levin wrote:
> On Sat, Aug 28, 2021 at 12:31:43PM +0300, Dmitry V. Levin wrote:
> > On Thu, Feb 18, 2021 at 03:38:56AM +0100, Alexander Miller via
> > Elfutils-devel wrote:
> > > From: Alexander Miller <alex.miller@gmx.de>
> > >
> > > Use symver attribute for symbol versioning instead of .symver
> > > assembler directive when available. Convert to use double @
> > > syntax
> > > for default version in all cases (required when using the
> > > attribute).
> > >
> > > Add the attributes externally_visible, no_reorder if available
> > > when
> > > using assembler directives to improve the situation for < gcc-10.
> > > This is not 100% reliable, though; -flto-partition=none may still
> > > be
> > > needed in some cases.
> > >
> > > Note that -Wno-error=stack-usage= is still needed to build with
> > > LTO.
> > >
> > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24498
> > > Signed-off-by: Alexander Miller <alex.miller@gmx.de>
> > > ---
> > > lib/ChangeLog | 13 +++++++
> > > lib/eu-config.h | 65 +++++++++++++++++++++++++++-
> > > ------
> > > libdw/ChangeLog | 11 ++++++
> > > libdw/dwarf_aggregate_size.c | 4 +--
> > > libdw/dwarf_arrayorder.c | 2 +-
> > > libdw/dwarf_bitoffset.c | 2 +-
> > > libdw/dwarf_bitsize.c | 2 +-
> > > libdw/dwarf_bytesize.c | 2 +-
> > > libdw/dwarf_decl_column.c | 2 +-
> > > libdw/dwarf_decl_file.c | 2 +-
> > > libdw/dwarf_decl_line.c | 2 +-
> > > libdw/dwarf_srclang.c | 4 +--
> > > libdwelf/ChangeLog | 5 +++
> > > libdwelf/dwelf_elf_begin.c | 2 +-
> > > libdwfl/ChangeLog | 7 ++++
> > > libdwfl/core-file.c | 4 +--
> > > libdwfl/dwfl_module_build_id.c | 4 +--
> > > libdwfl/dwfl_report_elf.c | 4 +--
> > > 18 files changed, 107 insertions(+), 30 deletions(-)
> >
> > ping?
>
> FWiW, I applied this patch in ALT's elfutils package about 2 months
> ago.
> Thanks to -Wstack-usage fixes merged, it no longer requires
> -Wno-error=stack-usage= to build with LTO.
Thanks. This patch was indeed one reason I kept postponing the release,
because I didn't have have time to properly review it.
Which gcc versions have you tried this against (with/without -flto?)
I admit I am still a bit nervous about the switch away from @@@ to just
@ and @@. I was secretly hoping gcc would add @@@ support to the symver
attribute. But that doesn't seem to be happening, and even if it did,
it would be gcc 12+ only. So maybe we can include it for this release
and just tell people they may keep the pieces if they use -flto. But it
does also impact symbol versioning for non-lto builds, so I am still a
little hesitant. I'll try to do some tests to make sure things look ok
with different gcc versions.
Cheers,
Mark
More information about the Elfutils-devel
mailing list