From 30b3440cfd378dc67111b1380f2654334d048659 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 26 May 2016 08:55:04 +0100 Subject: [PATCH 1/3] [Darwin, configure] Allow configure to work for -*-darwin. The exec configury is appropriate for all current targets (including using older tools on them). --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9483b28..e49a788 100644 --- a/configure.ac +++ b/configure.ac @@ -197,7 +197,7 @@ case "$target" in [Cannot use PROT_EXEC on this target, so, we revert to alternative means]) ;; - *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) From 92810b4bc101fccead2234b7385d4fa5e7a3e56a Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 26 May 2016 08:56:51 +0100 Subject: [PATCH 2/3] [Darwin-x86, build] Fix up label prefixes, remove .purgem Darwin uses a label prefix of _. cctools assembler will not accept .purgem as a directive. --- src/x86/win64.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/x86/win64.S b/src/x86/win64.S index 1f82a3e..d11051d 100644 --- a/src/x86/win64.S +++ b/src/x86/win64.S @@ -41,10 +41,10 @@ deallocate some of the stack that has been alloca'd. */ .align 8 - .globl ffi_call_win64 + .globl C(ffi_call_win64) SEH(.seh_proc ffi_call_win64) -ffi_call_win64: +C(ffi_call_win64): cfi_startproc /* Set up the local stack frame and install it in rbp/rsp. */ movq (%rsp), %rax @@ -155,7 +155,7 @@ E(0b, FFI_TYPE_SMALL_STRUCT_4B) .align 8 99: call PLT(C(abort)) -.purgem epilogue + epilogue cfi_endproc SEH(.seh_endproc) @@ -168,10 +168,10 @@ E(0b, FFI_TYPE_SMALL_STRUCT_4B) #define ffi_clo_OFF_X (32+8+16) .align 8 - .globl ffi_go_closure_win64 + .globl C(ffi_go_closure_win64) SEH(.seh_proc ffi_go_closure_win64) -ffi_go_closure_win64: +C(ffi_go_closure_win64): cfi_startproc /* Save all integer arguments into the incoming reg stack space. */ movq %rcx, 8(%rsp) @@ -187,10 +187,10 @@ ffi_go_closure_win64: SEH(.seh_endproc) .align 8 - .globl ffi_closure_win64 + .globl C(ffi_closure_win64) SEH(.seh_proc ffi_closure_win64) -ffi_closure_win64: +C(ffi_closure_win64): cfi_startproc /* Save all integer arguments into the incoming reg stack space. */ movq %rcx, 8(%rsp) @@ -214,7 +214,7 @@ ffi_closure_win64: movsd %xmm3, ffi_clo_OFF_X+24(%rsp) leaq ffi_clo_OFF_R(%rsp), %r9 - call ffi_closure_win64_inner + call C(ffi_closure_win64_inner) /* Load the result into both possible result registers. */ movq ffi_clo_OFF_R(%rsp), %rax From 52fbd12dca1bddf0b135a24e7136f10af79a06bd Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 26 May 2016 09:00:00 +0100 Subject: [PATCH 3/3] [Darwin-ppc, build] Fixes for clang build. clang is experimental on powerpc-darwin, but the changes are appropriate to cctools as as well. Use the 'official' simplified cmpwi insn, rather than the implied one accepted by cctools. Do not re-use a set value. --- src/powerpc/darwin_closure.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/powerpc/darwin_closure.S b/src/powerpc/darwin_closure.S index c7734d4..3121e6a 100644 --- a/src/powerpc/darwin_closure.S +++ b/src/powerpc/darwin_closure.S @@ -353,7 +353,7 @@ Lret_type13: bgt Lstructend ; not a special small case b Lsmallstruct ; see if we need more. #else - cmpi 0,r0,4 + cmpwi 0,r0,4 bgt Lfinish ; not by value lg r3,0(r5) b Lfinish @@ -494,8 +494,8 @@ LSFDE1: LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long Lstartcode-. ; FDE initial location - .set L$set$3,LFE1-Lstartcode - .g_long L$set$3 ; FDE address range + .set L$set$2,LFE1-Lstartcode + .g_long L$set$2 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$3,LCFI1-LCFI0