From 1706895a444f366722f428b6c2e722cb6ea6ef96 Mon Sep 17 00:00:00 2001
From: Mark Mentovai <mark@mentovai.com>
Date: Sat, 28 Sep 2024 00:37:28 -0400
Subject: [PATCH 2/2] compiler-rt: Move .cfi_start after the symbol label
 definition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a backport of 7939ce39dac0 to llvm-12, adapted because that
patch does not apply without 5f3c4923e4e4, which llvm-12 does not
include. The original change’s description:

> [PATCH] [builtins] Move cfi start's after the symbol name [NFC]
>
> ... in preparation for diagnosing improperly nested .cfi regions.
>
> See https://reviews.llvm.org/D155245
---
 compiler-rt/lib/builtins/assembly.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index f6ce6a9fccff..f859ad8f6706 100644
--- a/compiler-rt/lib/builtins/assembly.h
+++ b/compiler-rt/lib/builtins/assembly.h
@@ -249,9 +249,10 @@
   .globl name SEPARATOR                                                        \
   SYMBOL_IS_FUNC(name) SEPARATOR                                               \
   DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR                                    \
-  CFI_START SEPARATOR                                                          \
   DECLARE_FUNC_ENCODING                                                        \
-  name: SEPARATOR BTI_C
+  name:                                                                        \
+  SEPARATOR CFI_START                                                          \
+  SEPARATOR BTI_C
 
 #define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target)                         \
   .globl SYMBOL_NAME(name) SEPARATOR                                           \
-- 
2.46.2

