Move cfi_startproc after CNAME(label) (#857)
authorIvan Tadeu Ferreira Antunes Filho <antunesi@google.com>
Fri, 20 Sep 2024 10:01:23 +0000 (06:01 -0400)
committerGitHub <noreply@github.com>
Fri, 20 Sep 2024 10:01:23 +0000 (06:01 -0400)
This is a fix for https://github.com/libffi/libffi/issues/852: error: invalid CFI advance_loc expression on apple targets.

The CFI for darwin arm64 was broken because the CNAME macro was being used after the
cfi_startproc macro.

src/aarch64/sysv.S

index 6a9a5611fd0a5e2927d24140a5094b677ce06c57..e83bc65de4dc97a6212f941bd43d0867d2fb4c7b 100644 (file)
@@ -89,8 +89,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
    x5 closure
 */
 
-       cfi_startproc
 CNAME(ffi_call_SYSV):
+       cfi_startproc
        BTI_C
        PAC_CFI_WINDOW_SAVE
        /* Sign the lr with x1 since that is the CFA which is the modifer used in auth instructions */
@@ -348,8 +348,8 @@ CNAME(ffi_closure_SYSV_V):
 #endif
 
        .align  4
-       cfi_startproc
 CNAME(ffi_closure_SYSV):
+       cfi_startproc
        BTI_C
        SIGN_LR
        PAC_CFI_WINDOW_SAVE
@@ -647,8 +647,8 @@ CNAME(ffi_go_closure_SYSV_V):
 #endif
 
        .align  4
-       cfi_startproc
 CNAME(ffi_go_closure_SYSV):
+       cfi_startproc
        BTI_C
        SIGN_LR_LINUX_ONLY
        PAC_CFI_WINDOW_SAVE