[PATCH] D155245: [MC][AsmParser] Diagnose improperly nested .cfi frames

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 18 13:48:38 PST 2023


mstorsjo added a comment.

This breaks building libffi for 32 bit arm; the following snippet does fallthrough from one global function to another, while sharing one single CFI region for all of them: https://github.com/libffi/libffi/blob/master/src/arm/sysv.S#L139-L213

Based on this patch, the code in libffi looks like it would be invalid and intentionally should fail to compile.

However, I noticed a different surprising detail here; it looks like this check fails to trigger on Linux (ELF in general I presume?) targets, while it does trigger on MachO and COFF. This can be tested with something like this:

  .globl ffi_call_VFP
  ffi_call_VFP:
  .cfi_startproc
  nop
  .globl ffi_call_SYSV
  ffi_call_SYSV:
  nop
  .cfi_endproc



  $ clang -target aarch64-linux-gnu -c fallthrough.s 
  $ clang -target aarch64-apple-darwin -c fallthrough.s 
  fallthrough.s:7:1: error: non-private labels cannot appear between .cfi_startproc / .cfi_endproc pairs 
  ffi_call_SYSV:
  ^
  fallthrough.s:3:2: error: previous .cfi_startproc was here
  .cfi_startproc 
  ^
  $ clang -target aarch64-windows-gnu -c fallthrough.s 
  fallthrough.s:7:1: error: non-private labels cannot appear between .cfi_startproc / .cfi_endproc pairs
  ffi_call_SYSV:
  ^
  fallthrough.s:3:2: error: previous .cfi_startproc was here
  .cfi_startproc
  ^


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155245/new/

https://reviews.llvm.org/D155245



More information about the llvm-commits mailing list