diff --git a/include/wabt/common.h b/include/wabt/common.h index 54aeb9126..4a26a1664 100644 --- a/include/wabt/common.h +++ b/include/wabt/common.h @@ -328,7 +328,8 @@ enum class ComdatType { #define WABT_SYMBOL_FLAG_EXPLICIT_NAME 0x40 #define WABT_SYMBOL_FLAG_NO_STRIP 0x80 #define WABT_SYMBOL_FLAG_TLS 0x100 -#define WABT_SYMBOL_FLAG_MAX 0x1ff +#define WABT_SYMBOL_FLAG_ABS 0x200 +#define WABT_SYMBOL_FLAG_MAX 0x3ff #define WABT_SEGMENT_FLAG_STRINGS 0x1 #define WABT_SEGMENT_FLAG_TLS 0x2 diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index bca6a2b96..e1d2d5133 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -2171,6 +2171,10 @@ Result BinaryReaderObjdump::PrintSymbolFlags(uint32_t flags) { PrintDetails(" tls"); flags &= ~WABT_SYMBOL_FLAG_TLS; } + if (flags & WABT_SYMBOL_FLAG_ABS) { + PrintDetails(" abs"); + flags &= ~WABT_SYMBOL_FLAG_ABS; + } if (flags != 0) { PrintDetails(" unknown_flags=%#x", flags); } @@ -2207,9 +2211,14 @@ Result BinaryReaderObjdump::OnDataSymbol(Index index, uint32_t size) { PrintDetails(" - %d: D <" PRIstringview ">", index, WABT_PRINTF_STRING_VIEW_ARG(name)); - if (!(flags & WABT_SYMBOL_FLAG_UNDEFINED)) - PrintDetails(" segment=%" PRIindex " offset=%d size=%d", segment, offset, - size); + if (!(flags & WABT_SYMBOL_FLAG_UNDEFINED)) { + if (flags & WABT_SYMBOL_FLAG_ABS) { + PrintDetails(" address=%d size=%d", offset, size); + } else { + PrintDetails(" segment=%" PRIindex " offset=%d size=%d", segment, offset, + size); + } + } return PrintSymbolFlags(flags); } diff --git a/test/binary/linking-section.txt b/test/binary/linking-section.txt index 542b06e7f..3ba79895c 100644 --- a/test/binary/linking-section.txt +++ b/test/binary/linking-section.txt @@ -69,7 +69,7 @@ section("linking") { } section(LINKING_SYMBOL_TABLE) { - num_symbols[5] + num_symbols[6] type[0] flags[1] @@ -88,6 +88,13 @@ section("linking") { offset[2] size[1] + type[1] + flags[leb_i32(512)] + str("absolute_data_sym") + segment[0] + offset[leb_i32(1024)] + size[0] + type[0] flags[0x10] index[0] @@ -152,12 +159,13 @@ Custom: - init functions [count=2] - 1: priority=5 - 0: priority=6 - - symbol table [count=5] + - symbol table [count=6] - 0: F func=0 [ binding=weak vis=default ] - 1: G global=0 [ binding=local vis=default ] - 2: D segment=1 offset=2 size=1 [ tls binding=global vis=hidden ] - - 3: F func=0 [ undefined binding=global vis=default ] - - 4: T table=0 [ binding=weak vis=default ] + - 3: D address=1024 size=0 [ abs binding=global vis=default ] + - 4: F func=0 [ undefined binding=global vis=default ] + - 5: T table=0 [ binding=weak vis=default ] - comdat groups [count=2] - comdat1: [count=1] - segment[1]