diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-07-18 00:34:22 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-07-18 00:34:22 +0200 |
commit | 8762cdc8a67b016625a98a4b4b42f5788c60fc51 (patch) | |
tree | d794510993f37d206fea8cc255afeef2046ee270 | |
parent | 29f8a4edbe4ed7d61ac61296959a063ef76b80fa (diff) | |
download | bxgen-8762cdc8a67b016625a98a4b4b42f5788c60fc51.zip |
Add checks
-rwxr-xr-x | bxgen.c | 60 |
1 files changed, 58 insertions, 2 deletions
@@ -1278,6 +1278,32 @@ enum { BIND_LOCAL = 0, BIND_GLOBAL, BIND_WEAK, + + // Relocation types + // + + R_X86_64_NONE = 0, + R_X86_64_64, + R_X86_64_PC32, + R_X86_64_GOT32, + R_X86_64_PLT32, + R_X86_64_COPY, + R_X86_64_GLOB_DAT, + R_X86_64_JUMP_SLOT, + R_X86_64_RELATIVE, + R_X86_64_GOTPCREL, + R_X86_64_32, + R_X86_64_32S, + R_X86_64_16, + R_X86_64_PC16, + R_X86_64_8, + R_X86_64_PC8, + R_X86_64_PC64 = 24, + R_X86_64_GOTOFF64, + R_X86_64_GOTPC32, + R_X86_64_SIZE32 = 32, + R_X86_64_SIZE64 = 33, + R_X86_64_REX_GOTPCRELX = 42, }; c8 ELF_MAGIC[4] = "\x7f" "ELF"; @@ -2022,9 +2048,39 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data for (u32 rela_index = 0; rela_index < section.num_entries; ++rela_index) { Rela_Entry rela = elf_rela(buf, symbols, symbol_names, section.data, dst, rela_index); + printf(" "); + + switch (rela.type_) { + case R_X86_64_NONE: printf("none "); break; + case R_X86_64_64: printf("64 "); break; + case R_X86_64_PC32: printf("pc32 "); break; + case R_X86_64_GOT32: printf("got32 "); break; + case R_X86_64_PLT32: printf("plt32 "); break; + case R_X86_64_COPY: printf("copy "); break; + case R_X86_64_GLOB_DAT: printf("glob dat "); break; + case R_X86_64_JUMP_SLOT: printf("dump slot "); break; + case R_X86_64_RELATIVE: printf("relative "); break; + case R_X86_64_GOTPCREL: printf("gotpcrel "); break; + case R_X86_64_32: printf("32 "); break; + case R_X86_64_32S: printf("32s "); break; + case R_X86_64_16: printf("16 "); break; + case R_X86_64_PC16: printf("pc16 "); break; + case R_X86_64_8: printf("8 "); break; + case R_X86_64_PC8: printf("pc8 "); break; + case R_X86_64_PC64: printf("pc64 "); break; + case R_X86_64_GOTOFF64: printf("gotoff64 "); break; + case R_X86_64_GOTPC32: printf("gotpc32 "); break; + case R_X86_64_SIZE32: printf("size32 "); break; + case R_X86_64_SIZE64: printf("size64 "); break; + case R_X86_64_REX_GOTPCRELX: printf("rex gotpcrelx"); break; + default: + BX_LOG(TRACE, "relocation type: %d", rela.type_); + BX_FAIL("Unsupported relocation type",); + break; + } + printf( - " %-4d %08llx %-+5lld <= ", - rela.type_, + " %08llx %-+5lld <= ", rela.dst, rela.addent ); |