diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2015-09-25 21:41:14 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2015-09-25 21:41:14 +0000 |
commit | 8e0257625dbe290acd1824cb7bd1224991edf132 (patch) | |
tree | 618b36bf2307e4edefb76ffff191607ea41625c9 /llvm/lib/MC/MCAsmInfo.cpp | |
parent | c2d4befb54e2f978e14c5625065d8718016de7de (diff) | |
download | llvm-8e0257625dbe290acd1824cb7bd1224991edf132.zip llvm-8e0257625dbe290acd1824cb7bd1224991edf132.tar.gz llvm-8e0257625dbe290acd1824cb7bd1224991edf132.tar.bz2 |
MCAsmInfo: Allow targets to specify when the .section directive should be omitted
Summary:
The default behavior is to omit the .section directive for .text, .data,
and sometimes .bss, but some targets may want to omit this directive for
other sections too.
The AMDGPU backend will uses this to emit a simplified syntax for section
switches. For example if the section directive is not omitted (current
behavior), section switches to .hsatext will be printed like this:
.section .hsatext,#alloc,#execinstr,#write
This is actually wrong, because .hsatext has some custom STT_* flags,
which MC doesn't know how to print or parse.
If the section directive is omitted (made possible by this commit),
section switches will be printed like this:
.hsatext
The motivation for this patch is to make it possible to emit sections
with custom STT_* flags without having to teach MC about all the target
specific STT_* flags.
Reviewers: rafael, grosbach
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D12423
llvm-svn: 248618
Diffstat (limited to 'llvm/lib/MC/MCAsmInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCAsmInfo.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAsmInfo.cpp b/llvm/lib/MC/MCAsmInfo.cpp index 100dc7c..36e10b3 100644 --- a/llvm/lib/MC/MCAsmInfo.cpp +++ b/llvm/lib/MC/MCAsmInfo.cpp @@ -157,3 +157,9 @@ bool MCAsmInfo::isValidUnquotedName(StringRef Name) const { return true; } + +bool MCAsmInfo::shouldOmitSectionDirective(StringRef SectionName) const { + // FIXME: Does .section .bss/.data/.text work everywhere?? + return SectionName == ".text" || SectionName == ".data" || + (SectionName == ".bss" && !usesELFSectionDirectiveForBSS()); +} |