summaryrefslogtreecommitdiff
path: root/src/binary-reader-linker.cc
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-03-13 15:54:17 -0700
committerGitHub <noreply@github.com>2017-03-13 15:54:17 -0700
commita17662511d4e7c277f5add3b61453e7b708b2756 (patch)
tree1ca4ecbf6aeb512567c51042450d36c16b315551 /src/binary-reader-linker.cc
parent39e2c488f82ccd1bbc08059ea575b2d9deafe008 (diff)
downloadwabt-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-linker.cc')
-rw-r--r--src/binary-reader-linker.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/binary-reader-linker.cc b/src/binary-reader-linker.cc
index 5d652951..dc537259 100644
--- a/src/binary-reader-linker.cc
+++ b/src/binary-reader-linker.cc
@@ -52,7 +52,11 @@ static Result on_reloc_count(uint32_t count,
return Result::Error;
}
-static Result on_reloc(RelocType type, uint32_t offset, void* user_data) {
+static Result on_reloc(RelocType type,
+ uint32_t offset,
+ uint32_t index,
+ int32_t addend,
+ void* user_data) {
Context* ctx = static_cast<Context*>(user_data);
if (offset + RELOC_SIZE > ctx->reloc_section->size) {
@@ -62,6 +66,8 @@ static Result on_reloc(RelocType type, uint32_t offset, void* user_data) {
Reloc* reloc = append_reloc(&ctx->reloc_section->relocations);
reloc->type = type;
reloc->offset = offset;
+ reloc->index = index;
+ reloc->addend = addend;
return Result::Ok;
}