summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibC/elf.h2
-rw-r--r--Userland/Libraries/LibC/inttypes.h9
-rw-r--r--Userland/Libraries/LibC/link.h6
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp12
4 files changed, 12 insertions, 17 deletions
diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h
index 0edd9f6cd7..c50742b80c 100644
--- a/Userland/Libraries/LibC/elf.h
+++ b/Userland/Libraries/LibC/elf.h
@@ -38,7 +38,7 @@
# include <AK/Types.h>
#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 78b65c9103..c2766911af 100644
--- a/Userland/Libraries/LibC/inttypes.h
+++ b/Userland/Libraries/LibC/inttypes.h
@@ -6,6 +6,7 @@
#pragma once
+#include <AK/Platform.h>
#include <bits/stdint.h>
#include <sys/cdefs.h>
@@ -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 9a49dd3bb8..73ad8ad07f 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 06bf81ba59..db6fa1c896 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: {