summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-03-03 21:22:06 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-03-03 21:22:06 +0000
commit5b75fd9e56def2c63c1e3150e48e28a15c2af8f7 (patch)
tree11fea6d20441547b2b5c5546ca2afc44af516f81 /llvm/lib/MC
parentfaf1feb57dfad798b29241a8f0714014beed733a (diff)
downloadbcm5719-llvm-5b75fd9e56def2c63c1e3150e48e28a15c2af8f7.tar.gz
bcm5719-llvm-5b75fd9e56def2c63c1e3150e48e28a15c2af8f7.zip
MC: De-duplicate the object streamer implementations of EmitFileDirective into MCObjectStreamer. NFCI.
llvm-svn: 296912
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp2
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp7
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp7
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp4
-rw-r--r--llvm/lib/MC/MCWasmStreamer.cpp7
-rw-r--r--llvm/lib/MC/WinCOFFStreamer.cpp4
6 files changed, 6 insertions, 25 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index e56c9cb991e..b84ae5bad1c 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -902,6 +902,8 @@ void ELFObjectWriter::computeSymbolTable(
StrTabBuilder.finalize();
+ // File symbols are emitted first and handled separately from normal symbols,
+ // i.e. a non-STT_FILE symbol with the same name may appear.
for (const std::string &Name : FileNames)
Writer.writeSymbol(StrTabBuilder.getOffset(Name),
ELF::STT_FILE | ELF::STB_LOCAL, 0, 0, ELF::STV_DEFAULT,
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 172440080ea..0c786b2d0e9 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -348,13 +348,6 @@ void MCELFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
ValueSize, MaxBytesToEmit);
}
-// Add a symbol for the file name of this module. They start after the
-// null symbol and don't count as normal symbol, i.e. a non-STT_FILE symbol
-// with the same name may appear.
-void MCELFStreamer::EmitFileDirective(StringRef Filename) {
- getAssembler().addFileName(Filename);
-}
-
void MCELFStreamer::EmitIdent(StringRef IdentString) {
MCSection *Comment = getAssembler().getContext().getELFSection(
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 3ed89c4cccd..2001e3e3aea 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -99,13 +99,6 @@ public:
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment = 0) override;
- void EmitFileDirective(StringRef Filename) override {
- // FIXME: Just ignore the .file; it isn't important enough to fail the
- // entire assembly.
-
- // report_fatal_error("unsupported directive: '.file'");
- }
-
void EmitIdent(StringRef IdentString) override {
llvm_unreachable("macho doesn't support this directive");
}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 19269f880a4..2b89407547a 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -572,6 +572,10 @@ void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
MCStreamer::emitFill(IntNumValues, Size, Expr);
}
+void MCObjectStreamer::EmitFileDirective(StringRef Filename) {
+ getAssembler().addFileName(Filename);
+}
+
void MCObjectStreamer::FinishImpl() {
// If we are generating dwarf for assembly source files dump out the sections.
if (getContext().getGenDwarfForAssembly())
diff --git a/llvm/lib/MC/MCWasmStreamer.cpp b/llvm/lib/MC/MCWasmStreamer.cpp
index 708050b399b..59b62b8d37c 100644
--- a/llvm/lib/MC/MCWasmStreamer.cpp
+++ b/llvm/lib/MC/MCWasmStreamer.cpp
@@ -142,13 +142,6 @@ void MCWasmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
MaxBytesToEmit);
}
-// Add a symbol for the file name of this module. They start after the
-// null symbol and don't count as normal symbol, i.e. a non-STT_FILE symbol
-// with the same name may appear.
-void MCWasmStreamer::EmitFileDirective(StringRef Filename) {
- getAssembler().addFileName(Filename);
-}
-
void MCWasmStreamer::EmitIdent(StringRef IdentString) {
MCSection *Comment = getAssembler().getContext().getWasmSection(
".comment", 0, 0);
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index 2e75b5f131d..c26d87f36f8 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -278,10 +278,6 @@ void MCWinCOFFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
llvm_unreachable("not implemented");
}
-void MCWinCOFFStreamer::EmitFileDirective(StringRef Filename) {
- getAssembler().addFileName(Filename);
-}
-
// TODO: Implement this if you want to emit .comment section in COFF obj files.
void MCWinCOFFStreamer::EmitIdent(StringRef IdentString) {
llvm_unreachable("not implemented");
OpenPOWER on IntegriCloud