diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-11-18 23:08:12 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-11-18 23:08:12 +0000 |
commit | a7b7a7d629c3101f6f6c87e6848e865734e0238c (patch) | |
tree | df358ab615a9cc3e0e98f70c0223eed6938d1f5d /lib | |
parent | 940267e7f208751fdc48dbb7d6b5d86b6310ce7c (diff) | |
download | external_llvm-a7b7a7d629c3101f6f6c87e6848e865734e0238c.zip external_llvm-a7b7a7d629c3101f6f6c87e6848e865734e0238c.tar.gz external_llvm-a7b7a7d629c3101f6f6c87e6848e865734e0238c.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/WinCOFFObjectWriter.cpp | 21 | ||||
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 3252317..f0f7836 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/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, diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index b880f33..1258441 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -535,6 +535,7 @@ void X86AsmPrinter::EmitStartOfAsmFile(Module &M) { // cause the process to terminate immediately. LLVM does not know how to // register any SEH handlers, so its object files should be safe. S->setAbsolute(); + OutStreamer.EmitSymbolAttribute(S, MCSA_Global); OutStreamer.EmitAssignment( S, MCConstantExpr::Create(int64_t(1), MMI->getContext())); } |