diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-03-13 08:49:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-01 12:42:01 +0200 |
commit | 08c459e495608b4be6b9a032cc62ca65f4cef975 (patch) | |
tree | 48d96d5e493a0efa6632a96983fe2825743ab4ba /Userland/Libraries/LibC | |
parent | 4d5965bd2c07bd88c91c5977a5a7e7a546a09917 (diff) | |
download | serenity-08c459e495608b4be6b9a032cc62ca65f4cef975.zip |
LibELF: Add support for IFUNCs
IFUNC is a GNU extension to the ELF standard that allows a function to
have multiple implementations. A resolver function has to be called at
load time to choose the right one to use. The PLT will contain the entry
to the resolved function, so branching and more indirect jumps can be
avoided at run-time.
This mechanism is usually used when a routine can be made faster using
CPU features that are available in only some models, and a fallback
implementation has to exist for others.
We will use this feature to have two separate memset implementations for
CPUs with and without ERMS (Enhanced REP MOVSB/STOSB) support.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/elf.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index d61dc831d2..d43ec0e859 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -381,6 +381,7 @@ typedef struct { #define STT_SECTION 3 /* section */ #define STT_FILE 4 /* file */ #define STT_TLS 6 /* thread local storage */ +#define STT_GNU_IFUNC 10 #define STT_LOPROC 13 /* reserved range for processor */ #define STT_HIPROC 15 /* specific symbol types */ @@ -812,6 +813,7 @@ struct elf_args { #define R_386_RELATIVE 8 /* Base address + Addned */ #define R_386_TLS_TPOFF 14 /* Negative offset into the static TLS storage */ #define R_386_TLS_TPOFF32 37 +#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ #define R_X86_64_NONE 0 #define R_X86_64_64 1 @@ -819,3 +821,4 @@ struct elf_args { #define R_X86_64_JUMP_SLOT 7 #define R_X86_64_RELATIVE 8 #define R_X86_64_TPOFF64 18 +#define R_X86_64_IRELATIVE 37 |