bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ s


From: ccoutant at gmail dot com
Subject: [Bug ld/18836] ld handles .gnu.lto_ prefixed sections oddly, /DISCARD/ semantics unclear
Date: Mon, 17 Aug 2015 18:05:30 +0000

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

Cary Coutant <ccoutant at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ccoutant at gmail dot com

--- Comment #12 from Cary Coutant <ccoutant at gmail dot com> ---
> I think you should write down exactly what you need so that we can
> take a look at what linker, linker plugin and assembler should do.

I agree. This discussion also applies (at least in part) to PR gold/18834 and
PR gold/18837, so for the time being, lets talk about all three PRs here.

Here's my understanding of what you're trying to do; please correct me where
I've got it wrong:

It sounds like you want to emit early and full debug in an LTO intermediate --
either fat or slim -- and then emit only late debug info in the LTRANS output.

(a) If you're linking with fat LTO objects and no LTO, you want to ignore the
early debug info, and link only the full debug info. Thus, you're putting the
early debug info into .gnu.lto_ sections, so they get ignored by default in a
non-LTO link.

(b) If you're linking with LTO, you want to go pick up the early debug info
from the LTO intermediate (without picking up any other sections from that
object), and add to that the late debug info from the LTRANS output.

For (b) to work, you seem to be hoping that writing a linker script with
something like this in it will pick up *just* the early debug info from t.o:

SECTIONS {
  .debug_info : { t.o(.gnu.lto_.debug_info) }
  .debug_abbrev : { t.o(.gnu.lto_.debug_abbrev) }
  .debug_str : { t.o(.gnu.lto_.debug_str) }
}

Sorry, but I don't think that's going to do what you think it will do.
According to the linker manual, even if t.o isn't listed on the command line,
ld will link t.o as if it had been named on the command line. As a result,
you'll link all sections from t.o, including the fat text and data sections.
(Not to mention that gold does not implement this particular misfeature -- if
t.o isn't named on the command line, gold will not add it to the list of input
files.)

In order to get the early debug info from the LTO intermediate, you're going to
have to copy it into one of the LTRANS output .o files, and rename the section
such that it doesn't get excluded by default.

Using a linker script for this seems like a bad idea anyway. It would be a lot
cleaner to extend the plugin API to add whatever features you need, and we
probably should have been discussing that before you got this far.

Stepping back a bit, it sounds to me like you should be using split DWARF
instead. With split DWARF, the debug info in the .dwo sections, which gets
split into separate .dwo files, is pretty much all early debug info. The parts
remaining in the .o are late debug info, so the split has already been done,
and there's no need to try to get the linker to extract individual sections
from an LTO intermediate.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]