Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Dmitry V. Levin
Hi Mark,

On Tue, Nov 09, 2021 at 12:18:31AM +0100, Mark Wielaard wrote:
> Hi Dmitry,
> 
> On Mon, Nov 08, 2021 at 01:02:28PM +0300, Dmitry V. Levin wrote:
> > > 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 tested with gcc10 and gcc11.
> > I could try older versions, although I didn't feel that necessary.
> 
> I also did try with gcc 4.8 and gcc 8 (both without lto though).
> 
> > https://sourceware.org/bugzilla/show_bug.cgi?id=27367 will likely strike
> > those who would build elfutils with -flto using gcc11+.
> 
> But only if they use -ffat-lto-objects (which isn't the default)?

Yes, but those who build elfutils with -flto are likely using
-ffat-lto-objects if they build static libraries.

> Did you see and try the patch I proposed? Do you think we should include
> it? I would like someone else to check/try it.

Yes, the patch makes run-readelf-self.sh test pass, and causes no visible
regressions.  I'm not familiar with that code to review the patch, but
I'm happy to use it anyway.

> > > 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.
> > 
> > What do you mean by "it does also impact symbol versioning for non-lto
> > builds"?  The code for non-lto builds changes, but the versioning
> > should remain the same, shouldn't it?
> 
> I meant I am paranoid :) We are using slightly different asm or an
> attribute to mark the symbol version than we did before. But I double
> checked the exported versioned symbols with and without this patch on
> different gcc versions and they look fine.
> 
> So I did just now push this patch.

Thanks!


-- 
ldv


Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Martin Liška

On 11/9/21 09:58, Dmitry V. Levin wrote:

Yes, but those who build elfutils with -flto are likely using
-ffat-lto-objects if they build static libraries.


Yes, I can confirm that we do that as openSUSE, we actually build with:

-flto -flto-partition=none -Wno-error=stack-usage= -ffat-lto-objects

right now.

Cheers,
Martin


Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Dmitry V. Levin
On Tue, Nov 09, 2021 at 10:04:57AM +0100, Martin Liška wrote:
> On 11/9/21 09:58, Dmitry V. Levin wrote:
> > Yes, but those who build elfutils with -flto are likely using
> > -ffat-lto-objects if they build static libraries.
> 
> Yes, I can confirm that we do that as openSUSE, we actually build with:
> 
> -flto -flto-partition=none -Wno-error=stack-usage= -ffat-lto-objects

After updating to commit elfutils-0.185-76-g039f427a you can safely drop
"-flto-partition=none" and "-Wno-error=stack-usage=" parts.


-- 
ldv


Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Martin Liška

On 11/9/21 10:09, Dmitry V. Levin wrote:

On Tue, Nov 09, 2021 at 10:04:57AM +0100, Martin Liška wrote:

On 11/9/21 09:58, Dmitry V. Levin wrote:

Yes, but those who build elfutils with -flto are likely using
-ffat-lto-objects if they build static libraries.


Yes, I can confirm that we do that as openSUSE, we actually build with:

-flto -flto-partition=none -Wno-error=stack-usage= -ffat-lto-objects


After updating to commit elfutils-0.185-76-g039f427a you can safely drop
"-flto-partition=none" and "-Wno-error=stack-usage=" parts.


Great, good news!

Martin
 



Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Mark Wielaard
Hi Martin,

On Tue, 2021-11-09 at 10:04 +0100, Martin Liška wrote:
> On 11/9/21 09:58, Dmitry V. Levin wrote:
> > Yes, but those who build elfutils with -flto are likely using
> > -ffat-lto-objects if they build static libraries.
> 
> Yes, I can confirm that we do that as openSUSE, we actually build
> with:
> 
> -flto -flto-partition=none -Wno-error=stack-usage= -ffat-lto-objects

As Dmitry pointed out you should now be able to drop both -flto-
partition=none an -Wno-error=stack-usage= (the linker will still warn,
but not error on the large stack-usage issues (we should probably still
fix them though).

What do the test results look like? Do they all PASS with -ffat-lto-
objects?

Could you try the proposed patch for
https://sourceware.org/bugzilla/show_bug.cgi?id=27367
https://sourceware.org/pipermail/elfutils-devel/2021q4/004314.html

Thanks,

Mark


Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Martin Liška

On 11/9/21 12:45, Mark Wielaard wrote:

Hi Martin,

On Tue, 2021-11-09 at 10:04 +0100, Martin Liška wrote:

On 11/9/21 09:58, Dmitry V. Levin wrote:

Yes, but those who build elfutils with -flto are likely using
-ffat-lto-objects if they build static libraries.


Yes, I can confirm that we do that as openSUSE, we actually build
with:

-flto -flto-partition=none -Wno-error=stack-usage= -ffat-lto-objects


As Dmitry pointed out you should now be able to drop both -flto-
partition=none an -Wno-error=stack-usage= (the linker will still warn,
but not error on the large stack-usage issues (we should probably still
fix them though).


Correct, I'm not using:
F="-O2 -g -Wall -flto=auto -ffat-lto-objects" && export CFLAGS="$F" && export CXXFLAGS="$F" && 
export LDFLAGS="$F" && ./configure




What do the test results look like? Do they all PASS with -ffat-lto-
objects?

Could you try the proposed patch for
https://sourceware.org/bugzilla/show_bug.cgi?id=27367
https://sourceware.org/pipermail/elfutils-devel/2021q4/004314.html


With the suggested patch (and BFD) all is green and shiny:


Testsuite summary for elfutils 0.185

# TOTAL: 252
# PASS:  249
# SKIP:  3
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

Cheers,
Martin



Thanks,

Mark





Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Martin Liška

On 11/9/21 14:31, Martin Liška wrote:

Correct, I'm not using:


s/not/now


Re: [PATCH v2] Improve building with LTO

2021-11-09 Thread Mark Wielaard
Hi Martin,

On Tue, 2021-11-09 at 14:31 +0100, Martin Liška wrote:
> > What do the test results look like? Do they all PASS with -ffat-
> > lto-objects?
> > 
> > Could you try the proposed patch for
> > https://sourceware.org/bugzilla/show_bug.cgi?id=27367
> > https://sourceware.org/pipermail/elfutils-devel/2021q4/004314.html
> 
> With the suggested patch (and BFD) all is green and shiny:

Thanks for the testing, I pushed that patch now.

Cheers,

Mark


[Bug libdw/28573] New: Provide an dwarf_begin interface to open (single-file) DWO or GNU_LTO Dwarf subset

2021-11-09 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28573

Bug ID: 28573
   Summary: Provide an dwarf_begin interface to open (single-file)
DWO or GNU_LTO Dwarf subset
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: libdw
  Assignee: unassigned at sourceware dot org
  Reporter: mark at klomp dot org
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

To fix https://sourceware.org/bugzilla/show_bug.cgi?id=27367 "invalid loclists
data with -ffat-lto-objects" dwarf_begin_elf now checks to see which DWARF
subset is in the debug ELF file. And it picks the "plain" (.debug sections)
over "dwo" (.debug_...dwo sections) over "lto" (.gnu.debuglto_.debug sections)
in case multiple are in the same file. We have to pick one because mixing the
sections causes chaos.

But the user might want to pick a different set. In particular the user might
want to pick "single file" DWO (where the .dwo sections are in the same file as
the skeleton plain debug sections).

So we want to have a dwarf_begin variant with a flag to pick such a subset.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

2021-11-09 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #8 from Mark Wielaard  ---
commit 5b21e70216b853065fa2fef34273db5f7dcdc88b
Author: Mark Wielaard 
Date:   Mon Nov 8 09:27:51 2021 +0100

libdw: dwarf_elf_begin should use either plain, dwo or lto DWARF sections.

When opening an ELF file that contained a mix of plain, dwo or lto .debug
sections the result could be confusing. Add a check to pick just the plain
.debug sections, or the .dwo sections or the .gnu.debuglto_.debug sections
(in that order of preference). That way there is always a consistent set.

https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Signed-off-by: Mark Wielaard 

Opened a new bug for having a new interface to open any (plain, dwo, lto)
subset if multiple are found in the same file:
https://sourceware.org/bugzilla/show_bug.cgi?id=28573

-- 
You are receiving this mail because:
You are on the CC list for the bug.