diff --git a/src/x86/asmnames.h b/src/x86/asmnames.h new file mode 100644 index 0000000..7551021 --- /dev/null +++ b/src/x86/asmnames.h @@ -0,0 +1,30 @@ +#ifndef ASMNAMES_H +#define ASMNAMES_H + +#define C2(X, Y) X ## Y +#define C1(X, Y) C2(X, Y) +#ifdef __USER_LABEL_PREFIX__ +# define C(X) C1(__USER_LABEL_PREFIX__, X) +#else +# define C(X) X +#endif + +#ifdef __APPLE__ +# define L(X) C1(L, X) +#else +# define L(X) C1(.L, X) +#endif + +#if defined(__ELF__) && defined(__PIC__) +# define PLT(X) X@PLT +#else +# define PLT(X) X +#endif + +#ifdef __ELF__ +# define ENDF(X) .type X,@function; .size X, . - X +#else +# define ENDF(X) +#endif + +#endif /* ASMNAMES_H */ diff --git a/src/x86/unix64.S b/src/x86/unix64.S index c83010c..129aba5 100644 --- a/src/x86/unix64.S +++ b/src/x86/unix64.S @@ -31,31 +31,10 @@ #include #include #include "internal64.h" +#include "asmnames.h" .text -#define C2(X, Y) X ## Y -#define C1(X, Y) C2(X, Y) -#ifdef __USER_LABEL_PREFIX__ -# define C(X) C1(__USER_LABEL_PREFIX__, X) -#else -# define C(X) X -#endif - -#ifdef __APPLE__ -# define L(X) C1(L, X) -#else -# define L(X) C1(.L, X) -#endif - -#ifdef __ELF__ -# define PLT(X) X@PLT -# define ENDF(X) .type X,@function; .size X, . - X -#else -# define PLT(X) X -# define ENDF(X) -#endif - /* This macro allows the safe creation of jump tables without an actual table. The entry points into the table are all 8 bytes. The use of ORG asserts that we're at the correct location. */ diff --git a/src/x86/win64.S b/src/x86/win64.S index eed57c2..9d4f8b9 100644 --- a/src/x86/win64.S +++ b/src/x86/win64.S @@ -2,6 +2,7 @@ #include #include #include +#include "asmnames.h" #if defined(HAVE_AS_CFI_PSEUDO_OP) .cfi_sections .debug_frame @@ -21,12 +22,6 @@ #define arg3 %rcx #endif -#ifdef SYMBOL_UNDERSCORE -#define SYMBOL_NAME(name) _##name -#else -#define SYMBOL_NAME(name) name -#endif - .macro E which .align 8 .org 0b + \which * 8 @@ -106,7 +101,7 @@ E FFI_TYPE_DOUBLE movsd %xmm0, (%r8) epilogue E FFI_TYPE_LONGDOUBLE - call abort + call PLT(C(abort)) E FFI_TYPE_UINT8 movzbl %al, %eax movq %rax, (%r8) @@ -141,7 +136,7 @@ E FFI_TYPE_POINTER movq %rax, (%r8) epilogue E FFI_TYPE_COMPLEX - call abort + call PLT(C(abort)) E FFI_TYPE_SMALL_STRUCT_1B movb %al, (%r8) epilogue @@ -153,7 +148,7 @@ E FFI_TYPE_SMALL_STRUCT_4B epilogue .align 8 -99: call abort +99: call PLT(C(abort)) .purgem epilogue