mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Allow using .cfi_startproc without a leading symbol.
This is possible now that we don't produce .eh symbols. This fixes pr19430. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211502 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1e1bf1bf76
commit
88a564f55e
@ -466,14 +466,12 @@ public:
|
||||
struct MCDwarfFrameInfo {
|
||||
MCDwarfFrameInfo()
|
||||
: Begin(nullptr), End(nullptr), Personality(nullptr), Lsda(nullptr),
|
||||
Function(nullptr), Instructions(), PersonalityEncoding(),
|
||||
LsdaEncoding(0), CompactUnwindEncoding(0), IsSignalFrame(false),
|
||||
IsSimple(false) {}
|
||||
Instructions(), PersonalityEncoding(), LsdaEncoding(0),
|
||||
CompactUnwindEncoding(0), IsSignalFrame(false), IsSimple(false) {}
|
||||
MCSymbol *Begin;
|
||||
MCSymbol *End;
|
||||
const MCSymbol *Personality;
|
||||
const MCSymbol *Lsda;
|
||||
const MCSymbol *Function;
|
||||
std::vector<MCCFIInstruction> Instructions;
|
||||
unsigned PersonalityEncoding;
|
||||
unsigned LsdaEncoding;
|
||||
|
@ -164,8 +164,6 @@ class MCStreamer {
|
||||
void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
|
||||
void EnsureValidW64UnwindInfo();
|
||||
|
||||
MCSymbol *LastSymbol;
|
||||
|
||||
// SymbolOrdering - Tracks an index to represent the order
|
||||
// a symbol was emitted in. Zero means we did not emit that symbol.
|
||||
DenseMap<const MCSymbol *, unsigned> SymbolOrdering;
|
||||
|
@ -1297,7 +1297,7 @@ void FrameEmitterImpl::EmitCompactUnwind(MCStreamer &Streamer,
|
||||
unsigned FDEEncoding = MOFI->getFDEEncoding();
|
||||
unsigned Size = getSizeForEncoding(Streamer, FDEEncoding);
|
||||
if (VerboseAsm) Streamer.AddComment("Range Start");
|
||||
Streamer.EmitSymbolValue(Frame.Function, Size);
|
||||
Streamer.EmitSymbolValue(Frame.Begin, Size);
|
||||
|
||||
// Range Length
|
||||
const MCExpr *Range = MakeStartMinusEndExpr(Streamer, *Frame.Begin,
|
||||
|
@ -37,7 +37,7 @@ void MCTargetStreamer::finish() {}
|
||||
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
|
||||
|
||||
MCStreamer::MCStreamer(MCContext &Ctx)
|
||||
: Context(Ctx), CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
|
||||
: Context(Ctx), CurrentW64UnwindInfo(nullptr) {
|
||||
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
|
||||
}
|
||||
|
||||
@ -51,7 +51,6 @@ void MCStreamer::reset() {
|
||||
delete W64UnwindInfos[i];
|
||||
W64UnwindInfos.clear();
|
||||
CurrentW64UnwindInfo = nullptr;
|
||||
LastSymbol = nullptr;
|
||||
SectionStack.clear();
|
||||
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
|
||||
}
|
||||
@ -234,7 +233,6 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||
assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
|
||||
assert(getCurrentSection().first && "Cannot emit before setting section!");
|
||||
AssignSection(Symbol, getCurrentSection().first);
|
||||
LastSymbol = Symbol;
|
||||
|
||||
MCTargetStreamer *TS = getTargetStreamer();
|
||||
if (TS)
|
||||
@ -245,7 +243,6 @@ void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) {
|
||||
assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
|
||||
assert(getCurrentSection().first && "Cannot emit before setting section!");
|
||||
AssignSection(Symbol, getCurrentSection().first);
|
||||
LastSymbol = Symbol;
|
||||
}
|
||||
|
||||
void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
|
||||
@ -274,11 +271,6 @@ void MCStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
|
||||
}
|
||||
|
||||
void MCStreamer::RecordProcStart(MCDwarfFrameInfo &Frame) {
|
||||
// Report an error if we haven't seen a symbol yet where we'd bind
|
||||
// .cfi_startproc.
|
||||
if (!LastSymbol)
|
||||
report_fatal_error("No symbol to start a frame");
|
||||
Frame.Function = LastSymbol;
|
||||
// We need to create a local symbol to avoid relocations.
|
||||
Frame.Begin = getContext().CreateTempSymbol();
|
||||
EmitLabel(Frame.Begin);
|
||||
|
@ -1,16 +0,0 @@
|
||||
# RUN: not llvm-mc -triple=x86_64-apple-macosx10.8 -filetype=obj -o %t %s 2>&1 | FileCheck %s
|
||||
# Check that the cfi_startproc is declared after the beginning of
|
||||
# a procedure, otherwise it will reference an invalid symbol for
|
||||
# emitting the relocation.
|
||||
# <rdar://problem/15939159>
|
||||
|
||||
# CHECK: No symbol to start a frame
|
||||
.text
|
||||
.cfi_startproc
|
||||
.globl _someFunction
|
||||
_someFunction:
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset %rbp, -16
|
||||
.cfi_def_cfa_register rbp
|
||||
ret
|
||||
.cfi_endproc
|
14
test/MC/ELF/pr19430.s
Normal file
14
test/MC/ELF/pr19430.s
Normal file
@ -0,0 +1,14 @@
|
||||
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
|
||||
|
||||
// Test that we can use .cfi_startproc without a global symbol.
|
||||
|
||||
.text
|
||||
.space 1000
|
||||
.cfi_startproc
|
||||
.cfi_endproc
|
||||
|
||||
// CHECK: Relocations [
|
||||
// CHECK-NEXT: Section (5) .rela.eh_frame {
|
||||
// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x3E8
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ]
|
Loading…
Reference in New Issue
Block a user