mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:07:34 +00:00
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.
This commit is contained in:
parent
4d5965bd2c
commit
08c459e495
6 changed files with 56 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue