CFI directives are generated for .S files.
Details
Diff Detail
Event Timeline
Please don't forget about a compiler-rt test (either in this or in a separate commit).
lib/MC/MCStreamer.cpp | ||
---|---|---|
278 | What about MCStreamer::EmitCFIDefCfa? | |
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
579 | This is shadowing X86AsmInstrumentation::FrameReg. Confusing. | |
850 | Please check (and test) that all this stuff works with -fno-unwind-tables. | |
868 | Is it even possible? Can we CHECK instead? | |
test/Instrumentation/AddressSanitizer/X86/asm_cfi.s | ||
1 | Please add at least a one-line comment on what this test is about. |
PTAL
lib/MC/MCStreamer.cpp | ||
---|---|---|
278 | Done. | |
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
579 | That's why I moved FrameReg to the private part of the X86AsmInstrumentation and there're no shadowing. But if you still insisting I'll rename X86AsmInstrumentation::FrameReg to something like InitialFrameReg. | |
850 | Sure, but could you please explain what -fno-unwind-tables does? | |
868 | MCDwarfFrameInfo::CfaRegister is set when something like .cfi_def_cfa_register was emitted. Otherwise it won't be set (even between .cfi_startproc and .cfi_endproc). | |
test/Instrumentation/AddressSanitizer/X86/asm_cfi.s | ||
1 | Done. |
D5547 is good, but I'd also like a line in asm_cfi.ll test that checks that we don't add any CFI instructions if there is no .cfi_startproc (i.e. unwind tables are off).
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
---|---|---|
579 | Yes, please rename. | |
868 | And this makes MCDwarfFrameInfo::CfaRegister unreliable, which is not so good. |
PTAL
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
---|---|---|
579 | Done. | |
850 | Done in http://reviews.llvm.org/D5547. | |
868 | Done. |
LGTM, but I'd like someone else to vet the changes to MCStreamer / MCDwarf.
lib/MC/MCStreamer.cpp | ||
---|---|---|
223 | I don't really like that we do this extra work (a) for each function and (b) even when there is no instrumentation and CurrentCfaRegister is unused. But all alternatives seem much more complex, and this loop typically has just one or two iterations, so maybe it's not worth optimizing. |
LGTM with a nit.
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
---|---|---|
861 | The X86::NoRegister in here is the 0 in CurrentCfaRegister(0), no? I would probably be cleaner no just use 0 everywhere. This could also be an assert now, no? The initial instructions should always be setting the initial frame register. |
Many thanks, Eugene and Rafael!
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp | ||
---|---|---|
861 | Done. |
I don't really like that we do this extra work (a) for each function and (b) even when there is no instrumentation and CurrentCfaRegister is unused. But all alternatives seem much more complex, and this loop typically has just one or two iterations, so maybe it's not worth optimizing.