diff options
| author | Yip Coekjan <69834864+Coekjan@users.noreply.github.com> | 2024-07-02 19:47:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-02 13:47:48 +0200 |
| commit | 9cd8812d8b2b1648a40c05e02787c375d5ce5cd4 (patch) | |
| tree | c9be3f2f7692387ec8e28d6eb5f0bfd0afb6a3ca /src/include/elfloader.h | |
| parent | 4b0b3fc98ae4a1e848765e0cd48f958a13fc683d (diff) | |
| download | box64-9cd8812d8b2b1648a40c05e02787c375d5ce5cd4.tar.gz box64-9cd8812d8b2b1648a40c05e02787c375d5ce5cd4.zip | |
Handle `.relr.dyn` section (#1626)
Diffstat (limited to 'src/include/elfloader.h')
| -rw-r--r-- | src/include/elfloader.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/elfloader.h b/src/include/elfloader.h index ea0928b1..770709c8 100644 --- a/src/include/elfloader.h +++ b/src/include/elfloader.h @@ -1,6 +1,7 @@ #ifndef __ELF_LOADER_H_ #define __ELF_LOADER_H_ #include <stdio.h> +#include <elf.h> typedef struct elfheader_s elfheader_t; typedef struct lib_s lib_t; @@ -14,6 +15,24 @@ typedef struct kh_defaultversion_s kh_defaultversion_t; typedef struct dynablock_s dynablock_t; #endif +// Define for handling .relr.dyn section (since glibc 2.36) +// See Also https://lists.gnu.org/archive/html/info-gnu/2022-08/msg00000.html +// +// if glibc 2.36 is widely used in the future, this part can be removed +#ifndef DT_RELR + +// Copy from (glibc 2.36) elf.h + +#define SHT_RELR 19 /* RELR relative relocations */ + +typedef Elf32_Word Elf32_Relr; +typedef Elf64_Xword Elf64_Relr; + +#define DT_RELRSZ 35 /* Total size of RELR relative relocations */ +#define DT_RELR 36 /* Address of RELR relative relocations */ +#define DT_RELRENT 37 /* Size of one RELR relative relocaction */ +#endif // DT_RELR + // Open an elfheader. Transfert control of f to elfheader also! elfheader_t* LoadAndCheckElfHeader(FILE* f, const char* name, int exec); // exec : 0 = lib, 1 = exec void FreeElfHeader(elfheader_t** head); |