Page MenuHomePhabricator

[DebugInfo] Read CIE pointer as a relocatable value.

Authored by ikudrin on Feb 14 2020, 7:01 AM.



The CIE pointer field of an FDE record contains an offset to a corresponding CIE record. In object files, this value comes with relocation because the value has to be fixed when a linker combines the final section from multiple sources. In most object files there is only one CIE record at offset 0 of the .debug_frame section, so reading a relocated or a raw value makes no difference. However, in partially linked object files there are multiple CIE records and the relocations should be applied to recover the right offset value.

Diff Detail

Event Timeline

ikudrin created this revision.Feb 14 2020, 7:01 AM
jhenderson added inline comments.Feb 18 2020, 1:21 AM
1 ↗(On Diff #244655)

As this is testing the CIE_pointer field of FDEs, it's porbably best to rename the test to debug-frame-cie-pointer-reloc.test.

7 ↗(On Diff #244655)

Add a comma after "reference"

18–21 ↗(On Diff #244655)

I'm guessing you used obj2yaml to generate this file? It generates excessive whitespace between keys and values, which I find can make it harder to read, and would prefer be removed to make something like this:

  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64

Same goes further below.

25 ↗(On Diff #244655)

No need for the AddressAlign field. Delete it.

29–31 ↗(On Diff #244655)

No need for these three fields.

40 ↗(On Diff #244655)

Does Addend allow a hex number? If so, I feel like 0x28 would be clearer, as it matches the value in the output.

ikudrin updated this revision to Diff 245120.Feb 18 2020, 3:43 AM
ikudrin edited the summary of this revision. (Show Details)

Addressed all the suggestions above. Thanks, @jhenderson!

This revision is now accepted and ready to land.Feb 18 2020, 3:58 AM
This revision was automatically updated to reflect the committed changes.