Skip to content

Commit

Permalink
Revert "[MC][AsmParser] Diagnose improperly nested .cfi frames"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mstorsjo committed Nov 19, 2023
1 parent 9ae04a7 commit 797b68c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
4 changes: 2 additions & 2 deletions lld/test/COFF/gc-dwarf-eh.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
.def _main; .scl 2; .type 32; .endef
.section .text,"xr",one_only,_main
.globl _main
_main:
.cfi_startproc
.cfi_personality 0, ___gxx_personality_v0
_main:
xorl %eax, %eax
ret
.cfi_endproc
Expand All @@ -29,8 +29,8 @@ ___gxx_personality_v0:
.def _unused; .scl 2; .type 32; .endef
.section .text,"xr",one_only,_unused
.globl _unused
_unused:
.cfi_startproc
.cfi_personality 0, ___gxx_personality_v0
_unused:
ret
.cfi_endproc
11 changes: 0 additions & 11 deletions llvm/lib/MC/MCParser/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class AsmParser : public MCAsmParser {
void *SavedDiagContext;
std::unique_ptr<MCAsmParserExtension> PlatformParser;
SMLoc StartTokLoc;
std::optional<SMLoc> CFIStartProcLoc;

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

if (CFIStartProcLoc && Sym->isExternal())
return Error(StartTokLoc, "non-private labels cannot appear between "
".cfi_startproc / .cfi_endproc pairs") &&
Error(*CFIStartProcLoc, "previous .cfi_startproc was here");

if (discardLTOSymbol(IDVal))
return false;

Expand Down Expand Up @@ -4199,8 +4193,6 @@ bool AsmParser::parseDirectiveCFISections() {
/// parseDirectiveCFIStartProc
/// ::= .cfi_startproc [simple]
bool AsmParser::parseDirectiveCFIStartProc() {
CFIStartProcLoc = StartTokLoc;

StringRef Simple;
if (!parseOptionalToken(AsmToken::EndOfStatement)) {
if (check(parseIdentifier(Simple) || Simple != "simple",
Expand All @@ -4221,11 +4213,8 @@ bool AsmParser::parseDirectiveCFIStartProc() {
/// parseDirectiveCFIEndProc
/// ::= .cfi_endproc
bool AsmParser::parseDirectiveCFIEndProc() {
CFIStartProcLoc = std::nullopt;

if (parseEOL())
return true;

getStreamer().emitCFIEndProc();
return false;
}
Expand Down
23 changes: 0 additions & 23 deletions llvm/test/MC/AArch64/cfi-bad-nesting.s

This file was deleted.

0 comments on commit 797b68c

Please sign in to comment.