mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
We want the dwarf AT_producer for assembly source files to match clang's
AT_producer. Which includes clang's version information so we can tell which version of the compiler was used. This is the first of two steps to allow us to do that. This is the llvm-mc change to provide a method to set the AT_producer string. The second step, coming soon to a clang near you, will have the clang driver pass the value of getClangFullVersion() via an flag when invoking the integrated assembler on assembly source files. rdar://12955296 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fbb662f840
commit
75c9b9384f
@ -129,6 +129,10 @@ namespace llvm {
|
|||||||
/// non-empty.
|
/// non-empty.
|
||||||
StringRef DwarfDebugFlags;
|
StringRef DwarfDebugFlags;
|
||||||
|
|
||||||
|
/// The string to embed in as the dwarf AT_producer for the compile unit, if
|
||||||
|
/// non-empty.
|
||||||
|
StringRef DwarfDebugProducer;
|
||||||
|
|
||||||
/// Honor temporary labels, this is useful for debugging semantic
|
/// Honor temporary labels, this is useful for debugging semantic
|
||||||
/// differences between temporary and non-temporary labels (primarily on
|
/// differences between temporary and non-temporary labels (primarily on
|
||||||
/// Darwin).
|
/// Darwin).
|
||||||
@ -346,6 +350,9 @@ namespace llvm {
|
|||||||
void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
|
void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
|
||||||
StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
|
StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
|
||||||
|
|
||||||
|
void setDwarfDebugProducer(StringRef S) { DwarfDebugProducer = S; }
|
||||||
|
StringRef getDwarfDebugProducer() { return DwarfDebugProducer; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
char *getSecureLogFile() { return SecureLogFile; }
|
char *getSecureLogFile() { return SecureLogFile; }
|
||||||
|
@ -638,9 +638,15 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AT_producer, the version of the assembler tool.
|
// AT_producer, the version of the assembler tool.
|
||||||
MCOS->EmitBytes(StringRef("llvm-mc (based on LLVM "));
|
StringRef DwarfDebugProducer = context.getDwarfDebugProducer();
|
||||||
MCOS->EmitBytes(StringRef(PACKAGE_VERSION));
|
if (!DwarfDebugProducer.empty()){
|
||||||
MCOS->EmitBytes(StringRef(")"));
|
MCOS->EmitBytes(DwarfDebugProducer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MCOS->EmitBytes(StringRef("llvm-mc (based on LLVM "));
|
||||||
|
MCOS->EmitBytes(StringRef(PACKAGE_VERSION));
|
||||||
|
MCOS->EmitBytes(StringRef(")"));
|
||||||
|
}
|
||||||
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
|
||||||
|
|
||||||
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
|
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
|
||||||
|
8
test/MC/MachO/gen-dwarf-producer.s
Normal file
8
test/MC/MachO/gen-dwarf-producer.s
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// RUN: env DEBUG_PRODUCER="my producer" llvm-mc -g -triple i386-apple-darwin10 %s -filetype=obj -o %t
|
||||||
|
// RUN: llvm-dwarfdump %t | FileCheck %s
|
||||||
|
|
||||||
|
.globl _bar
|
||||||
|
_bar:
|
||||||
|
ret
|
||||||
|
|
||||||
|
// CHECK: DW_AT_producer [DW_FORM_string] ("my producer")
|
@ -236,6 +236,13 @@ static void setDwarfDebugFlags(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string DwarfDebugProducer;
|
||||||
|
static void setDwarfDebugProducer(void) {
|
||||||
|
if(!getenv("DEBUG_PRODUCER"))
|
||||||
|
return;
|
||||||
|
DwarfDebugProducer += getenv("DEBUG_PRODUCER");
|
||||||
|
}
|
||||||
|
|
||||||
static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI, tool_output_file *Out) {
|
static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI, tool_output_file *Out) {
|
||||||
|
|
||||||
AsmLexer Lexer(MAI);
|
AsmLexer Lexer(MAI);
|
||||||
@ -353,6 +360,8 @@ int main(int argc, char **argv) {
|
|||||||
TripleName = Triple::normalize(TripleName);
|
TripleName = Triple::normalize(TripleName);
|
||||||
setDwarfDebugFlags(argc, argv);
|
setDwarfDebugFlags(argc, argv);
|
||||||
|
|
||||||
|
setDwarfDebugProducer();
|
||||||
|
|
||||||
const char *ProgName = argv[0];
|
const char *ProgName = argv[0];
|
||||||
const Target *TheTarget = GetTarget(ProgName);
|
const Target *TheTarget = GetTarget(ProgName);
|
||||||
if (!TheTarget)
|
if (!TheTarget)
|
||||||
@ -393,6 +402,8 @@ int main(int argc, char **argv) {
|
|||||||
Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
|
Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
|
||||||
if (!DwarfDebugFlags.empty())
|
if (!DwarfDebugFlags.empty())
|
||||||
Ctx.setDwarfDebugFlags(StringRef(DwarfDebugFlags));
|
Ctx.setDwarfDebugFlags(StringRef(DwarfDebugFlags));
|
||||||
|
if (!DwarfDebugProducer.empty())
|
||||||
|
Ctx.setDwarfDebugProducer(StringRef(DwarfDebugProducer));
|
||||||
if (!DebugCompilationDir.empty())
|
if (!DebugCompilationDir.empty())
|
||||||
Ctx.setCompilationDir(DebugCompilationDir);
|
Ctx.setCompilationDir(DebugCompilationDir);
|
||||||
if (!MainFileName.empty())
|
if (!MainFileName.empty())
|
||||||
|
Loading…
Reference in New Issue
Block a user