bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/24191] Gold doesn't properly process relocations to deduplicat


From: ccoutant at gmail dot com
Subject: [Bug gold/24191] Gold doesn't properly process relocations to deduplicated code
Date: Wed, 20 Feb 2019 01:05:40 +0000

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

Cary Coutant <ccoutant at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Cary Coutant <ccoutant at gmail dot com> ---
Actually, I think it's ld.bfd that's wrong here.

Ideally, when we discard a code section, we would also discard its debug info.
But the debug info format doesn't easily support this, and it would be a major
undertaking to make the linker capable of parsing, editing, and rewriting the
debug info (and that would make the linker unbearably slow).

In lieu of that, when we have a reference from debug info to a discarded
section, we resolve it using a base address of 0. This is deliberate, and
the debugger is (or should be) aware of this, so that it can ignore the
orphaned debug info. For other references to the discarded section, we do
in fact resolve them to point to the kept copy, but for debug info, we
resolve to 0.

Imagine what would happen if two copies of a function were compiled with
different optimization levels (or other options that would affect the code
generation). The line number tables (as well as any range information for
nested blocks inside the function) would differ, and it would be incorrect
for the discarded copy's debug info to be resolved to the kept copy of the
function. If the debugger were to find the mismatched line table while
doing an address-to-source-line lookup, it would then get the wrong answer.

-- 
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]