Commit 5efa28139cac60683387415df479f6413988aa65
1 parent
753812cb2e
Exists in
v2017.01-smarct4x
and in
30 other branches
elf: Add a few definitions for 64-bit relocation
Provide the types necessary to relocate 64-bit images. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Showing 1 changed file with 26 additions and 0 deletions Side-by-side Diff
include/elf.h
... | ... | @@ -28,6 +28,16 @@ |
28 | 28 | typedef uint32_t Elf32_Word; /* Unsigned large integer */ |
29 | 29 | typedef uint16_t Elf32_Half; /* Unsigned medium integer */ |
30 | 30 | |
31 | +/* 64-bit ELF base types. */ | |
32 | +typedef uint64_t Elf64_Addr; | |
33 | +typedef uint16_t Elf64_Half; | |
34 | +typedef int16_t Elf64_SHalf; | |
35 | +typedef uint64_t Elf64_Off; | |
36 | +typedef int32_t Elf64_Sword; | |
37 | +typedef uint32_t Elf64_Word; | |
38 | +typedef uint64_t Elf64_Xword; | |
39 | +typedef int64_t Elf64_Sxword; | |
40 | + | |
31 | 41 | /* e_ident[] identification indexes */ |
32 | 42 | #define EI_MAG0 0 /* file ID */ |
33 | 43 | #define EI_MAG1 1 /* file ID */ |
... | ... | @@ -379,6 +389,11 @@ |
379 | 389 | Elf32_Sword r_addend; |
380 | 390 | } Elf32_Rela; |
381 | 391 | |
392 | +typedef struct { | |
393 | + Elf64_Addr r_offset; /* Location at which to apply the action */ | |
394 | + Elf64_Xword r_info; /* index and type of relocation */ | |
395 | +} Elf64_Rel; | |
396 | + | |
382 | 397 | /* Extract relocation info - r_info */ |
383 | 398 | #define ELF32_R_SYM(i) ((i) >> 8) |
384 | 399 | #define ELF32_R_TYPE(i) ((unsigned char) (i)) |
... | ... | @@ -430,6 +445,17 @@ |
430 | 445 | } Elf32_Dyn; |
431 | 446 | |
432 | 447 | extern Elf32_Dyn _DYNAMIC[]; |
448 | + | |
449 | +typedef struct { | |
450 | + Elf64_Sxword d_tag; /* entry tag value */ | |
451 | + union { | |
452 | + Elf64_Xword d_val; | |
453 | + Elf64_Addr d_ptr; | |
454 | + } d_un; | |
455 | +} Elf64_Dyn; | |
456 | + | |
457 | +#define ELF64_R_SYM(i) ((i) >> 32) | |
458 | +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) | |
433 | 459 | |
434 | 460 | /* Dynamic Array Tags - d_tag */ |
435 | 461 | #define DT_NULL 0 /* marks end of _DYNAMIC array */ |