summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-02-17 20:48:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-02-17 20:48:01 +0000
commit68fa249cb5a9755f05e437db618d85e0097de8c3 (patch)
treeb8a223ea649e474a993233c5738e73fba8e83932 /llvm/lib/MC/MCSectionELF.cpp
parent3dcb3934c6072f5e2eed15fd63cdc1a35bb5cad4 (diff)
downloadbcm5719-llvm-68fa249cb5a9755f05e437db618d85e0097de8c3.tar.gz
bcm5719-llvm-68fa249cb5a9755f05e437db618d85e0097de8c3.zip
Add r228980 back.
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: 229541
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