This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj/obj2yaml/llvm-readobj] Support SHF_GNU_RETAIN
ClosedPublic

Authored by MaskRay on Jan 29 2021, 10:50 PM.

Details

Summary

In binutils, the flag is defined for ELFOSABI_GNU and ELFOSABI_FREEBSD.
It can be used to mark a section as a GC root.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 29 2021, 10:50 PM
MaskRay requested review of this revision.Jan 29 2021, 10:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2021, 10:50 PM
jhenderson added inline comments.Feb 1 2021, 1:19 AM
llvm/test/tools/llvm-readobj/ELF/section-flags-os-proc.test
97

Since we don't inspect the OSABI value, I'd just omit this for now. If in the future we choose to do so, we should use a macro to generate this output with and without this OSABI value, so that we can show it being recognised/not recognised as appropriate.

On the other hand, should we inspect the value from the beginning?

129

Why the 0x800 flag?

MaskRay added inline comments.Feb 1 2021, 9:28 AM
llvm/test/tools/llvm-readobj/ELF/section-flags-os-proc.test
129

To check that the key 'R' on the right of 'C'...

MaskRay added inline comments.Feb 1 2021, 2:31 PM
llvm/tools/llvm-readobj/ELFDumper.cpp
3494

https://sourceware.org/pipermail/binutils/2021-January/115151.html

The look will be similar to readelf -S.

SHF_GNU_MBIND seems unuseful and LLVM does not support it, so I'll not add it.

This revision is now accepted and ready to land.Feb 2 2021, 12:25 AM
MaskRay updated this revision to Diff 320813.Feb 2 2021, 9:17 AM

Move "R (retain)" to the left of "p" (this matches GNU)

This revision was landed with ongoing or failed builds.Feb 2 2021, 9:20 AM
This revision was automatically updated to reflect the committed changes.