Index: PLATFORMS.md ================================================================== --- PLATFORMS.md +++ PLATFORMS.md @@ -43,20 +43,20 @@ DragonFlyBSD ------------ * OS Versions: 3.0, 3.3-DEVELOPMENT - * Architectures: x86, x86_64 + * Architectures: AMD64, x86 * Compilers: GCC 4.4.7 * Runtimes: ObjFW FreeBSD ------- * OS Versions: 9.1-rc3, 10.0 - * Architectures: x86_64 + * Architectures: AMD64 * Compilers: Clang 3.1, Clang 3.3 * Runtimes: ObjFW Haiku @@ -88,22 +88,21 @@ Linux ----- - * Architectures: Alpha, ARMv6, ARMv7, ARM64, Itanium, m68k, MIPS (O32), - MIPS64 (N64), RISC-V 64, PowerPC, S390x, SuperH-4, x86, - x86_64 + * Architectures: Alpha, AMD64, ARMv6, ARMv7, ARM64, Itanium, m68k, MIPS (O32), + MIPS64 (N64), RISC-V 64, PowerPC, S390x, SuperH-4, x86 * Compilers: Clang 3.0-10.0, GCC 4.6-10.0 * Runtimes: ObjFW macOS ----- * OS Versions: 10.5, 10.7-10.15, Darling - * Architectures: PowerPC, PowerPC64, x86, x86_64 + * Architectures: AMD64, PowerPC, PowerPC64, x86 * Compilers: Clang 3.1-10.0, Apple GCC 4.0.1 & 4.2.1 * Runtimes: Apple, ObjFW MiNT @@ -127,12 +126,12 @@ NetBSD ------ * OS Versions: 5.1-9.0 - * Architectures: ARM, ARM (big endian, BE8 mode), MIPS (O32), PowerPC, SPARC, - SPARC64, x86, x86_64 + * Architectures: AMD64, ARM, ARM (big endian, BE8 mode), MIPS (O32), PowerPC, + SPARC, SPARC64, x86 * Compilers: Clang 3.0-3.2, GCC 4.1.3 & 4.5.3 & 7.4.0 * Runtimes: ObjFW Nintendo 3DS @@ -167,11 +166,11 @@ OpenBSD ------- * OS Versions: 5.2-6.7 - * Architectures: MIPS64, PA-RISC, PowerPC, SPARC64, x86_64 + * Architectures: AMD64, MIPS64, PA-RISC, PowerPC, SPARC64 * Compilers: GCC 6.3.0, Clang 4.0 * Runtimes: ObjFW PlayStation Portable @@ -195,11 +194,11 @@ Solaris ------- * OS Versions: OpenIndiana 2015.03 - * Architectures: x86, x86_64 + * Architectures: AMD64, x86 * Compilers: Clang 3.4.2, GCC 4.8.3 * Runtimes: ObjFW Wii @@ -226,14 +225,14 @@ Windows ------- * OS Versions: 98 SE, NT 4.0, XP (x86), 7 (x64), 8 (x64), 8.1 (x64), 10, 11, Wine (x86 & x64) - * Architectures: x86, x86_64, AArch64 - * Compilers: GCC 5.3.0 & 6.2.0 from msys2 (x86 & x64), + * Architectures: AArch64, AMD64, x86 + * Compilers: GCC 5.3.0 & 6.2.0 from msys2 (AMD64 & x86), Clang 3.9.0 from msys2 (x86), - Clang 10.0 from msys2 (x86 & x86_64), + Clang 10.0 from msys2 (AMD64 & x86), Clang 14.0.4 from msys2 (AArch64) * Runtimes: ObjFW Others @@ -254,16 +253,16 @@ As forwarding needs hand-written assembly for each combination of CPU architecture, executable format and calling convention, it is only available for the following platforms (except resolveClassMethod: and resolveInstanceMethod:, which are always available): + * AMD64 (SysV/ELF, Apple/Mach-O, Mach-O, Win64/PE) * ARM (EABI/ELF, Apple/Mach-O) * ARM64 (ARM64/ELF, Apple/Mach-O) * MIPS (O32/ELF, EABI/ELF) * PowerPC (SysV/ELF, EABI/ELF, Apple/Mach-O) * SPARC (SysV/ELF) * SPARC64 (SysV/ELF) * x86 (SysV/ELF, Apple/Mach-O, Win32/PE) - * x86_64 (SysV/ELF, Apple/Mach-O, Mach-O, Win64/PE) Apple/Mach-O means both, the Apple ABI and runtime, while Mach-O means the ObjFW runtime on Mach-O. Index: src/OFAtomic.h ================================================================== --- src/OFAtomic.h +++ src/OFAtomic.h @@ -167,11 +167,11 @@ static OF_INLINE void OFReleaseMemoryBarrier(void) { /* nop */ } -#elif (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__) +#elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) # import "platform/x86/OFAtomic.h" #elif defined(OF_POWERPC) && defined(__GNUC__) && !defined(__APPLE_CC__) && \ !defined(OF_AIX) # import "platform/PowerPC/OFAtomic.h" #elif defined(OF_HAVE_ATOMIC_BUILTINS) Index: src/OFSystemInfo.h ================================================================== --- src/OFSystemInfo.h +++ src/OFSystemInfo.h @@ -67,11 +67,11 @@ @property (class, readonly, nullable, nonatomic) OFIRI *userDataIRI; @property (class, readonly, nullable, nonatomic) OFIRI *userConfigIRI; @property (class, readonly, nullable, nonatomic) OFIRI *temporaryDirectoryIRI; @property (class, readonly, nullable, nonatomic) OFString *CPUVendor; @property (class, readonly, nullable, nonatomic) OFString *CPUModel; -# if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) +# if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsMMX; @property (class, readonly, nonatomic) bool supports3DNow; @property (class, readonly, nonatomic) bool supportsEnhanced3DNow; @property (class, readonly, nonatomic) bool supportsSSE; @property (class, readonly, nonatomic) bool supportsSSE2; @@ -212,33 +212,33 @@ * * @return The model of the CPU */ + (nullable OFString *)CPUModel; -#if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) +#if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN) /** * @brief Returns whether the CPU supports MMX. * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports MMX */ + (bool)supportsMMX; /** * @brief Returns whether the CPU supports 3DNow!. * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports 3DNow! */ + (bool)supports3DNow; /** * @brief Returns whether the CPU supports enhanced 3DNow!. * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports enhanced 3DNow! */ + (bool)supportsEnhanced3DNow; @@ -245,11 +245,11 @@ /** * @brief Returns whether the CPU supports SSE. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSE */ + (bool)supportsSSE; @@ -256,11 +256,11 @@ /** * @brief Returns whether the CPU supports SSE2. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSE2 */ + (bool)supportsSSE2; @@ -267,11 +267,11 @@ /** * @brief Returns whether the CPU supports SSE3. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSE3 */ + (bool)supportsSSE3; @@ -278,11 +278,11 @@ /** * @brief Returns whether the CPU supports SSSE3. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSSE3 */ + (bool)supportsSSSE3; @@ -289,11 +289,11 @@ /** * @brief Returns whether the CPU supports SSE4.1. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSE4.1 */ + (bool)supportsSSE41; @@ -300,11 +300,11 @@ /** * @brief Returns whether the CPU supports SSE4.2. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports SSE4.2 */ + (bool)supportsSSE42; @@ -311,11 +311,11 @@ /** * @brief Returns whether the CPU supports AVX. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports AVX */ + (bool)supportsAVX; @@ -322,29 +322,29 @@ /** * @brief Returns whether the CPU supports AVX2. * * @warning This method only checks CPU support and assumes OS support! * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports AVX2 */ + (bool)supportsAVX2; /** * @brief Returns whether the CPU supports AES-NI. * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports AES-NI */ + (bool)supportsAESNI; /** * @brief Returns whether the CPU supports Intel SHA Extensions. * - * @note This method is only available on x86 and x86_64. + * @note This method is only available on AMD64 and x86. * * @return Whether the CPU supports Intel SHA Extensions */ + (bool)supportsSHAExtensions; #endif Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -116,11 +116,11 @@ NSSearchPathDirectory, NSSearchPathDomainMask); extern NSSearchPathEnumerationState NSGetNextSearchPathEnumeration( NSSearchPathEnumerationState, char *); #endif -#if defined(OF_X86_64) || defined(OF_X86) +#if defined(OF_AMD64) || defined(OF_X86) struct X86Regs { uint32_t eax, ebx, ecx, edx; }; #endif @@ -288,17 +288,17 @@ tmpFSIRI = [[OFIRI alloc] initFileIRIWithPath: @"tmpfs:/" isDirectory: true]; } #endif -#if defined(OF_X86_64) || defined(OF_X86) +#if defined(OF_AMD64) || defined(OF_X86) static OF_INLINE struct X86Regs OF_CONST_FUNC x86CPUID(uint32_t eax, uint32_t ecx) { struct X86Regs regs; -# if defined(OF_X86_64) && defined(__GNUC__) +# if defined(OF_AMD64) && defined(__GNUC__) __asm__ ( "cpuid" : "=a"(regs.eax), "=b"(regs.ebx), "=c"(regs.ecx), "=d"(regs.edx) : "a"(eax), "c"(ecx) ); @@ -653,11 +653,11 @@ #endif } + (OFString *)CPUVendor { -#if (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__) +#if (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) struct X86Regs regs = x86CPUID(0, 0); uint32_t buffer[3]; if (regs.eax == 0) return nil; @@ -676,11 +676,11 @@ #endif } + (OFString *)CPUModel { -#if (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__) +#if (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) struct X86Regs regs = x86CPUID(0x80000000, 0); uint32_t buffer[12]; size_t i; if (regs.eax < 0x80000004) @@ -735,11 +735,11 @@ #else return nil; #endif } -#if defined(OF_X86_64) || defined(OF_X86) +#if defined(OF_AMD64) || defined(OF_X86) + (bool)supportsMMX { return (x86CPUID(1, 0).edx & (1u << 23)); } ADDED src/forwarding/apple-forwarding-amd64.S Index: src/forwarding/apple-forwarding-amd64.S ================================================================== --- src/forwarding/apple-forwarding-amd64.S +++ src/forwarding/apple-forwarding-amd64.S @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +.globl _OFForward +.globl _OFForward_stret + +.section __TEXT, __objc_methname, cstring_literals +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip +sel_forwardingTargetForSelector_: + .quad str_forwardingTargetForSelector_ + +.section __DATA, __objc_imageinfo, regular, no_dead_strip + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +_OFForward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + call _object_getClass + + movq %rax, %rdi + movq sel_forwardingTargetForSelector_(%rip), %rsi + call _class_respondsToSelector + + testq %rax, %rax + jz 0f + + movq -0x10(%rbp), %rdi + movq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x18(%rbp), %rdx + call _objc_msgSend + + testq %rax, %rax + jz 0f + cmpq -0x10(%rbp), %rax + je 0f + + movq %rax, %rdi + + /* Restore all arguments, except %rdi */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmp _objc_msgSend + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + + movq %rbp, %rsp + popq %rbp + + jmp _OFMethodNotFound + +_OFForward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + movq %rsi, %rdi + call _object_getClass + + movq %rax, %rdi + movq sel_forwardingTargetForSelector_(%rip), %rsi + call _class_respondsToSelector + testq %rax, %rax + jz 0f + + movq -0x18(%rbp), %rdi + movq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x20(%rbp), %rdx + call _objc_msgSend + + testq %rax, %rax + jz 0f + cmpq -0x18(%rbp), %rax + je 0f + + movq %rax, %rsi + + /* Restore all arguments, except %rsi */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmp _objc_msgSend_stret + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + movq -0x20(%rbp), %rdx + + movq %rbp, %rsp + popq %rbp + + jmp _OFMethodNotFound_stret DELETED src/forwarding/apple-forwarding-i386.S Index: src/forwarding/apple-forwarding-i386.S ================================================================== --- src/forwarding/apple-forwarding-i386.S +++ src/forwarding/apple-forwarding-i386.S @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -.globl _OFForward -.globl _OFForward_stret - -.section __TEXT, __cstring, cstring_literals -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section __OBJC, __message_refs, literal_pointers, no_dead_strip -sel_forwardingTargetForSelector_: - .long str_forwardingTargetForSelector_ - -.section __OBJC, __image_info - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -_OFForward: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -0: - - movl 8(%ebp), %eax - movl %eax, (%esp) - call _object_getClass - - movl %eax, (%esp) - movl sel_forwardingTargetForSelector_-0b(%ebx), %eax - movl %eax, 4(%esp) - call _class_respondsToSelector - - testl %eax, %eax - jz 0f - - movl 8(%ebp), %eax - movl %eax, (%esp) - movl sel_forwardingTargetForSelector_-0b(%ebx), %eax - movl %eax, 4(%esp) - movl 12(%ebp), %eax - movl %eax, 8(%esp) - call _objc_msgSend - - testl %eax, %eax - jz 0f - cmpl 8(%ebp), %eax - je 0f - - movl %eax, 8(%ebp) - - addl $20, %esp - popl %ebx - popl %ebp - - jmp _objc_msgSend - -0: - addl $20, %esp - popl %ebx - popl %ebp - - jmp _OFMethodNotFound - -_OFForward_stret: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -0: - - movl 12(%ebp), %eax - movl %eax, (%esp) - call _object_getClass - - movl %eax, (%esp) - movl sel_forwardingTargetForSelector_-0b(%ebx), %eax - movl %eax, 4(%esp) - call _class_respondsToSelector - - testl %eax, %eax - jz 0f - - movl 12(%ebp), %eax - movl %eax, (%esp) - movl sel_forwardingTargetForSelector_-0b(%ebx), %eax - movl %eax, 4(%esp) - movl 16(%ebp), %eax - movl %eax, 8(%esp) - call _objc_msgSend - - testl %eax, %eax - jz 0f - cmpl 12(%ebp), %eax - je 0f - - movl %eax, 12(%ebp) - - addl $20, %esp - popl %ebx - popl %ebp - - jmp _objc_msgSend_stret - -0: - addl $20, %esp - popl %ebx - popl %ebp - - jmp _OFMethodNotFound_stret - -get_eip: - movl (%esp), %ebx - ret ADDED src/forwarding/apple-forwarding-x86.S Index: src/forwarding/apple-forwarding-x86.S ================================================================== --- src/forwarding/apple-forwarding-x86.S +++ src/forwarding/apple-forwarding-x86.S @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +.globl _OFForward +.globl _OFForward_stret + +.section __TEXT, __cstring, cstring_literals +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section __OBJC, __message_refs, literal_pointers, no_dead_strip +sel_forwardingTargetForSelector_: + .long str_forwardingTargetForSelector_ + +.section __OBJC, __image_info + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +_OFForward: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +0: + + movl 8(%ebp), %eax + movl %eax, (%esp) + call _object_getClass + + movl %eax, (%esp) + movl sel_forwardingTargetForSelector_-0b(%ebx), %eax + movl %eax, 4(%esp) + call _class_respondsToSelector + + testl %eax, %eax + jz 0f + + movl 8(%ebp), %eax + movl %eax, (%esp) + movl sel_forwardingTargetForSelector_-0b(%ebx), %eax + movl %eax, 4(%esp) + movl 12(%ebp), %eax + movl %eax, 8(%esp) + call _objc_msgSend + + testl %eax, %eax + jz 0f + cmpl 8(%ebp), %eax + je 0f + + movl %eax, 8(%ebp) + + addl $20, %esp + popl %ebx + popl %ebp + + jmp _objc_msgSend + +0: + addl $20, %esp + popl %ebx + popl %ebp + + jmp _OFMethodNotFound + +_OFForward_stret: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +0: + + movl 12(%ebp), %eax + movl %eax, (%esp) + call _object_getClass + + movl %eax, (%esp) + movl sel_forwardingTargetForSelector_-0b(%ebx), %eax + movl %eax, 4(%esp) + call _class_respondsToSelector + + testl %eax, %eax + jz 0f + + movl 12(%ebp), %eax + movl %eax, (%esp) + movl sel_forwardingTargetForSelector_-0b(%ebx), %eax + movl %eax, 4(%esp) + movl 16(%ebp), %eax + movl %eax, 8(%esp) + call _objc_msgSend + + testl %eax, %eax + jz 0f + cmpl 12(%ebp), %eax + je 0f + + movl %eax, 12(%ebp) + + addl $20, %esp + popl %ebx + popl %ebp + + jmp _objc_msgSend_stret + +0: + addl $20, %esp + popl %ebx + popl %ebp + + jmp _OFMethodNotFound_stret + +get_eip: + movl (%esp), %ebx + ret DELETED src/forwarding/apple-forwarding-x86_64.S Index: src/forwarding/apple-forwarding-x86_64.S ================================================================== --- src/forwarding/apple-forwarding-x86_64.S +++ src/forwarding/apple-forwarding-x86_64.S @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -.globl _OFForward -.globl _OFForward_stret - -.section __TEXT, __objc_methname, cstring_literals -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip -sel_forwardingTargetForSelector_: - .quad str_forwardingTargetForSelector_ - -.section __DATA, __objc_imageinfo, regular, no_dead_strip - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -_OFForward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - call _object_getClass - - movq %rax, %rdi - movq sel_forwardingTargetForSelector_(%rip), %rsi - call _class_respondsToSelector - - testq %rax, %rax - jz 0f - - movq -0x10(%rbp), %rdi - movq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x18(%rbp), %rdx - call _objc_msgSend - - testq %rax, %rax - jz 0f - cmpq -0x10(%rbp), %rax - je 0f - - movq %rax, %rdi - - /* Restore all arguments, except %rdi */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmp _objc_msgSend - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - - movq %rbp, %rsp - popq %rbp - - jmp _OFMethodNotFound - -_OFForward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - movq %rsi, %rdi - call _object_getClass - - movq %rax, %rdi - movq sel_forwardingTargetForSelector_(%rip), %rsi - call _class_respondsToSelector - testq %rax, %rax - jz 0f - - movq -0x18(%rbp), %rdi - movq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x20(%rbp), %rdx - call _objc_msgSend - - testq %rax, %rax - jz 0f - cmpq -0x18(%rbp), %rax - je 0f - - movq %rax, %rsi - - /* Restore all arguments, except %rsi */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmp _objc_msgSend_stret - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - movq -0x20(%rbp), %rdx - - movq %rbp, %rsp - popq %rbp - - jmp _OFMethodNotFound_stret ADDED src/forwarding/forwarding-amd64-elf.S Index: src/forwarding/forwarding-amd64-elf.S ================================================================== --- src/forwarding/forwarding-amd64-elf.S +++ src/forwarding/forwarding-amd64-elf.S @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include "platform.h" + +.globl OFForward +.globl OFForward_stret + +.section .text +OFForward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + call object_getClass@PLT + + movq %rax, %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call class_respondsToSelector@PLT + + testq %rax, %rax + jz 0f + + movq -0x10(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call objc_msg_lookup@PLT + + movq -0x10(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x18(%rbp), %rdx + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x10(%rbp), %rax + je 0f + + movq %rax, -0x10(%rbp) + + movq %rax, %rdi + movq -0x18(%rbp), %rsi + call objc_msg_lookup@PLT + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + + movq %rbp, %rsp + popq %rbp + + jmp OFMethodNotFound@PLT +.type OFForward, %function +.size OFForward, .-OFForward + +OFForward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + movq %rsi, %rdi + call object_getClass@PLT + + movq %rax, %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call class_respondsToSelector@PLT + + testq %rax, %rax + jz 0f + + movq -0x18(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call objc_msg_lookup@PLT + + movq -0x18(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x20(%rbp), %rdx + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x18(%rbp), %rax + je 0f + + movq %rax, -0x18(%rbp) + + movq %rax, %rdi + movq -0x20(%rbp), %rsi + call objc_msg_lookup_stret@PLT + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + movq -0x20(%rbp), %rdx + + movq %rbp, %rsp + popq %rbp + + jmp OFMethodNotFound_stret@PLT +.type OFForward_stret, %function +.size OFForward_stret, .-OFForward_stret + +init: + leaq module(%rip), %rdi + jmp __objc_exec_class@PLT + +#ifdef OF_SOLARIS +.section .init_array, "aw" +#else +.section .ctors, "aw", %progbits +#endif + .quad init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .quad str_forwardingTargetForSelector_, 0 + .quad 0, 0 +symtab: + .quad 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .quad 0 +module: + .quad 8, 32, 0, symtab + +#ifdef OF_LINUX +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding-amd64-macho.S Index: src/forwarding/forwarding-amd64-macho.S ================================================================== --- src/forwarding/forwarding-amd64-macho.S +++ src/forwarding/forwarding-amd64-macho.S @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include "platform.h" + +.globl _OFForward +.globl _OFForward_stret + +.section __TEXT, __text, regular, pure_instructions +_OFForward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + call _object_getClass + + movq %rax, %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call _class_respondsToSelector + + testq %rax, %rax + jz 0f + + movq -0x10(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call _objc_msg_lookup + + movq -0x10(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x18(%rbp), %rdx + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x10(%rbp), %rax + je 0f + + movq %rax, -0x10(%rbp) + + movq %rax, %rdi + movq -0x18(%rbp), %rsi + call _objc_msg_lookup + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + + movq %rbp, %rsp + popq %rbp + + jmp _OFMethodNotFound + +_OFForward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movaps %xmm0, -0x50(%rbp) + movaps %xmm1, -0x60(%rbp) + movaps %xmm2, -0x70(%rbp) + movaps %xmm3, -0x80(%rbp) + movaps %xmm4, -0x90(%rbp) + movaps %xmm5, -0xA0(%rbp) + movaps %xmm6, -0xB0(%rbp) + movaps %xmm7, -0xC0(%rbp) + + movq %rsi, %rdi + call _object_getClass + + movq %rax, %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call _class_respondsToSelector + + testq %rax, %rax + jz 0f + + movq -0x18(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call _objc_msg_lookup + + movq -0x18(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x20(%rbp), %rdx + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x18(%rbp), %rax + je 0f + + movq %rax, -0x18(%rbp) + + movq %rax, %rdi + movq -0x20(%rbp), %rsi + call _objc_msg_lookup_stret + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0xC0(%rbp), %xmm7 + movaps -0xB0(%rbp), %xmm6 + movaps -0xA0(%rbp), %xmm5 + movaps -0x90(%rbp), %xmm4 + movaps -0x80(%rbp), %xmm3 + movaps -0x70(%rbp), %xmm2 + movaps -0x60(%rbp), %xmm1 + movaps -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + movq -0x20(%rbp), %rdx + + movq %rbp, %rsp + popq %rbp + + jmp _OFMethodNotFound_stret + +init: + leaq module(%rip), %rdi + jmp ___objc_exec_class + +.section __DATA, __mod_init_func, mod_init_funcs + .quad init + +.section __TEXT, __cstring, cstring_literals +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section __DATA, __data +sel_forwardingTargetForSelector_: + .quad str_forwardingTargetForSelector_, 0 + .quad 0, 0 +symtab: + .quad 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .quad 0 +module: + .quad 8, 32, 0, symtab ADDED src/forwarding/forwarding-amd64-win64.S Index: src/forwarding/forwarding-amd64-win64.S ================================================================== --- src/forwarding/forwarding-amd64-win64.S +++ src/forwarding/forwarding-amd64-win64.S @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +.globl OFForward +.globl OFForward_stret + +.section .text +OFForward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0x90, %rsp /* 16-byte alignment */ + movq %rax, -0x28(%rbp) + movq %rcx, -0x30(%rbp) + movq %rdx, -0x38(%rbp) + movq %r8, -0x40(%rbp) + movq %r9, -0x48(%rbp) + movaps %xmm0, -0x60(%rbp) + movaps %xmm1, -0x70(%rbp) + movaps %xmm2, -0x80(%rbp) + movaps %xmm3, -0x90(%rbp) + + call object_getClass + + movq %rax, %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + call class_respondsToSelector + + testq %rax, %rax + jz 0f + + movq -0x30(%rbp), %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + call objc_msg_lookup + + movq -0x30(%rbp), %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + movq -0x38(%rbp), %r8 + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x30(%rbp), %rax + je 0f + + movq %rax, -0x30(%rbp) + + movq %rax, %rcx + movq -0x38(%rbp), %rdx + call objc_msg_lookup + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0x90(%rbp), %xmm3 + movaps -0x80(%rbp), %xmm2 + movaps -0x70(%rbp), %xmm1 + movaps -0x60(%rbp), %xmm0 + movq -0x48(%rbp), %r9 + movq -0x40(%rbp), %r8 + movq -0x38(%rbp), %rdx + movq -0x30(%rbp), %rcx + movq -0x28(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x30(%rbp), %rcx + movq -0x38(%rbp), %rdx + + movq %rbp, %rsp + popq %rbp + + jmp OFMethodNotFound +.def OFForward +.scl 2 +.type 32 +.endef + +OFForward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0x90, %rsp /* 16-byte alignment */ + movq %rax, -0x28(%rbp) + movq %rcx, -0x30(%rbp) + movq %rdx, -0x38(%rbp) + movq %r8, -0x40(%rbp) + movq %r9, -0x48(%rbp) + movaps %xmm0, -0x60(%rbp) + movaps %xmm1, -0x70(%rbp) + movaps %xmm2, -0x80(%rbp) + movaps %xmm3, -0x90(%rbp) + + movq %rdx, %rcx + call object_getClass + + movq %rax, %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + call class_respondsToSelector + + testq %rax, %rax + jz 0f + + movq -0x38(%rbp), %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + call objc_msg_lookup + + movq -0x38(%rbp), %rcx + leaq sel_forwardingTargetForSelector_(%rip), %rdx + movq -0x40(%rbp), %r8 + call *%rax + + testq %rax, %rax + jz 0f + cmpq -0x38(%rbp), %rax + je 0f + + movq %rax, -0x38(%rbp) + + movq %rax, %rcx + movq -0x40(%rbp), %rdx + call objc_msg_lookup_stret + movq %rax, %r11 + + /* Restore all arguments */ + movaps -0x90(%rbp), %xmm3 + movaps -0x80(%rbp), %xmm2 + movaps -0x70(%rbp), %xmm1 + movaps -0x60(%rbp), %xmm0 + movq -0x48(%rbp), %r9 + movq -0x40(%rbp), %r8 + movq -0x38(%rbp), %rdx + movq -0x30(%rbp), %rcx + movq -0x28(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 + +0: + movq -0x30(%rbp), %rcx + movq -0x38(%rbp), %rdx + movq -0x40(%rbp), %r8 + + movq %rbp, %rsp + popq %rbp + + jmp OFMethodNotFound_stret +.def OFForward_stret +.scl 2 +.type 32 +.endef + +init: + leaq module(%rip), %rcx + jmp __objc_exec_class + +.section .ctors, "aw" + .quad init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .quad str_forwardingTargetForSelector_, 0 + .quad 0, 0 +symtab: + .long 0, 0 + .quad sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .quad 0 +module: + .long 8, 32 + .quad 0, symtab DELETED src/forwarding/forwarding-x86_64-elf.S Index: src/forwarding/forwarding-x86_64-elf.S ================================================================== --- src/forwarding/forwarding-x86_64-elf.S +++ src/forwarding/forwarding-x86_64-elf.S @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include "platform.h" - -.globl OFForward -.globl OFForward_stret - -.section .text -OFForward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - call object_getClass@PLT - - movq %rax, %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call class_respondsToSelector@PLT - - testq %rax, %rax - jz 0f - - movq -0x10(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call objc_msg_lookup@PLT - - movq -0x10(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x18(%rbp), %rdx - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x10(%rbp), %rax - je 0f - - movq %rax, -0x10(%rbp) - - movq %rax, %rdi - movq -0x18(%rbp), %rsi - call objc_msg_lookup@PLT - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - - movq %rbp, %rsp - popq %rbp - - jmp OFMethodNotFound@PLT -.type OFForward, %function -.size OFForward, .-OFForward - -OFForward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - movq %rsi, %rdi - call object_getClass@PLT - - movq %rax, %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call class_respondsToSelector@PLT - - testq %rax, %rax - jz 0f - - movq -0x18(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call objc_msg_lookup@PLT - - movq -0x18(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x20(%rbp), %rdx - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x18(%rbp), %rax - je 0f - - movq %rax, -0x18(%rbp) - - movq %rax, %rdi - movq -0x20(%rbp), %rsi - call objc_msg_lookup_stret@PLT - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - movq -0x20(%rbp), %rdx - - movq %rbp, %rsp - popq %rbp - - jmp OFMethodNotFound_stret@PLT -.type OFForward_stret, %function -.size OFForward_stret, .-OFForward_stret - -init: - leaq module(%rip), %rdi - jmp __objc_exec_class@PLT - -#ifdef OF_SOLARIS -.section .init_array, "aw" -#else -.section .ctors, "aw", %progbits -#endif - .quad init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .quad str_forwardingTargetForSelector_, 0 - .quad 0, 0 -symtab: - .quad 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .quad 0 -module: - .quad 8, 32, 0, symtab - -#ifdef OF_LINUX -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding/forwarding-x86_64-macho.S Index: src/forwarding/forwarding-x86_64-macho.S ================================================================== --- src/forwarding/forwarding-x86_64-macho.S +++ src/forwarding/forwarding-x86_64-macho.S @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include "platform.h" - -.globl _OFForward -.globl _OFForward_stret - -.section __TEXT, __text, regular, pure_instructions -_OFForward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - call _object_getClass - - movq %rax, %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call _class_respondsToSelector - - testq %rax, %rax - jz 0f - - movq -0x10(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call _objc_msg_lookup - - movq -0x10(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x18(%rbp), %rdx - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x10(%rbp), %rax - je 0f - - movq %rax, -0x10(%rbp) - - movq %rax, %rdi - movq -0x18(%rbp), %rsi - call _objc_msg_lookup - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - - movq %rbp, %rsp - popq %rbp - - jmp _OFMethodNotFound - -_OFForward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movaps %xmm0, -0x50(%rbp) - movaps %xmm1, -0x60(%rbp) - movaps %xmm2, -0x70(%rbp) - movaps %xmm3, -0x80(%rbp) - movaps %xmm4, -0x90(%rbp) - movaps %xmm5, -0xA0(%rbp) - movaps %xmm6, -0xB0(%rbp) - movaps %xmm7, -0xC0(%rbp) - - movq %rsi, %rdi - call _object_getClass - - movq %rax, %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call _class_respondsToSelector - - testq %rax, %rax - jz 0f - - movq -0x18(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call _objc_msg_lookup - - movq -0x18(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x20(%rbp), %rdx - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x18(%rbp), %rax - je 0f - - movq %rax, -0x18(%rbp) - - movq %rax, %rdi - movq -0x20(%rbp), %rsi - call _objc_msg_lookup_stret - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0xC0(%rbp), %xmm7 - movaps -0xB0(%rbp), %xmm6 - movaps -0xA0(%rbp), %xmm5 - movaps -0x90(%rbp), %xmm4 - movaps -0x80(%rbp), %xmm3 - movaps -0x70(%rbp), %xmm2 - movaps -0x60(%rbp), %xmm1 - movaps -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - movq -0x20(%rbp), %rdx - - movq %rbp, %rsp - popq %rbp - - jmp _OFMethodNotFound_stret - -init: - leaq module(%rip), %rdi - jmp ___objc_exec_class - -.section __DATA, __mod_init_func, mod_init_funcs - .quad init - -.section __TEXT, __cstring, cstring_literals -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section __DATA, __data -sel_forwardingTargetForSelector_: - .quad str_forwardingTargetForSelector_, 0 - .quad 0, 0 -symtab: - .quad 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .quad 0 -module: - .quad 8, 32, 0, symtab DELETED src/forwarding/forwarding-x86_64-win64.S Index: src/forwarding/forwarding-x86_64-win64.S ================================================================== --- src/forwarding/forwarding-x86_64-win64.S +++ src/forwarding/forwarding-x86_64-win64.S @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -.globl OFForward -.globl OFForward_stret - -.section .text -OFForward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0x90, %rsp /* 16-byte alignment */ - movq %rax, -0x28(%rbp) - movq %rcx, -0x30(%rbp) - movq %rdx, -0x38(%rbp) - movq %r8, -0x40(%rbp) - movq %r9, -0x48(%rbp) - movaps %xmm0, -0x60(%rbp) - movaps %xmm1, -0x70(%rbp) - movaps %xmm2, -0x80(%rbp) - movaps %xmm3, -0x90(%rbp) - - call object_getClass - - movq %rax, %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - call class_respondsToSelector - - testq %rax, %rax - jz 0f - - movq -0x30(%rbp), %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - call objc_msg_lookup - - movq -0x30(%rbp), %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - movq -0x38(%rbp), %r8 - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x30(%rbp), %rax - je 0f - - movq %rax, -0x30(%rbp) - - movq %rax, %rcx - movq -0x38(%rbp), %rdx - call objc_msg_lookup - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0x90(%rbp), %xmm3 - movaps -0x80(%rbp), %xmm2 - movaps -0x70(%rbp), %xmm1 - movaps -0x60(%rbp), %xmm0 - movq -0x48(%rbp), %r9 - movq -0x40(%rbp), %r8 - movq -0x38(%rbp), %rdx - movq -0x30(%rbp), %rcx - movq -0x28(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x30(%rbp), %rcx - movq -0x38(%rbp), %rdx - - movq %rbp, %rsp - popq %rbp - - jmp OFMethodNotFound -.def OFForward -.scl 2 -.type 32 -.endef - -OFForward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0x90, %rsp /* 16-byte alignment */ - movq %rax, -0x28(%rbp) - movq %rcx, -0x30(%rbp) - movq %rdx, -0x38(%rbp) - movq %r8, -0x40(%rbp) - movq %r9, -0x48(%rbp) - movaps %xmm0, -0x60(%rbp) - movaps %xmm1, -0x70(%rbp) - movaps %xmm2, -0x80(%rbp) - movaps %xmm3, -0x90(%rbp) - - movq %rdx, %rcx - call object_getClass - - movq %rax, %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - call class_respondsToSelector - - testq %rax, %rax - jz 0f - - movq -0x38(%rbp), %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - call objc_msg_lookup - - movq -0x38(%rbp), %rcx - leaq sel_forwardingTargetForSelector_(%rip), %rdx - movq -0x40(%rbp), %r8 - call *%rax - - testq %rax, %rax - jz 0f - cmpq -0x38(%rbp), %rax - je 0f - - movq %rax, -0x38(%rbp) - - movq %rax, %rcx - movq -0x40(%rbp), %rdx - call objc_msg_lookup_stret - movq %rax, %r11 - - /* Restore all arguments */ - movaps -0x90(%rbp), %xmm3 - movaps -0x80(%rbp), %xmm2 - movaps -0x70(%rbp), %xmm1 - movaps -0x60(%rbp), %xmm0 - movq -0x48(%rbp), %r9 - movq -0x40(%rbp), %r8 - movq -0x38(%rbp), %rdx - movq -0x30(%rbp), %rcx - movq -0x28(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 - -0: - movq -0x30(%rbp), %rcx - movq -0x38(%rbp), %rdx - movq -0x40(%rbp), %r8 - - movq %rbp, %rsp - popq %rbp - - jmp OFMethodNotFound_stret -.def OFForward_stret -.scl 2 -.type 32 -.endef - -init: - leaq module(%rip), %rcx - jmp __objc_exec_class - -.section .ctors, "aw" - .quad init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .quad str_forwardingTargetForSelector_, 0 - .quad 0, 0 -symtab: - .long 0, 0 - .quad sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .quad 0 -module: - .long 8, 32 - .quad 0, symtab Index: src/forwarding/forwarding.S ================================================================== --- src/forwarding/forwarding.S +++ src/forwarding/forwarding.S @@ -16,25 +16,25 @@ #include "config.h" #include "platform.h" #ifdef OF_APPLE_RUNTIME -# if defined(OF_X86_64) -# include "apple-forwarding-x86_64.S" +# if defined(OF_AMD64) +# include "apple-forwarding-amd64.S" # elif defined(OF_X86) -# include "apple-forwarding-i386.S" +# include "apple-forwarding-x86.S" # elif defined(OF_ARM64) # include "apple-forwarding-arm64.S" # elif defined(OF_ARM) # include "apple-forwarding-arm.S" # elif defined(OF_POWERPC) # include "apple-forwarding-powerpc.S" # endif #else # if defined(OF_ELF) -# if defined(OF_X86_64) -# include "forwarding-x86_64-elf.S" +# if defined(OF_AMD64) +# include "forwarding-amd64-elf.S" # elif defined(OF_X86) # include "forwarding-x86-elf.S" # elif defined(OF_ARM64) # include "forwarding-arm64-elf.S" # elif defined(OF_ARM) @@ -47,16 +47,16 @@ # include "forwarding-sparc64-elf.S" # elif defined(OF_SPARC) # include "forwarding-sparc-elf.S" # endif # elif defined(OF_MACH_O) -# if defined(OF_X86_64) -# include "forwarding-x86_64-macho.S" +# if defined(OF_AMD64) +# include "forwarding-amd64-macho.S" # endif # elif defined(OF_WINDOWS) -# if defined(OF_X86_64) -# include "forwarding-x86_64-win64.S" +# if defined(OF_AMD64) +# include "forwarding-amd64-win64.S" # elif defined(OF_X86) # include "forwarding-x86-win32.S" # endif # endif #endif Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -314,34 +314,34 @@ #else # define OF_DIRECT_MEMBERS #endif #ifdef OF_APPLE_RUNTIME -# if defined(OF_X86_64) || defined(OF_X86) || defined(OF_ARM64) || \ +# if defined(OF_AMD64) || defined(OF_X86) || defined(OF_ARM64) || \ defined(OF_ARM) || defined(OF_POWERPC) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif #else # if defined(OF_ELF) -# if defined(OF_X86_64) || defined(OF_X86) || \ +# if defined(OF_AMD64) || defined(OF_X86) || \ defined(OF_ARM64) || defined(OF_ARM) || defined(OF_POWERPC) || \ defined(OF_MIPS) || defined(OF_SPARC64) || defined(OF_SPARC) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # if __OBJFW_RUNTIME_ABI__ >= 800 # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif # endif # elif defined(OF_MACH_O) -# if defined(OF_X86_64) +# if defined(OF_AMD64) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # if __OBJFW_RUNTIME_ABI__ >= 800 # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif # endif # elif defined(OF_WINDOWS) -# if defined(OF_X86_64) || defined(OF_X86) +# if defined(OF_AMD64) || defined(OF_X86) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # if __OBJFW_RUNTIME_ABI__ >= 800 # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif # endif @@ -448,11 +448,11 @@ static OF_INLINE uint16_t OF_CONST_FUNC OFByteSwap16NonConst(uint16_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP16) return __builtin_bswap16(i); -#elif (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__) +#elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) __asm__ ( "xchgb %h0, %b0" : "=Q"(i) : "0"(i) ); @@ -478,11 +478,11 @@ static OF_INLINE uint32_t OF_CONST_FUNC OFByteSwap32NonConst(uint32_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP32) return __builtin_bswap32(i); -#elif (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__) +#elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) __asm__ ( "bswap %0" : "=q"(i) : "0"(i) ); @@ -510,11 +510,11 @@ static OF_INLINE uint64_t OF_CONST_FUNC OFByteSwap64NonConst(uint64_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP64) return __builtin_bswap64(i); -#elif defined(OF_X86_64) && defined(__GNUC__) +#elif defined(OF_AMD64) && defined(__GNUC__) __asm__ ( "bswap %0" : "=r"(i) : "0"(i) ); Index: src/platform.h ================================================================== --- src/platform.h +++ src/platform.h @@ -24,11 +24,11 @@ # error OF_UNIVERSAL defined, but neither __BIG_ENDIAN__ nor __LITTLE_ENDIAN__! # endif #endif #if defined(__x86_64__) || defined(__amd64__) -# define OF_X86_64 +# define OF_AMD64 #elif defined(__i386__) # define OF_X86 #elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) # define OF_POWERPC64 #elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) Index: src/platform/x86/OFAtomic.h ================================================================== --- src/platform/x86/OFAtomic.h +++ src/platform/x86/OFAtomic.h @@ -24,11 +24,11 @@ "xaddl %0, %2\n\t" "addl %1, %0" : "+&r"(i) : "r"(i), "m"(*p) ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "lock\n\t" "xaddq %0, %2\n\t" "addq %1, %0" @@ -57,11 +57,11 @@ } static OF_INLINE void *_Nullable OFAtomicPointerAdd(void *volatile _Nullable *_Nonnull p, intptr_t i) { -#if defined(OF_X86_64) +#if defined(OF_AMD64) __asm__ __volatile__ ( "lock\n\t" "xaddq %0, %2\n\t" "addq %1, %0" : "+&r"(i) @@ -92,11 +92,11 @@ "xaddl %0, %2\n\t" "subl %1, %0" : "+&r"(i) : "r"(i), "m"(*p) ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "negq %0\n\t" "lock\n\t" "xaddq %0, %2\n\t" @@ -127,11 +127,11 @@ } static OF_INLINE void *_Nullable OFAtomicPointerSubtract(void *volatile _Nullable *_Nonnull p, intptr_t i) { -#if defined(OF_X86_64) +#if defined(OF_AMD64) __asm__ __volatile__ ( "negq %0\n\t" "lock\n\t" "xaddq %0, %2\n\t" "subq %1, %0" @@ -167,11 +167,11 @@ "xaddl %0, %1\n\t" "incl %0" : "=&r"(i) : "m"(*p) ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "xorq %0, %0\n\t" "incq %0\n\t" "lock\n\t" @@ -218,11 +218,11 @@ "xaddl %0, %1\n\t" "decl %0" : "=&r"(i) : "m"(*p) ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "xorq %0, %0\n\t" "decq %0\n\t" "lock\n\t" @@ -270,11 +270,11 @@ "jne 0b" : "=&r"(i) : "r"(i), "m"(*p) : "eax", "cc" ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "0:\n\t" "movq %2, %0\n\t" "movq %0, %%rax\n\t" @@ -326,11 +326,11 @@ "jne 0b" : "=&r"(i) : "r"(i), "m"(*p) : "eax", "cc" ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "0:\n\t" "movq %2, %0\n\t" "movq %0, %%rax\n\t" @@ -382,11 +382,11 @@ "jne 0b" : "=&r"(i) : "r"(i), "m"(*p) : "eax", "cc" ); -#ifdef OF_X86_64 +#ifdef OF_AMD64 else if (sizeof(int) == 8) __asm__ __volatile__ ( "0:\n\t" "movq %2, %0\n\t" "movq %0, %%rax\n\t" @@ -480,11 +480,11 @@ } static OF_INLINE void OFMemoryBarrier(void) { -#ifdef OF_X86_64 +#ifdef OF_AMD64 __asm__ __volatile__ ( "lock orq $0, (%%rsp)" ::: "memory", "cc" ); #else __asm__ __volatile__ ( ADDED src/runtime/lookup-asm/lookup-asm-amd64-elf.S Index: src/runtime/lookup-asm/lookup-asm-amd64-elf.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-amd64-elf.S +++ src/runtime/lookup-asm/lookup-asm-amd64-elf.S @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include "platform.h" + +.globl objc_msg_lookup +.globl objc_msg_lookup_stret +.globl objc_msg_lookup_super +.globl objc_msg_lookup_super_stret + +.section .text +.macro GENERATE_LOOKUP name notFound +\name: + testq %rdi, %rdi + jz returnNilMethod + + testb $1, %dil + jnz .LtaggedPointer_\name + + movq (%rdi), %r8 + movq 64(%r8), %r8 + +.Lmain_\name: + movq (%rsi), %rax + movzbl %ah, %ecx + movzbl %al, %edx +#ifdef OF_SELUID24 + shrl $16, %eax + + movq (%r8,%rax,8), %r8 +#endif + movq (%r8,%rcx,8), %r8 + movq (%r8,%rdx,8), %rax + + testq %rax, %rax + jz \notFound@PLT + + ret + +.LtaggedPointer_\name: + movq objc_taggedPointerSecret@GOTPCREL(%rip), %rax + xorq (%rax), %rdi + andb $0xE, %dil + movzbl %dil, %r8d + + movq objc_taggedPointerClasses@GOTPCREL(%rip), %rax + movq (%rax,%r8,4), %r8 + movq 64(%r8), %r8 + + jmp .Lmain_\name +.type \name, %function +.size \name, .-\name +.endm + +.macro GENERATE_LOOKUP_SUPER name lookup +\name: + movq %rdi, %r8 + movq (%rdi), %rdi + testq %rdi, %rdi + jz returnNilMethod + + movq 8(%r8), %r8 + movq 64(%r8), %r8 + jmp .Lmain_\lookup +.type \name, %function +.size \name, .-\name +.endm + +GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound +GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret +GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup +GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret + +returnNilMethod: + leaq nilMethod(%rip), %rax + ret + +nilMethod: + xorq %rax, %rax + ret + +#ifdef OF_LINUX +.section .note.GNU-stack, "", %progbits +#endif ADDED src/runtime/lookup-asm/lookup-asm-amd64-macho.S Index: src/runtime/lookup-asm/lookup-asm-amd64-macho.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-amd64-macho.S +++ src/runtime/lookup-asm/lookup-asm-amd64-macho.S @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +.globl _objc_msg_lookup +.globl _objc_msg_lookup_stret +.globl _objc_msg_lookup_super +.globl _objc_msg_lookup_super_stret + +.section __TEXT, __text, regular, pure_instructions +.macro GENERATE_LOOKUP +$0: + testq %rdi, %rdi + jz returnNilMethod + + testb $$1, %dil + jnz LtaggedPointer_$0 + + movq (%rdi), %r8 + movq 64(%r8), %r8 + +Lmain_$0: + movq (%rsi), %rax + movzbl %ah, %ecx + movzbl %al, %edx +#ifdef OF_SELUID24 + shrl $$16, %eax + + movq (%r8,%rax,8), %r8 +#endif + movq (%r8,%rcx,8), %r8 + movq (%r8,%rdx,8), %rax + + testq %rax, %rax + jz $1 + + ret + +LtaggedPointer_$0: + movq _objc_taggedPointerSecret@GOTPCREL(%rip), %rax + xorq (%rax), %rdi + andb $$0xE, %dil + movzbl %dil, %r8d + + movq _objc_taggedPointerClasses@GOTPCREL(%rip), %rax + movq (%rax,%r8,4), %r8 + movq 64(%r8), %r8 + + jmp Lmain_$0 +.endmacro + +.macro GENERATE_LOOKUP_SUPER +$0: + movq %rdi, %r8 + movq (%rdi), %rdi + testq %rdi, %rdi + jz returnNilMethod + + movq 8(%r8), %r8 + movq 64(%r8), %r8 + jmp Lmain_$1 +.endmacro + +GENERATE_LOOKUP _objc_msg_lookup, _objc_methodNotFound +GENERATE_LOOKUP _objc_msg_lookup_stret, _objc_methodNotFound_stret +GENERATE_LOOKUP_SUPER _objc_msg_lookup_super, _objc_msg_lookup +GENERATE_LOOKUP_SUPER _objc_msg_lookup_super_stret, _objc_msg_lookup_stret + +returnNilMethod: + leaq nilMethod(%rip), %rax + ret + +nilMethod: + xorq %rax, %rax + ret ADDED src/runtime/lookup-asm/lookup-asm-amd64-win64.S Index: src/runtime/lookup-asm/lookup-asm-amd64-win64.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-amd64-win64.S +++ src/runtime/lookup-asm/lookup-asm-amd64-win64.S @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +.globl objc_msg_lookup +.globl objc_msg_lookup_stret +.globl objc_msg_lookup_super +.globl objc_msg_lookup_super_stret + +.section .text +.macro GENERATE_LOOKUP name notFound +\name: + testq %rcx, %rcx + jz returnNilMethod + + testb $1, %cl + jnz .LtaggedPointer_\name + + movq (%rcx), %r8 + movq 56(%r8), %r8 + +.Lmain_\name: + movq %rcx, %r10 + movq %rdx, %r11 + + movq (%rdx), %rax + movzbl %ah, %ecx + movzbl %al, %edx +#ifdef OF_SELUID24 + shrl $16, %eax + + movq (%r8,%rax,8), %r8 +#endif + movq (%r8,%rcx,8), %r8 + movq (%r8,%rdx,8), %rax + + testq %rax, %rax + jz 0f + + ret + +0: + movq %r10, %rcx + movq %r11, %rdx + jmp \notFound + +.LtaggedPointer_\name: + xorq objc_taggedPointerSecret(%rip), %rcx + andb $0xE, %cl + movzbl %cl, %r8d + + leaq objc_taggedPointerClasses(%rip), %rax + movq (%rax,%r8,4), %r8 + movq 56(%r8), %r8 + + jmp .Lmain_\name +.def \name +.scl 2 +.type 32 +.endef +.endm + +.macro GENERATE_LOOKUP_SUPER name lookup +\name: + movq %rcx, %r8 + movq (%rcx), %rcx + testq %rcx, %rcx + jz returnNilMethod + + movq 8(%r8), %r8 + movq 56(%r8), %r8 + jmp .Lmain_\lookup +.def \name +.scl 2 +.type 32 +.endef +.endm + +GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound +GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret +GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup +GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret + +returnNilMethod: + leaq nilMethod(%rip), %rax + ret + +nilMethod: + xorq %rax, %rax + ret DELETED src/runtime/lookup-asm/lookup-asm-x86_64-elf.S Index: src/runtime/lookup-asm/lookup-asm-x86_64-elf.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-x86_64-elf.S +++ src/runtime/lookup-asm/lookup-asm-x86_64-elf.S @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include "platform.h" - -.globl objc_msg_lookup -.globl objc_msg_lookup_stret -.globl objc_msg_lookup_super -.globl objc_msg_lookup_super_stret - -.section .text -.macro GENERATE_LOOKUP name notFound -\name: - testq %rdi, %rdi - jz returnNilMethod - - testb $1, %dil - jnz .LtaggedPointer_\name - - movq (%rdi), %r8 - movq 64(%r8), %r8 - -.Lmain_\name: - movq (%rsi), %rax - movzbl %ah, %ecx - movzbl %al, %edx -#ifdef OF_SELUID24 - shrl $16, %eax - - movq (%r8,%rax,8), %r8 -#endif - movq (%r8,%rcx,8), %r8 - movq (%r8,%rdx,8), %rax - - testq %rax, %rax - jz \notFound@PLT - - ret - -.LtaggedPointer_\name: - movq objc_taggedPointerSecret@GOTPCREL(%rip), %rax - xorq (%rax), %rdi - andb $0xE, %dil - movzbl %dil, %r8d - - movq objc_taggedPointerClasses@GOTPCREL(%rip), %rax - movq (%rax,%r8,4), %r8 - movq 64(%r8), %r8 - - jmp .Lmain_\name -.type \name, %function -.size \name, .-\name -.endm - -.macro GENERATE_LOOKUP_SUPER name lookup -\name: - movq %rdi, %r8 - movq (%rdi), %rdi - testq %rdi, %rdi - jz returnNilMethod - - movq 8(%r8), %r8 - movq 64(%r8), %r8 - jmp .Lmain_\lookup -.type \name, %function -.size \name, .-\name -.endm - -GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound -GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret -GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup -GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret - -returnNilMethod: - leaq nilMethod(%rip), %rax - ret - -nilMethod: - xorq %rax, %rax - ret - -#ifdef OF_LINUX -.section .note.GNU-stack, "", %progbits -#endif DELETED src/runtime/lookup-asm/lookup-asm-x86_64-macho.S Index: src/runtime/lookup-asm/lookup-asm-x86_64-macho.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-x86_64-macho.S +++ src/runtime/lookup-asm/lookup-asm-x86_64-macho.S @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -.globl _objc_msg_lookup -.globl _objc_msg_lookup_stret -.globl _objc_msg_lookup_super -.globl _objc_msg_lookup_super_stret - -.section __TEXT, __text, regular, pure_instructions -.macro GENERATE_LOOKUP -$0: - testq %rdi, %rdi - jz returnNilMethod - - testb $$1, %dil - jnz LtaggedPointer_$0 - - movq (%rdi), %r8 - movq 64(%r8), %r8 - -Lmain_$0: - movq (%rsi), %rax - movzbl %ah, %ecx - movzbl %al, %edx -#ifdef OF_SELUID24 - shrl $$16, %eax - - movq (%r8,%rax,8), %r8 -#endif - movq (%r8,%rcx,8), %r8 - movq (%r8,%rdx,8), %rax - - testq %rax, %rax - jz $1 - - ret - -LtaggedPointer_$0: - movq _objc_taggedPointerSecret@GOTPCREL(%rip), %rax - xorq (%rax), %rdi - andb $$0xE, %dil - movzbl %dil, %r8d - - movq _objc_taggedPointerClasses@GOTPCREL(%rip), %rax - movq (%rax,%r8,4), %r8 - movq 64(%r8), %r8 - - jmp Lmain_$0 -.endmacro - -.macro GENERATE_LOOKUP_SUPER -$0: - movq %rdi, %r8 - movq (%rdi), %rdi - testq %rdi, %rdi - jz returnNilMethod - - movq 8(%r8), %r8 - movq 64(%r8), %r8 - jmp Lmain_$1 -.endmacro - -GENERATE_LOOKUP _objc_msg_lookup, _objc_methodNotFound -GENERATE_LOOKUP _objc_msg_lookup_stret, _objc_methodNotFound_stret -GENERATE_LOOKUP_SUPER _objc_msg_lookup_super, _objc_msg_lookup -GENERATE_LOOKUP_SUPER _objc_msg_lookup_super_stret, _objc_msg_lookup_stret - -returnNilMethod: - leaq nilMethod(%rip), %rax - ret - -nilMethod: - xorq %rax, %rax - ret DELETED src/runtime/lookup-asm/lookup-asm-x86_64-win64.S Index: src/runtime/lookup-asm/lookup-asm-x86_64-win64.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-x86_64-win64.S +++ src/runtime/lookup-asm/lookup-asm-x86_64-win64.S @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -.globl objc_msg_lookup -.globl objc_msg_lookup_stret -.globl objc_msg_lookup_super -.globl objc_msg_lookup_super_stret - -.section .text -.macro GENERATE_LOOKUP name notFound -\name: - testq %rcx, %rcx - jz returnNilMethod - - testb $1, %cl - jnz .LtaggedPointer_\name - - movq (%rcx), %r8 - movq 56(%r8), %r8 - -.Lmain_\name: - movq %rcx, %r10 - movq %rdx, %r11 - - movq (%rdx), %rax - movzbl %ah, %ecx - movzbl %al, %edx -#ifdef OF_SELUID24 - shrl $16, %eax - - movq (%r8,%rax,8), %r8 -#endif - movq (%r8,%rcx,8), %r8 - movq (%r8,%rdx,8), %rax - - testq %rax, %rax - jz 0f - - ret - -0: - movq %r10, %rcx - movq %r11, %rdx - jmp \notFound - -.LtaggedPointer_\name: - xorq objc_taggedPointerSecret(%rip), %rcx - andb $0xE, %cl - movzbl %cl, %r8d - - leaq objc_taggedPointerClasses(%rip), %rax - movq (%rax,%r8,4), %r8 - movq 56(%r8), %r8 - - jmp .Lmain_\name -.def \name -.scl 2 -.type 32 -.endef -.endm - -.macro GENERATE_LOOKUP_SUPER name lookup -\name: - movq %rcx, %r8 - movq (%rcx), %rcx - testq %rcx, %rcx - jz returnNilMethod - - movq 8(%r8), %r8 - movq 56(%r8), %r8 - jmp .Lmain_\lookup -.def \name -.scl 2 -.type 32 -.endef -.endm - -GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound -GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret -GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup -GENERATE_LOOKUP_SUPER objc_msg_lookup_super_stret objc_msg_lookup_stret - -returnNilMethod: - leaq nilMethod(%rip), %rax - ret - -nilMethod: - xorq %rax, %rax - ret Index: src/runtime/lookup-asm/lookup-asm.S ================================================================== --- src/runtime/lookup-asm/lookup-asm.S +++ src/runtime/lookup-asm/lookup-asm.S @@ -16,12 +16,12 @@ #include "config.h" #include "platform.h" #if defined(OF_ELF) -# if defined(OF_X86_64) -# include "lookup-asm-x86_64-elf.S" +# if defined(OF_AMD64) +# include "lookup-asm-amd64-elf.S" # elif defined(OF_X86) # include "lookup-asm-x86-elf.S" # elif defined(OF_ARM64) # include "lookup-asm-arm64-elf.S" # elif defined(OF_ARM) @@ -38,15 +38,15 @@ # include "lookup-asm-sparc64-elf.S" # elif defined(OF_SPARC) # include "lookup-asm-sparc-elf.S" # endif #elif defined(OF_MACH_O) -# if defined(OF_X86_64) -# include "lookup-asm-x86_64-macho.S" +# if defined(OF_AMD64) +# include "lookup-asm-amd64-macho.S" # endif #elif defined(OF_WINDOWS) -# if defined(OF_X86_64) -# include "lookup-asm-x86_64-win64.S" +# if defined(OF_AMD64) +# include "lookup-asm-amd64-win64.S" # elif defined(OF_X86) # include "lookup-asm-x86-win32.S" # endif #endif Index: src/runtime/private.h ================================================================== --- src/runtime/private.h +++ src/runtime/private.h @@ -355,23 +355,23 @@ #define OBJC_ERROR(...) \ objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \ __VA_ARGS__) #if defined(OF_ELF) -# if defined(OF_X86_64) || defined(OF_X86) || \ +# if defined(OF_AMD64) || defined(OF_X86) || \ defined(OF_POWERPC64) || defined(OF_POWERPC) || \ defined(OF_ARM64) || defined(OF_ARM) || \ defined(OF_MIPS64_N64) || defined(OF_MIPS) || \ defined(OF_SPARC64) || defined(OF_SPARC) # define OF_ASM_LOOKUP # endif #elif defined(OF_MACH_O) -# if defined(OF_X86_64) +# if defined(OF_AMD64) # define OF_ASM_LOOKUP # endif #elif defined(OF_WINDOWS) -# if defined(OF_X86_64) || defined(OF_X86) +# if defined(OF_AMD64) || defined(OF_X86) # define OF_ASM_LOOKUP # endif #endif @interface DummyObject Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -1154,11 +1154,11 @@ # if (!defined(OF_SOLARIS) || !defined(OF_X86)) && !defined(OF_AMIGAOS_M68K) # define INPUT @"\t-0.123456789 " # define EXPECTED -0.123456789 # else /* - * Solaris' strtod() has weird rounding on x86, but not on x86_64. + * Solaris' strtod() has weird rounding on x86, but not on AMD64. * AmigaOS 3 with libnix has weird rounding as well. */ # define INPUT @"\t-0.125 " # define EXPECTED -0.125 # endif