This is an archive of the discontinued LLVM Phabricator instance.

Make the BBAddrMap struct binary-format-agnostic.
ClosedPublic

Authored by rahmanl on Oct 27 2021, 5:01 PM.

Details

Summary

The only binary-format-related field in the BBAddrMap structure is the function address (Addr), which will use uint64_t in 64B format and uint32_t in 32B format. This patch changes it to use uint64_t in both formats.
This allows non-templated use of the struct, at the expense of a marginal additional size overhead for the 32-bit format. The size of the BB address map section does not change.

Diff Detail

Event Timeline

rahmanl created this revision.Oct 27 2021, 5:01 PM
rahmanl requested review of this revision.Oct 27 2021, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2021, 5:01 PM

One question, is "BBAddrMap" (or "ELF_BBAddrMap" in the origin code) only used to carry return values? You mentioned the section size won't change (for both ELF32 and ELF64), is it because you do not use this structure for writing out to ELF section?

One question, is "BBAddrMap" (or "ELF_BBAddrMap" in the origin code) only used to carry return values? You mentioned the section size won't change (for both ELF32 and ELF64), is it because you do not use this structure for writing out to ELF section?

Correct. BBAddrMap is only used in the return type for decodeBBAddrMap. This is completely independent from how the entries are written out to the ELF section.

One question, is "BBAddrMap" (or "ELF_BBAddrMap" in the origin code) only used to carry return values? You mentioned the section size won't change (for both ELF32 and ELF64), is it because you do not use this structure for writing out to ELF section?

Correct. BBAddrMap is only used in the return type for decodeBBAddrMap. This is completely independent from how the entries are written out to the ELF section.

I see. Thanks. This change seems reasonable to me, given that the object sizes do not increase, the consumer of bbaddrmap usually do not care the mere increase in size and ease of use of the library function (without templated data structures) is more important.

LGTM

I will go ahead and submit this relatively simple change.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 4 2021, 10:27 AM
This revision was automatically updated to reflect the committed changes.