Skip to content

Commit bfcd0a1

Browse files
Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (#2399)
See llvm/llvm-project#81539
1 parent 1471dff commit bfcd0a1

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

include/wabt/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ enum class ComdatType {
333333

334334
#define WABT_SEGMENT_FLAG_STRINGS 0x1
335335
#define WABT_SEGMENT_FLAG_TLS 0x2
336+
#define WASM_SEGMENT_FLAG_RETAIN 0x4
336337
#define WABT_SEGMENT_FLAG_MAX 0xff
337338

338339
enum class SymbolVisibility {

src/binary-reader-objdump.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,10 @@ Result BinaryReaderObjdump::PrintSegmentFlags(uint32_t flags) {
22062206
PrintDetails(" TLS");
22072207
flags &= ~WABT_SEGMENT_FLAG_TLS;
22082208
}
2209+
if (flags & WASM_SEGMENT_FLAG_RETAIN) {
2210+
PrintDetails(" RETAIN");
2211+
flags &= ~WASM_SEGMENT_FLAG_RETAIN;
2212+
}
22092213
if (flags != 0) {
22102214
PrintDetails(" unknown_flags=%#x", flags);
22112215
}

test/binary/linking-section.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ section("linking") {
5151
metadata_version[2]
5252

5353
section(LINKING_SEGMENT_INFO) {
54-
count[2]
54+
count[3]
5555
str("data1")
5656
p2align[2]
5757
flags[1]
5858
str("data2")
5959
p2align[3]
6060
flags[10]
61+
str("data3")
62+
p2align[2]
63+
flags[4]
6164
}
6265

6366
section(LINKING_INIT_FUNCTIONS) {
@@ -153,9 +156,10 @@ Data[2]:
153156
- 000000a: 6261 72 bar
154157
Custom:
155158
- name: "linking"
156-
- segment info [count=2]
159+
- segment info [count=3]
157160
- 0: data1 p2align=2 [ STRINGS ]
158161
- 1: data2 p2align=3 [ TLS unknown_flags=0x8 ]
162+
- 2: data3 p2align=2 [ RETAIN ]
159163
- init functions [count=2]
160164
- 1: priority=5 <global_sym>
161165
- 0: priority=6 <func_sym>

0 commit comments

Comments
 (0)