diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index 0edd9f6cd77..c50742b80c7 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -38,7 +38,7 @@ # include #endif -#ifdef __LP64__ +#ifdef __x86_64__ # define ElfW(type) Elf64_##type #else # define ElfW(type) Elf32_##type diff --git a/Userland/Libraries/LibC/inttypes.h b/Userland/Libraries/LibC/inttypes.h index 78b65c91038..c2766911afb 100644 --- a/Userland/Libraries/LibC/inttypes.h +++ b/Userland/Libraries/LibC/inttypes.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include @@ -18,7 +19,7 @@ __BEGIN_DECLS #define PRIi8 "d" #define PRIi16 "d" #define PRIi32 "d" -#ifndef __LP64__ +#if ARCH(I386) # define PRIi64 "lld" #else # define PRIi64 "ld" @@ -27,14 +28,14 @@ __BEGIN_DECLS #define PRIo8 "o" #define PRIo16 "o" #define PRIo32 "o" -#ifndef __LP64__ +#if ARCH(I386) # define PRIo64 "llo" #else # define PRIo64 "lo" #endif #define PRIu16 "u" #define PRIu32 "u" -#ifndef __LP64__ +#if ARCH(I386) # define PRIu64 "llu" # define PRIuPTR "x" #else @@ -47,7 +48,7 @@ __BEGIN_DECLS #define PRIX16 "hX" #define PRIx32 "x" #define PRIX32 "X" -#ifndef __LP64__ +#if ARCH(I386) # define PRIx64 "llx" # define PRIX64 "llX" # define PRIxPTR "x" diff --git a/Userland/Libraries/LibC/link.h b/Userland/Libraries/LibC/link.h index 9a49dd3bb8f..73ad8ad07f3 100644 --- a/Userland/Libraries/LibC/link.h +++ b/Userland/Libraries/LibC/link.h @@ -16,12 +16,6 @@ __BEGIN_DECLS -#ifdef __LP64__ -# define ElfW(type) Elf64_##type -#else -# define ElfW(type) Elf32_##type -#endif - struct dl_phdr_info { ElfW(Addr) dlpi_addr; const char* dlpi_name; diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index 06bf81ba593..db6fa1c896a 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -398,7 +398,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO patch_ptr = (FlatPtr*)(FlatPtr)relocation.offset(); switch (relocation.type()) { -#ifndef __LP64__ +#if ARCH(I386) case R_386_NONE: #else case R_X86_64_NONE: @@ -406,7 +406,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO // Apparently most loaders will just skip these? // Seems if the 'link editor' generates one something is funky with your code break; -#ifndef __LP64__ +#if ARCH(I386) case R_386_32: { #else case R_X86_64_64: { @@ -426,7 +426,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO *patch_ptr += symbol_address.get(); break; } -#ifndef __LP64__ +#if ARCH(I386) case R_386_PC32: { auto symbol = relocation.symbol(); auto result = lookup_symbol(symbol); @@ -459,7 +459,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO *patch_ptr = symbol_location.get(); break; } -#ifndef __LP64__ +#if ARCH(I386) case R_386_RELATIVE: { #else case R_X86_64_RELATIVE: { @@ -473,7 +473,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO *patch_ptr += (FlatPtr)m_dynamic_object->base_address().as_ptr(); break; } -#ifndef __LP64__ +#if ARCH(I386) case R_386_TLS_TPOFF32: case R_386_TLS_TPOFF: { #else @@ -497,7 +497,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO *patch_ptr = negative_offset_from_tls_block_end(dynamic_object_of_symbol->tls_offset().value(), symbol_value + addend); break; } -#ifndef __LP64__ +#if ARCH(I386) case R_386_JMP_SLOT: { #else case R_X86_64_JUMP_SLOT: { diff --git a/Userland/Utilities/crash.cpp b/Userland/Utilities/crash.cpp index 7781517f2da..227e67f5c13 100644 --- a/Userland/Utilities/crash.cpp +++ b/Userland/Utilities/crash.cpp @@ -207,7 +207,7 @@ int main(int argc, char** argv) return Crash::Failure::UnexpectedError; u8* bad_esp = bad_stack + 2048; -#ifndef __LP64__ +#if ARCH(I386) asm volatile("mov %%eax, %%esp" ::"a"(bad_esp)); asm volatile("pushl $0"); #else