[llvm-commits] [llvm] r125490 - in /llvm/trunk: include/llvm/MC/MCSectionELF.h lib/CodeGen/ELFWriter.cpp lib/MC/MCSectionELF.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Feb 14 08:51:08 PST 2011
Author: rafael
Date: Mon Feb 14 10:51:08 2011
New Revision: 125490
URL: http://llvm.org/viewvc/llvm-project?rev=125490&view=rev
Log:
Move broken HasCommonSymbols to ELFWriter.cpp.
Modified:
llvm/trunk/include/llvm/MC/MCSectionELF.h
llvm/trunk/lib/CodeGen/ELFWriter.cpp
llvm/trunk/lib/MC/MCSectionELF.cpp
Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=125490&r1=125489&r2=125490&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Mon Feb 14 10:51:08 2011
@@ -55,11 +55,6 @@
/// should be printed before the section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
- /// HasCommonSymbols - True if this section holds common symbols, this is
- /// indicated on the ELF object file by a symbol with SHN_COMMON section
- /// header index.
- bool HasCommonSymbols() const;
-
StringRef getSectionName() const { return SectionName; }
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=125490&r1=125489&r2=125490&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Feb 14 10:51:08 2011
@@ -328,6 +328,18 @@
}
}
+/// HasCommonSymbols - True if this section holds common symbols, this is
+/// indicated on the ELF object file by a symbol with SHN_COMMON section
+/// header index.
+static bool HasCommonSymbols(const MCSectionELF &S) {
+ // FIXME: this is wrong, a common symbol can be in .data for example.
+ if (StringRef(S.getSectionName()).startswith(".gnu.linkonce."))
+ return true;
+
+ return false;
+}
+
+
// EmitGlobal - Choose the right section for global and emit it
void ELFWriter::EmitGlobal(const GlobalValue *GV) {
@@ -364,7 +376,7 @@
unsigned Size = TD->getTypeAllocSize(GVar->getInitializer()->getType());
GblSym->Size = Size;
- if (S->HasCommonSymbols()) { // Symbol must go to a common section
+ if (HasCommonSymbols(*S)) { // Symbol must go to a common section
GblSym->SectionIdx = ELF::SHN_COMMON;
// A new linkonce section is created for each global in the
Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=125490&r1=125489&r2=125490&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Mon Feb 14 10:51:08 2011
@@ -115,17 +115,6 @@
return getType() == ELF::SHT_NOBITS;
}
-// HasCommonSymbols - True if this section holds common symbols, this is
-// indicated on the ELF object file by a symbol with SHN_COMMON section
-// header index.
-bool MCSectionELF::HasCommonSymbols() const {
-
- if (StringRef(SectionName).startswith(".gnu.linkonce."))
- return true;
-
- return false;
-}
-
unsigned MCSectionELF::DetermineEntrySize(SectionKind Kind) {
if (Kind.isMergeable1ByteCString()) return 1;
if (Kind.isMergeable2ByteCString()) return 2;
More information about the llvm-commits
mailing list