summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-logging.cc7
-rw-r--r--src/binary-reader-logging.h2
-rw-r--r--src/binary-reader-nop.h4
-rw-r--r--src/binary-reader-objdump.cc14
-rw-r--r--src/binary-reader.cc9
-rw-r--r--src/binary-reader.h2
6 files changed, 37 insertions, 1 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc
index a99c3206..e31471df 100644
--- a/src/binary-reader-logging.cc
+++ b/src/binary-reader-logging.cc
@@ -479,6 +479,12 @@ Result BinaryReaderLogging::OnDylinkInfo(uint32_t mem_size,
return reader_->OnDylinkInfo(mem_size, mem_align, table_size, table_align);
}
+Result BinaryReaderLogging::OnDylinkNeeded(string_view so_name) {
+ LOGF("OnDylinkNeeded(name: " PRIstringview ")\n",
+ WABT_PRINTF_STRING_VIEW_ARG(so_name));
+ return reader_->OnDylinkNeeded(so_name);
+}
+
Result BinaryReaderLogging::OnRelocCount(Index count,
Index section_index) {
LOGF("OnRelocCount(count: %" PRIindex ", section: %" PRIindex ")\n", count,
@@ -739,6 +745,7 @@ DEFINE_END(EndRelocSection)
DEFINE_INDEX_INDEX(OnInitExprGetGlobalExpr, "index", "global_index")
DEFINE_BEGIN(BeginDylinkSection)
+DEFINE_INDEX(OnDylinkNeededCount)
DEFINE_END(EndDylinkSection)
DEFINE_BEGIN(BeginLinkingSection)
diff --git a/src/binary-reader-logging.h b/src/binary-reader-logging.h
index f70b530e..5d28c1b2 100644
--- a/src/binary-reader-logging.h
+++ b/src/binary-reader-logging.h
@@ -267,6 +267,8 @@ class BinaryReaderLogging : public BinaryReaderDelegate {
uint32_t mem_align,
uint32_t table_size,
uint32_t table_align) override;
+ Result OnDylinkNeededCount(Index count) override;
+ Result OnDylinkNeeded(string_view needed) override;
Result EndDylinkSection() override;
Result BeginLinkingSection(Offset size) override;
diff --git a/src/binary-reader-nop.h b/src/binary-reader-nop.h
index 170899fe..059743dd 100644
--- a/src/binary-reader-nop.h
+++ b/src/binary-reader-nop.h
@@ -372,7 +372,9 @@ class BinaryReaderNop : public BinaryReaderDelegate {
uint32_t table_size,
uint32_t table_align) override {
return Result::Ok;
- };
+ }
+ Result OnDylinkNeededCount(Index count) override { return Result::Ok; }
+ Result OnDylinkNeeded(string_view so_name) override { return Result::Ok; }
Result EndDylinkSection() override { return Result::Ok; }
/* Linking section */
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 7653d105..fb4c3d23 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -767,6 +767,8 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase {
uint32_t mem_align,
uint32_t table_size,
uint32_t table_align) override;
+ Result OnDylinkNeededCount(Index count) override;
+ Result OnDylinkNeeded(string_view so_name) override;
Result OnRelocCount(Index count, Index section_index) override;
Result OnReloc(RelocType type,
@@ -1354,6 +1356,18 @@ Result BinaryReaderObjdump::OnDylinkInfo(uint32_t mem_size,
return Result::Ok;
}
+Result BinaryReaderObjdump::OnDylinkNeededCount(Index count) {
+ if (count) {
+ PrintDetails(" - needed_dynlibs[%u]:\n", count);
+ }
+ return Result::Ok;
+}
+
+Result BinaryReaderObjdump::OnDylinkNeeded(string_view so_name) {
+ PrintDetails(" - " PRIstringview "\n", WABT_PRINTF_STRING_VIEW_ARG(so_name));
+ return Result::Ok;
+}
+
Result BinaryReaderObjdump::OnRelocCount(Index count, Index section_index) {
BinaryReaderObjdumpBase::OnRelocCount(count, section_index);
PrintDetails(" - relocations for section: %d (%s) [%d]\n", section_index,
diff --git a/src/binary-reader.cc b/src/binary-reader.cc
index e08551a0..e1c5e759 100644
--- a/src/binary-reader.cc
+++ b/src/binary-reader.cc
@@ -1562,6 +1562,15 @@ Result BinaryReader::ReadDylinkSection(Offset section_size) {
CHECK_RESULT(ReadU32Leb128(&table_align, "table_align"));
CALLBACK(OnDylinkInfo, mem_size, mem_align, table_size, table_align);
+ uint32_t count;
+ CHECK_RESULT(ReadU32Leb128(&count, "needed_dynlibs"));
+ CALLBACK(OnDylinkNeededCount, count);
+ while (count--) {
+ string_view so_name;
+ CHECK_RESULT(ReadStr(&so_name, "dylib so_name"));
+ CALLBACK(OnDylinkNeeded, so_name);
+ }
+
CALLBACK0(EndDylinkSection);
return Result::Ok;
}
diff --git a/src/binary-reader.h b/src/binary-reader.h
index 12830c3c..e666089b 100644
--- a/src/binary-reader.h
+++ b/src/binary-reader.h
@@ -328,6 +328,8 @@ class BinaryReaderDelegate {
uint32_t mem_align,
uint32_t table_size,
uint32_t table_align) = 0;
+ virtual Result OnDylinkNeededCount(Index count) = 0;
+ virtual Result OnDylinkNeeded(string_view so_name) = 0;
virtual Result EndDylinkSection() = 0;
/* Linking section */