Skip to content

Commit

Permalink
Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (WebAssembl…
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun authored Mar 11, 2024
1 parent 1471dff commit bfcd0a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/wabt/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ enum class ComdatType {

#define WABT_SEGMENT_FLAG_STRINGS 0x1
#define WABT_SEGMENT_FLAG_TLS 0x2
#define WASM_SEGMENT_FLAG_RETAIN 0x4
#define WABT_SEGMENT_FLAG_MAX 0xff

enum class SymbolVisibility {
Expand Down
4 changes: 4 additions & 0 deletions src/binary-reader-objdump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,10 @@ Result BinaryReaderObjdump::PrintSegmentFlags(uint32_t flags) {
PrintDetails(" TLS");
flags &= ~WABT_SEGMENT_FLAG_TLS;
}
if (flags & WASM_SEGMENT_FLAG_RETAIN) {
PrintDetails(" RETAIN");
flags &= ~WASM_SEGMENT_FLAG_RETAIN;
}
if (flags != 0) {
PrintDetails(" unknown_flags=%#x", flags);
}
Expand Down
8 changes: 6 additions & 2 deletions test/binary/linking-section.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ section("linking") {
metadata_version[2]

section(LINKING_SEGMENT_INFO) {
count[2]
count[3]
str("data1")
p2align[2]
flags[1]
str("data2")
p2align[3]
flags[10]
str("data3")
p2align[2]
flags[4]
}

section(LINKING_INIT_FUNCTIONS) {
Expand Down Expand Up @@ -153,9 +156,10 @@ Data[2]:
- 000000a: 6261 72 bar
Custom:
- name: "linking"
- segment info [count=2]
- segment info [count=3]
- 0: data1 p2align=2 [ STRINGS ]
- 1: data2 p2align=3 [ TLS unknown_flags=0x8 ]
- 2: data3 p2align=2 [ RETAIN ]
- init functions [count=2]
- 1: priority=5 <global_sym>
- 0: priority=6 <func_sym>
Expand Down

0 comments on commit bfcd0a1

Please sign in to comment.