[llvm-mc] - Allow to set custom flags for debug sections.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 29 Aug 2018 08:42:02 +0000 (08:42 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 29 Aug 2018 08:42:02 +0000 (08:42 +0000)
commit999d1ce5173aa8fcb5f905eaeb3e32ed57096b72
tree240abbaa8fbc06931dd11365458fbbd06e2ef4aa
parent283b995097f91f340f69b229d2554e95a87fbe10
[llvm-mc] - Allow to set custom flags for debug sections.

I am experimenting with a single split dwarf (.dwo sections in .o files).
I want to make linker to ignore .dwo sections in .o, for that I am trying to add
SHF_EXCLUDE flag ("E") for them in my asm sample.

I found that currently, it is impossible to add any flag for debug sections using llvm-mc.

That happens because we have a set of predefined unique sections created early with default flags:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCObjectFileInfo.cpp#L391

This patch allows a user to add any flags he wants.

I had to edit TargetLoweringObjectFileImpl.cpp to set MetaData type for debug sections.
Their kind was Data by default (so they were allocatable) and so after changes introduced by
this patch the SHF_ALLOC flag was applied for them, what does not make sense for debug sections.
One of OrcJITTests tests failed because of that.

Differential revision: https://reviews.llvm.org/D51361

llvm-svn: 340904
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/MCContext.cpp
llvm/test/MC/ELF/section-flags.s [new file with mode: 0644]