diff options
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/MC/MCMachOStreamer.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 1 |
4 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 2b56e2a..e142ac1 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -8,7 +8,6 @@ #include "llvm/MC/MCAssembler.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringRef.h" diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index b1dced7..e7c0d37 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -447,10 +447,17 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile, StringRef(reinterpret_cast<const char *>(Cksum.data()), Cksum.size())); } if (HasAnySource) { + // From https://dwarfstd.org/issues/180201.1.html + // * The value is an empty null-terminated string if no source is available + StringRef Source = DwarfFile.Source.value_or(StringRef()); + // * If the source is available but is an empty file then the value is a + // null-terminated single "\n". + if (DwarfFile.Source && DwarfFile.Source->empty()) + Source = "\n"; if (LineStr) - LineStr->emitRef(MCOS, DwarfFile.Source.value_or(StringRef())); + LineStr->emitRef(MCOS, Source); else { - MCOS->emitBytes(DwarfFile.Source.value_or(StringRef())); // Source and... + MCOS->emitBytes(Source); // Source and... MCOS->emitBytes(StringRef("\0", 1)); // its null terminator. } } diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index 7560399..8c3332c 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/MachO.h" @@ -478,7 +477,8 @@ void MCMachOStreamer::finalizeCGProfile() { // and set its size now so that it's accounted for in layout. MCSection *CGProfileSection = Asm.getContext().getMachOSection( "__LLVM", "__cg_profile", 0, SectionKind::getMetadata()); - changeSection(CGProfileSection); + // Call the base class changeSection to omit the linker-local label. + MCObjectStreamer::changeSection(CGProfileSection); // For each entry, reserve space for 2 32-bit indices and a 64-bit count. size_t SectionBytes = W.getCGProfile().size() * (2 * sizeof(uint32_t) + sizeof(uint64_t)); @@ -510,7 +510,8 @@ void MCMachOStreamer::createAddrSigSection() { // to be computed immediately after in order for it to be exported correctly. MCSection *AddrSigSection = Asm.getContext().getObjectFileInfo()->getAddrSigSection(); - changeSection(AddrSigSection); + // Call the base class changeSection to omit the linker-local label. + MCObjectStreamer::changeSection(AddrSigSection); auto *Frag = cast<MCFragment>(AddrSigSection->curFragList()->Head); // We will generate a series of pointer-sized symbol relocations at offset // 0x0. Set the section size to be large enough to contain a single pointer diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 42f4cf4..89f4da5 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -19,7 +19,6 @@ #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/SourceMgr.h" using namespace llvm; |