diff options
-rwxr-xr-x | bxgen.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -2627,15 +2627,6 @@ i64 unit_write_in_memory( // Represents the base address at which a shared object has been loaded into memory during execution. Generally, a shared object is built with a 0 base virtual address, but the execution address will be different. i64 B = linker->section_addresses[dst_index_global]; - // Represents the offset into the global offset table at which the relocation entry's symbol will reside during execution. - i64 G = 0; - - // Represents the address of the global offset table. - i64 GOT = 0; - - // Represents the place (section offset or address) of the Procedure Linkage Table entry for a symbol. - i64 L = 0; - // Represents the place (section offset or address) of the storage unit being relocated (computed using r_offset). i64 P = linker->section_addresses[dst_index_global] + relx.offset; @@ -2645,6 +2636,15 @@ i64 unit_write_in_memory( // The size of the symbol whose index resides in the relocation entry. i64 Z = symbol.size; + // Represents the address of the global offset table. + i64 GOT = 0; + + // Represents the offset into the global offset table at which the relocation entry's symbol will reside during execution. + i64 G = 0; + + // Represents the place (section offset or address) of the Procedure Linkage Table entry for a symbol. + i64 L = S; + switch (relx.type) { #define ADD_(BITS, OP) \ do { \ @@ -2656,9 +2656,9 @@ i64 unit_write_in_memory( case R_X86_64_NONE: /* Do nothing */ break; case R_X86_64_64: ADD_(64, 0); break; // 64, S + A - case R_X86_64_PC32: ADD_(32, 0); break; // 32, S + A - P + case R_X86_64_PC32: ADD_(32, S + A - P); break; // 32, S + A - P case R_X86_64_GOT32: TODO_; break; // 32, G + A - case R_X86_64_PLT32: ADD_(32, S + A - P); break; // 32, L + A - P + case R_X86_64_PLT32: ADD_(32, L + A - P); break; // 32, L + A - P case R_X86_64_COPY: /* Do nothing */ break; case R_X86_64_GLOB_DAT: TODO_; break; // 64, S case R_X86_64_JUMP_SLOT: TODO_; break; // 64, S |