From 1cf06333160a9a6a4dabeba19f6d67ab55f0dac2 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 16 Oct 2021 14:31:42 -0700 Subject: [PATCH] sys: Add definitions for RELR relative relocation format MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32526 --- sys/sys/elf32.h | 2 ++ sys/sys/elf64.h | 2 ++ sys/sys/elf_common.h | 3 +++ sys/sys/elf_generic.h | 1 + 4 files changed, 8 insertions(+) diff --git a/sys/sys/elf32.h b/sys/sys/elf32.h index ad44b7cf970a..c328ce3b2f80 100644 --- a/sys/sys/elf32.h +++ b/sys/sys/elf32.h @@ -152,6 +152,8 @@ typedef struct { /* Macro for constructing r_info from field values. */ #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) +typedef Elf32_Word Elf32_Relr; + /* * Note entry header */ diff --git a/sys/sys/elf64.h b/sys/sys/elf64.h index 880166a3e83a..cc5c682e07da 100644 --- a/sys/sys/elf64.h +++ b/sys/sys/elf64.h @@ -166,6 +166,8 @@ typedef struct { #define ELF64_R_TYPE_INFO(data, type) \ (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type)) +typedef Elf64_Xword Elf64_Relr; + /* * Note entry header */ diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index 4df2751b07cf..e8eda4d91260 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -617,6 +617,9 @@ typedef struct { #define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of pre-initialization functions. */ #define DT_MAXPOSTAGS 34 /* number of positive tags */ +#define DT_RELRSZ 35 /* Total size of ElfNN_Relr relocations. */ +#define DT_RELR 36 /* Address of ElfNN_Relr relocations. */ +#define DT_RELRENT 37 /* Size of each ElfNN_Relr relocation. */ #define DT_LOOS 0x6000000d /* First OS-specific */ #define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */ #define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */ diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h index dcd44fe93b14..177de7339d3f 100644 --- a/sys/sys/elf_generic.h +++ b/sys/sys/elf_generic.h @@ -71,6 +71,7 @@ __ElfType(Phdr); __ElfType(Dyn); __ElfType(Rel); __ElfType(Rela); +__ElfType(Relr); __ElfType(Sym); __ElfType(Verdef); __ElfType(Verdaux);