[Dwarf-Discuss] .debug_frame and the base address
robert.m.harris at oracle.com
Mon Sep 24 12:45:13 PDT 2018
> On 24 Sep 2018, at 18:40, Eric Christopher <echristo at gmail.com> wrote:
> Dwarf 5, 7.3.1
> "A DWARF expression may contain a DW_OP_addr (see Section 22.214.171.124 on 31 page 26) which contains a location within the virtual address space of the 32 program, and require relocation."
I think I've confused the issue by using the word relocation instead
of the phrase "interpreted relative to the base address of the load
I'm interested in the final state of an executable or shared object
and I don't expect to find any remaining ELF-style (e.g.
R_AMD64_64 and the like) run time (ld.so) relocations in non-loadable
My question instead concerns things like initial_location in an FDE,
which is interpreted relative to the base address of the enclosing
load object. I can see that DW_CFA_set_loc's operand would also
need to be interpreted as relative to the same base address. However,
I'm trying to establish if there's anything else within .debug_frame that
would be expressed relative to the same base address. For example,
DW_CFA_expression assumes that the CFA is already on the stack and it
would be perverse to expect the result to be anything other than an
absolute address. But is the same true of DW_CFA_def_cfa_expressions?
What about instructions within the expressions themselves...
The DW_OP_addr case is confusing. As it's an object address its
operand is highly likely to require an ELF-style (ld-style) relocation
to produce an appropriate address in the linked object. However, I
can see that in a shared object it would be plausible that the final,
ELF-style relocated argument should additionally need to be interpreted
as relative to the load object's base address. I assumed Greg was
asserting the latter with:
> On 24 Sep 2018, at 15:33, Greg Clayton <clayborg at gmail.com> wrote:
> Any DWARF expression can contain a DW_OP_addr, which has an address argument, and would need to be relocated.
and, not remembering any mention to the contrary in DWARF 2/3/4
wondered if this was really the case --- it would certainly have
helped answer my actual concern about .debug_frame. However, the
follow-up references to DWARF 5 7.3.1 and 126.96.36.199 are discussing
ELF-style relocations, and are, unfortunately, red herrings.
More information about the Dwarf-Discuss