This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Change isSectionData to exclude SHF_EXECINSTR
ClosedPublic

Authored by MaskRay on Jun 21 2018, 8:43 PM.

Details

Summary

This affects what sections are displayed as "DATA" in llvm-objdump.
The other user llvm-size is unaffected.

Before, a "TEXT" section is also "DATA", which seems weird.
The sh_flags condition matches that of bfd's SEC_DATA but the sh_type
condition uses (== SHF_PROGBITS) instead of bfd's (!= SHT_NOBITS).
bfd's SEC_DATA is not appealing as so many sections will be shown as DATA.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Jun 21 2018, 8:43 PM
MaskRay edited the summary of this revision. (Show Details)Jun 21 2018, 8:45 PM
MaskRay edited the summary of this revision. (Show Details)Jun 21 2018, 9:21 PM
MaskRay updated this revision to Diff 152431.Jun 21 2018, 11:27 PM

Update isSectionBSS as well (no impact)

jyknight accepted this revision.Jun 22 2018, 2:55 PM

I guess it's better...I mean, seems reasonable, I guess.

But I'd really *much* rather see the *actual* type information from the object file, not invent arbitrary classifications. E.g., how about we just print PROGBITS, NOBITS, etc.

And it'd be nice to see all the other section attributes too (flags/info/link/etc), for that matter...

This revision is now accepted and ready to land.Jun 22 2018, 2:55 PM

I agree with jyknight on this.. "TEXT" "DATA" "BSS" add an unnecessary abstraction layer on top of SHT_PROGBITS SHF_EXECINSTR ... If we could start over, we should remove the abstraction and change the display.

Thankfully most of this usage is superseded by llvm-readelf . Chime in freebsd hackers as there is recently discussion on moving away from GNU binutils https://lists.freebsd.org/pipermail/freebsd-toolchain/2018-June/003809.html