Skip to content

Commit 797b68c

Browse files
committed
Revert "[MC][AsmParser] Diagnose improperly nested .cfi frames"
This reverts commit 4323da9. This broke building libffi for ARM on Windows (and probably Darwin), where one extern function intentionally falls through to another one, while sharing one CFI region. As long as one isn't using .subsections_via_symbols on MachO, this probably shouldn't be a hard error. Secondly, the tested pattern only produces an error on MachO and COFF targets, but not for ELF, making the error case even more inconsistent. Reverting this commit for now, to figure out the best way forward.
1 parent 9ae04a7 commit 797b68c

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

lld/test/COFF/gc-dwarf-eh.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
.def _main; .scl 2; .type 32; .endef
1414
.section .text,"xr",one_only,_main
1515
.globl _main
16-
_main:
1716
.cfi_startproc
1817
.cfi_personality 0, ___gxx_personality_v0
18+
_main:
1919
xorl %eax, %eax
2020
ret
2121
.cfi_endproc
@@ -29,8 +29,8 @@ ___gxx_personality_v0:
2929
.def _unused; .scl 2; .type 32; .endef
3030
.section .text,"xr",one_only,_unused
3131
.globl _unused
32-
_unused:
3332
.cfi_startproc
3433
.cfi_personality 0, ___gxx_personality_v0
34+
_unused:
3535
ret
3636
.cfi_endproc

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class AsmParser : public MCAsmParser {
125125
void *SavedDiagContext;
126126
std::unique_ptr<MCAsmParserExtension> PlatformParser;
127127
SMLoc StartTokLoc;
128-
std::optional<SMLoc> CFIStartProcLoc;
129128

130129
/// This is the current buffer index we're lexing from as managed by the
131130
/// SourceMgr object.
@@ -1950,11 +1949,6 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
19501949
Lex();
19511950
}
19521951

1953-
if (CFIStartProcLoc && Sym->isExternal())
1954-
return Error(StartTokLoc, "non-private labels cannot appear between "
1955-
".cfi_startproc / .cfi_endproc pairs") &&
1956-
Error(*CFIStartProcLoc, "previous .cfi_startproc was here");
1957-
19581952
if (discardLTOSymbol(IDVal))
19591953
return false;
19601954

@@ -4199,8 +4193,6 @@ bool AsmParser::parseDirectiveCFISections() {
41994193
/// parseDirectiveCFIStartProc
42004194
/// ::= .cfi_startproc [simple]
42014195
bool AsmParser::parseDirectiveCFIStartProc() {
4202-
CFIStartProcLoc = StartTokLoc;
4203-
42044196
StringRef Simple;
42054197
if (!parseOptionalToken(AsmToken::EndOfStatement)) {
42064198
if (check(parseIdentifier(Simple) || Simple != "simple",
@@ -4221,11 +4213,8 @@ bool AsmParser::parseDirectiveCFIStartProc() {
42214213
/// parseDirectiveCFIEndProc
42224214
/// ::= .cfi_endproc
42234215
bool AsmParser::parseDirectiveCFIEndProc() {
4224-
CFIStartProcLoc = std::nullopt;
4225-
42264216
if (parseEOL())
42274217
return true;
4228-
42294218
getStreamer().emitCFIEndProc();
42304219
return false;
42314220
}

llvm/test/MC/AArch64/cfi-bad-nesting.s

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)