diff options
author | Sam Clegg <sbc@chromium.org> | 2017-03-13 15:54:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-13 15:54:17 -0700 |
commit | a17662511d4e7c277f5add3b61453e7b708b2756 (patch) | |
tree | 1ca4ecbf6aeb512567c51042450d36c16b315551 /src/binary-reader-objdump.cc | |
parent | 39e2c488f82ccd1bbc08059ea575b2d9deafe008 (diff) | |
download | wabt-a17662511d4e7c277f5add3b61453e7b708b2756.tar.gz wabt-a17662511d4e7c277f5add3b61453e7b708b2756.tar.bz2 wabt-a17662511d4e7c277f5add3b61453e7b708b2756.zip |
Update relocation encoding to latest "spec" (#352)
This brings wabt into line with what llvm is now
producing and what is soon that land in the
tool-conventions "spec" for static linking.
Adds 'index' and (options) 'addend' to relocations.
Define Reloc in common.h rather than once for each
tool.
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r-- | src/binary-reader-objdump.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index a29f893b..fde0bbe0 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -249,8 +249,8 @@ static void log_opcode(Context* ctx, ctx->section_starts[static_cast<size_t>(BinarySection::Code)]; size_t abs_offset = code_start + reloc->offset; if (ctx->last_opcode_end > abs_offset) { - printf(" %06" PRIzx ": %s\n", abs_offset, - get_reloc_type_name(reloc->type)); + printf(" %06" PRIzx ": %s\t%d\n", abs_offset, + get_reloc_type_name(reloc->type), reloc->index); ctx->next_reloc++; } } @@ -615,7 +615,11 @@ Result on_reloc_count(uint32_t count, return Result::Ok; } -Result on_reloc(RelocType type, uint32_t offset, void* user_data) { +Result on_reloc(RelocType type, + uint32_t offset, + uint32_t index, + int32_t addend, + void* user_data) { Context* ctx = static_cast<Context*>(user_data); uint32_t total_offset = ctx->section_starts[static_cast<size_t>(ctx->reloc_section)] + offset; @@ -626,6 +630,8 @@ Result on_reloc(RelocType type, uint32_t offset, void* user_data) { Reloc reloc; reloc.offset = offset; reloc.type = type; + reloc.index = index; + reloc.addend = addend; append_reloc_value(&ctx->options->code_relocations, &reloc); } return Result::Ok; |