This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Use pcrel format for eh_frame_ptr field encoding
ClosedPublic

Authored by atanasyan on Mar 15 2015, 11:32 PM.

Details

Reviewers
ruiu
shankarke
Summary

The eh_frame_ptr field in the .eh_frame_hdr section contains an address of the .eh_frame section. Using an absolute 32-bit format for encoding of this field does not work for 64-bit targets. It is better to use a relative format because it covers both 32-bit and 64-bit cases. Sure this work if a distance between .eh_frame_hdr and .eh_frame sections is less than 4 Gb. I think it is a rather correct assumption.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 22012.Mar 15 2015, 11:32 PM
atanasyan retitled this revision from to [ELF] Use pcrel format for eh_frame_ptr field encoding.
atanasyan updated this object.
atanasyan edited the test plan for this revision. (Show Details)
atanasyan added reviewers: shankarke, ruiu.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
atanasyan added a subscriber: Unknown Object (MLST).
shankarke edited edge metadata.Mar 16 2015, 7:23 AM

this fails if the access to eh frame using eh_frame_header is absolute ?

Current code fails if address of .eh_frame section is greater than 2^32 and does not fit into 4-byte. The alternative solution is to use DW_EH_PE_udata4 for 32-bit targets and DW_EH_PE_udata8 for 64-bit targets. But DW_EH_PE_pcrel covers both cases and it looks like gnu linkers use this format too.

shankarke accepted this revision.Mar 16 2015, 8:38 AM
shankarke edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Mar 16 2015, 8:38 AM
ruiu accepted this revision.Mar 16 2015, 10:25 AM
ruiu edited edge metadata.

LGTM

atanasyan closed this revision.Mar 16 2015, 2:10 PM

Thanks for review.

Closed by commit rL232414.