summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFObjectWriter.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-11-18 23:08:12 +0000
committerReid Kleckner <reid@kleckner.net>2013-11-18 23:08:12 +0000
commit8b2ad2a962b13e8012a4cac38ba4bb9a94f6b5f9 (patch)
tree33a1d0fc8e8158ecee543e00a4cf7d6c71100404 /llvm/lib/MC/WinCOFFObjectWriter.cpp
parent8e10fdbc0ff5aba13dcedbc0668697693aaf19fd (diff)
downloadbcm5719-llvm-8b2ad2a962b13e8012a4cac38ba4bb9a94f6b5f9.tar.gz
bcm5719-llvm-8b2ad2a962b13e8012a4cac38ba4bb9a94f6b5f9.zip
Revert "COFF: Emit all MCSymbols rather than filtering out some of them"
This reverts commit r190888, to fix PR17967. The original change wasn't the right way to get @feat.00 into the object file. The right fix is to make @feat.00 be a global symbol. llvm-svn: 195053
Diffstat (limited to 'llvm/lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFObjectWriter.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index 32523173ee6..f0f7836e23b 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp
@@ -154,6 +154,8 @@ public:
void MakeSymbolReal(COFFSymbol &S, size_t Index);
void MakeSectionReal(COFFSection &S, size_t Number);
+ bool ExportSymbol(MCSymbolData const &SymbolData, MCAssembler &Asm);
+
bool IsPhysicalSection(COFFSection *S);
// Entity writing methods.
@@ -503,6 +505,18 @@ void WinCOFFObjectWriter::MakeSymbolReal(COFFSymbol &S, size_t Index) {
S.Index = Index;
}
+bool WinCOFFObjectWriter::ExportSymbol(MCSymbolData const &SymbolData,
+ MCAssembler &Asm) {
+ // This doesn't seem to be right. Strings referred to from the .data section
+ // need symbols so they can be linked to code in the .text section right?
+
+ // return Asm.isSymbolLinkerVisible (&SymbolData);
+
+ // For now, all non-variable symbols are exported,
+ // the linker will sort the rest out for us.
+ return SymbolData.isExternal() || !SymbolData.getSymbol().isVariable();
+}
+
bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
return (S->Header.Characteristics
& COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0;
@@ -605,8 +619,11 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
for (MCAssembler::const_symbol_iterator i = Asm.symbol_begin(),
e = Asm.symbol_end();
- i != e; i++)
- DefineSymbol(*i, Asm, Layout);
+ i != e; i++) {
+ if (ExportSymbol(*i, Asm)) {
+ DefineSymbol(*i, Asm, Layout);
+ }
+ }
}
void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
OpenPOWER on IntegriCloud