mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-04 17:56:53 +00:00
Some autoconf tests use module level inline asm to test compiler's handling of
.cfi_startproc. e.g. libffi: $ cat confopt.c asm (".cfi_startproc\n\t.cfi_endproc"); int main () { return 0; } Teach MC / dwarf emission to handle these cfi directives which essentially create an empty frame. rdar://10017184 llvm-svn: 138504
This commit is contained in:
parent
aae1749f65
commit
7bfc442b2d
@ -895,7 +895,7 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
|
||||
const MCObjectFileInfo *MOFI = context.getObjectFileInfo();
|
||||
bool verboseAsm = streamer.isVerboseAsm();
|
||||
|
||||
if (!MOFI->isFunctionEHFrameSymbolPrivate() && IsEH) {
|
||||
if (IsEH && frame.Function && !MOFI->isFunctionEHFrameSymbolPrivate()) {
|
||||
MCSymbol *EHSym =
|
||||
context.GetOrCreateSymbol(frame.Function->getName() + Twine(".eh"));
|
||||
streamer.EmitEHSymAttributes(frame.Function, EHSym);
|
||||
|
@ -190,14 +190,14 @@ void MCStreamer::EmitCFIStartProc() {
|
||||
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
|
||||
if (CurFrame && !CurFrame->End)
|
||||
report_fatal_error("Starting a frame before finishing the previous one!");
|
||||
MCDwarfFrameInfo Frame;
|
||||
|
||||
MCDwarfFrameInfo Frame;
|
||||
Frame.Function = LastSymbol;
|
||||
|
||||
// If the function is externally visible, we need to create a local
|
||||
// symbol to avoid relocations.
|
||||
StringRef Prefix = getContext().getAsmInfo().getPrivateGlobalPrefix();
|
||||
if (LastSymbol->getName().startswith(Prefix)) {
|
||||
if (LastSymbol && LastSymbol->getName().startswith(Prefix)) {
|
||||
Frame.Begin = LastSymbol;
|
||||
} else {
|
||||
Frame.Begin = getContext().CreateTempSymbol();
|
||||
|
@ -1,5 +1,11 @@
|
||||
// RUN: llvm-mc -triple i386-apple-darwin %s -filetype=obj -o - | macho-dump | FileCheck %s
|
||||
|
||||
// Make sure MC can handle file level .cfi_startproc and .cfi_endproc that creates
|
||||
// an empty frame.
|
||||
// rdar://10017184
|
||||
.cfi_startproc
|
||||
.cfi_endproc
|
||||
|
||||
// Check that we don't produce a relocation for the CIE pointer and therefore
|
||||
// we have only one relocation in __debug_frame.
|
||||
|
||||
@ -22,17 +28,20 @@ Ltext_end:
|
||||
// CHECK: (('section_name', '__debug_frame\x00\x00\x00')
|
||||
// CHECK-NEXT: ('segment_name', '__DWARF\x00\x00\x00\x00\x00\x00\x00\x00\x00')
|
||||
// CHECK-NEXT: ('address', 8)
|
||||
// CHECK-NEXT: ('size', 36)
|
||||
// CHECK-NEXT: ('size', 52)
|
||||
// CHECK-NEXT: ('offset', 332)
|
||||
// CHECK-NEXT: ('alignment', 2)
|
||||
// CHECK-NEXT: ('reloc_offset', 368)
|
||||
// CHECK-NEXT: ('num_reloc', 1)
|
||||
// CHECK-NEXT: ('reloc_offset', 384)
|
||||
// CHECK-NEXT: ('num_reloc', 2)
|
||||
// CHECK-NEXT: ('flags', 0x2000000)
|
||||
// CHECK-NEXT: ('reserved1', 0)
|
||||
// CHECK-NEXT: ('reserved2', 0)
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: ('_relocations', [
|
||||
// CHECK-NEXT: # Relocation 0
|
||||
// CHECK-NEXT: (('word-0', 0x2c),
|
||||
// CHECK-NEXT: ('word-1', 0x4000001)),
|
||||
// CHECK-NEXT: # Relocation 1
|
||||
// CHECK-NEXT: (('word-0', 0x1c),
|
||||
// CHECK-NEXT: ('word-1', 0x4000001)),
|
||||
// CHECK-NEXT: ])
|
||||
|
Loading…
Reference in New Issue
Block a user