llvm.org GIT mirror llvm / 25f4c35
Revert r221150, as it broke sanitizer tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221151 91177308-0d34-0410-b5e6-96231b3b80d8 Oliver Stannard 6 years ago
10 changed file(s) with 19 addition(s) and 51 deletion(s). Raw diff Collapse all Expand all
4040 SmallVector PendingLabels;
4141
4242 virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0;
43 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame,
44 MCSymbol *FuncSym) override;
43 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
4544 void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
4645
4746 // If any labels have been emitted but not assigned fragments, ensure that
197197 protected:
198198 MCStreamer(MCContext &Ctx);
199199
200 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame, MCSymbol *FuncSym);
200 virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
201201 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
202202
203203 WinEH::FrameInfo *getCurrentWinFrameInfo() {
660660
661661 virtual MCSymbol *getDwarfLineTableSymbol(unsigned CUID);
662662 virtual void EmitCFISections(bool EH, bool Debug);
663 void EmitCFIStartProc(bool IsSimple, MCSymbol *FuncSym);
663 void EmitCFIStartProc(bool IsSimple);
664664 void EmitCFIEndProc();
665665 virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
666666 virtual void EmitCFIDefCfaOffset(int64_t Offset);
6565 "non-EH CFI not yet supported in prologue with EHABI lowering");
6666 if (MoveType == AsmPrinter::CFI_M_Debug) {
6767 shouldEmitCFI = true;
68 Asm->OutStreamer.EmitCFIStartProc(false, Asm->CurrentFnSym);
68 Asm->OutStreamer.EmitCFIStartProc(false);
6969 }
7070 }
7171
101101 if (!shouldEmitPersonality && !shouldEmitMoves)
102102 return;
103103
104 Asm->OutStreamer.EmitCFIStartProc(/*IsSimple=*/false, Asm->CurrentFnSym);
104 Asm->OutStreamer.EmitCFIStartProc(/*IsSimple=*/false);
105105
106106 // Indicate personality routine, if any.
107107 if (!shouldEmitPersonality)
5353 unsigned UseDwarfDirectory : 1;
5454
5555 void EmitRegisterName(int64_t Register);
56 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame,
57 MCSymbol *FuncSym) override;
56 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override;
5857 void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override;
5958
6059 public:
925924 EmitEOL();
926925 }
927926
928 void MCAsmStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame,
929 MCSymbol *FuncSym) {
927 void MCAsmStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
930928 OS << "\t.cfi_startproc";
931929 if (Frame.IsSimple)
932930 OS << " simple";
127127 DF->getContents().resize(DF->getContents().size() + Size, 0);
128128 }
129129
130 void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame,
131 MCSymbol *FuncSym) {
132 if (!FuncSym) {
133 FuncSym = getContext().CreateTempSymbol();
134 EmitLabel(FuncSym);
135 }
136 Frame.Begin = FuncSym;
130 void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
131 // We need to create a local symbol to avoid relocations.
132 Frame.Begin = getContext().CreateTempSymbol();
133 EmitLabel(Frame.Begin);
137134 }
138135
139136 void MCObjectStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
171171 /// \brief Are we parsing ms-style inline assembly?
172172 bool ParsingInlineAsm;
173173
174 /// \brief The last symbol we emitted, used for call frame information.
175 MCSymbol *LastFuncSymbol;
176
177174 public:
178175 AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
179176 const MCAsmInfo &MAI);
493490 : Lexer(_MAI), Ctx(_Ctx), Out(_Out), MAI(_MAI), SrcMgr(_SM),
494491 PlatformParser(nullptr), CurBuffer(_SM.getMainFileID()),
495492 MacrosEnabledFlag(true), HadError(false), CppHashLineNumber(0),
496 AssemblerDialect(~0U), IsDarwin(false), ParsingInlineAsm(false),
497 LastFuncSymbol(nullptr) {
493 AssemblerDialect(~0U), IsDarwin(false), ParsingInlineAsm(false) {
498494 // Save the old handler.
499495 SavedDiagHandler = SrcMgr.getDiagHandler();
500496 SavedDiagContext = SrcMgr.getDiagContext();
13071303 // Emit the label.
13081304 if (!ParsingInlineAsm)
13091305 Out.EmitLabel(Sym);
1310
1311 // Record the symbol, so that it can be used for call frame information
1312 LastFuncSymbol = Sym;
13131306
13141307 // If we are generating dwarf for assembly source files then gather the
13151308 // info to make a dwarf label entry for this label if needed.
29672960 if (parseIdentifier(Simple) || Simple != "simple")
29682961 return TokError("unexpected token in .cfi_startproc directive");
29692962
2970 getStreamer().EmitCFIStartProc(!Simple.empty(), LastFuncSymbol);
2963 getStreamer().EmitCFIStartProc(!Simple.empty());
29712964 return false;
29722965 }
29732966
210210 assert(EH || Debug);
211211 }
212212
213 void MCStreamer::EmitCFIStartProc(bool IsSimple, MCSymbol *FuncSym) {
213 void MCStreamer::EmitCFIStartProc(bool IsSimple) {
214214 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
215215 if (CurFrame && !CurFrame->End)
216216 report_fatal_error("Starting a frame before finishing the previous one!");
217217
218218 MCDwarfFrameInfo Frame;
219219 Frame.IsSimple = IsSimple;
220 EmitCFIStartProcImpl(Frame, FuncSym);
220 EmitCFIStartProcImpl(Frame);
221221
222222 const MCAsmInfo* MAI = Context.getAsmInfo();
223223 if (MAI) {
232232 DwarfFrameInfos.push_back(Frame);
233233 }
234234
235 void MCStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame,
236 MCSymbol *FuncSym) {}
235 void MCStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {
236 }
237237
238238 void MCStreamer::EmitCFIEndProc() {
239239 EnsureValidDwarfFrame();
0 // RUN: llvm-mc -triple aarch64-none-linux-gnu -filetype=obj %s -o %t
1 // RUN: llvm-objdump -s %t | FileCheck %s --check-prefix=CHECK
2 // RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
1 // RUN: llvm-objdump -s %t | FileCheck %s
32 .text
43 .globl foo
54 .type foo,@function
4645 // 00000000: PC begin for this FDE is at 00000000 (relocation is applied here)
4746 // 04000000: FDE applies up to PC begin+0x14
4847 // 00: Augmentation string length 0 for this FDE
49
50
51 // Check the relocations applied to the .eh_frame section.
52 // These must not contain section-relative relocations to a section which
53 // is part of a group, as it could be removed.
54 // RELOC: Section ({{[0-9]+}}) .rela.eh_frame {
55 // RELOC-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_PREL32 foo 0x0
56 // RELOC-NEXT: }
0 ; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu %s -filetype=obj -o %t
1 ; RUN: llvm-objdump -s %t | FileCheck %s --check-prefix=CHECK
2 ; RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
1 ; RUN: llvm-objdump -s %t | FileCheck %s
32
43 declare i32 @__gxx_personality_v0(...)
54
4443 ; 00: Second part of aug (language-specific data): absolute pointer format used
4544 ; 1b: pointer format: pc-relative signed 4-byte. Just like GNU.
4645 ; 0c 1f 00: Initial instructions ("DW_CFA_def_cfa x31 ofs 0" in this case)
47
48 ; Check the relocations applied to the .eh_frame section.
49 ; These must not contain section-relative relocations to a section which
50 ; is part of a group, as it could be removed.
51 ; RELOC: Section ({{[0-9]+}}) .rela.eh_frame {
52 ; RELOC-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_ABS64 __gxx_personality_v0 0x0
53 ; RELOC-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_PREL32 foo 0x0
54 ; RELOC-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_ABS64 .gcc_except_table 0x0
55 ; RELOC-NEXT: }