summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-02-12 23:29:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-02-12 23:29:51 +0000
commitb6a812ebb10c074266d6e4f9d2e2405bf57e4788 (patch)
treea108b29b58d3e0b9b9bdf17a74d667d207a3cc10 /llvm/lib/MC/MCSectionELF.cpp
parenta12fcb790fb3694c6fcdf14047be72283ae4a0ee (diff)
downloadbcm5719-llvm-b6a812ebb10c074266d6e4f9d2e2405bf57e4788.tar.gz
bcm5719-llvm-b6a812ebb10c074266d6e4f9d2e2405bf57e4788.zip
Add support for having multiple sections with the same name and comdat.
Using this in combination with -ffunction-sections allows LLVM to output a .o file with mulitple sections named .text. This saves space by avoiding long unique names of the form .text.<C++ mangled name>. llvm-svn: 228980
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index fb364c87a03..da3868273a7 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -24,6 +24,9 @@ MCSectionELF::~MCSectionELF() {} // anchor.
bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
const MCAsmInfo &MAI) const {
+ if (Unique)
+ return false;
+
// FIXME: Does .section .bss/.data/.text work everywhere??
if (Name == ".text" || Name == ".data" ||
(Name == ".bss" && !MAI.usesELFSectionDirectiveForBSS()))
@@ -144,6 +147,10 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
printName(OS, Group->getName());
OS << ",comdat";
}
+
+ if (Unique)
+ OS << ",unique";
+
OS << '\n';
if (Subsection)
OpenPOWER on IntegriCloud