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

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 19 10:21:16 PST 2023


jroelofs added a comment.

In D155245#4657075 <https://reviews.llvm.org/D155245#4657075>, @mstorsjo wrote:

> 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.

I may need to restrict this to just MachO, and possibly only when `.subsections_via_symbols` is present.  If this is blocking you, please feel free to revert.

> 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
>   ^

That is really weird.  I'll investigate this week.

https://github.com/llvm/llvm-project/issues/72802

In D155245#4657076 <https://reviews.llvm.org/D155245#4657076>, @mstorsjo wrote:

> For cross reference, I filed an issue with libffi at https://github.com/libffi/libffi/issues/807 about this.

Thank you!


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