This is an archive of the discontinued LLVM Phabricator instance.

[llvm-mc] - Allow to set custom flags for debug sections.
AbandonedPublic

Authored by grimar on Aug 28 2018, 8:33 AM.

Details

Summary

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.

Diff Detail

Event Timeline

grimar created this revision.Aug 28 2018, 8:33 AM
JDevlieghere added a comment.EditedAug 28 2018, 8:44 AM

This looks reasonable, but then again I don't know much about ELF, so I'll leave it to someone with more expertise (looking at @dblaikie) to accept this.

dblaikie accepted this revision.Aug 28 2018, 10:20 AM

Sure - seems plausible

This revision is now accepted and ready to land.Aug 28 2018, 10:20 AM
This revision was automatically updated to reflect the committed changes.
grimar reopened this revision.Aug 29 2018, 2:10 AM
This revision is now accepted and ready to land.Aug 29 2018, 2:10 AM
grimar planned changes to this revision.Aug 29 2018, 2:12 AM

It was reverted in rL340906 because of the following test case failure:
CodeGen/Mips/gpopt-explict-section.ll (http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23252)
Will take a look a bit later.

grimar updated this revision to Diff 165773.Sep 17 2018, 8:41 AM
  • Fix BB failure.
This revision is now accepted and ready to land.Sep 17 2018, 8:41 AM
grimar requested review of this revision.Sep 17 2018, 8:41 AM
grimar abandoned this revision.Sep 20 2018, 6:47 AM

Abandoning, I believe D52303 is the better way to achieve what I want.