[LLVMdev] [lld] How do I prevent .note sections from being eliminated?
Simon Atanasyan
simon at atanasyan.com
Tue Jun 16 02:05:39 PDT 2015
On Mon, Jun 15, 2015 at 6:12 PM, Tom Stellard <tom at stellard.net> wrote:
> ELFFile::handleSectionWithNoSymbols() returns false for SHT_NOTE. This
> means that ELFFile::createAtoms() never creates an atom for .note sections.
> It seems like even if I use something like SDataSection, then I will still
> need to modify ELFFIle::handleSectionWithNoSymbols(). What is the best
> way to do this? Should I make the function virtual and override it in
> AMDGPUELFFile.cpp?
Yes, you can make handleSectionWithNoSymbols() virtual and override it
in ELFFile class descendant.
> In ELFDefinedAtom::doContentType(), SHT_NOTE sections are only assigned
> the typeR[OW]Note ContentType if they have the SHF_ALLOC flag. This is
> because any section without SHF_ALLOC is assigned the typeNoAlloc
> ContentType before the section type is ever considered. Is this a bug
> or are SHT_NOTE sections required to have the SHF_ALLOC flag?
It depends on your ABI requirement. If a .note section does not need
to occupy memory during a process execution it should not have
the SHF_ALLOC flag.
--
Simon Atanasyan
More information about the llvm-dev
mailing list