summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2024-03-12 01:51:30 +0900
committerGitHub <noreply@github.com>2024-03-11 16:51:30 +0000
commitbfcd0a10864e7e70b7aaad59141dffb9d29f05fe (patch)
treef5549587454426dd3d102ec9cf2f898a61f02257
parent1471dffee8bf9939044b80d34256956a28138e96 (diff)
downloadwabt-bfcd0a10864e7e70b7aaad59141dffb9d29f05fe.tar.gz
wabt-bfcd0a10864e7e70b7aaad59141dffb9d29f05fe.tar.bz2
wabt-bfcd0a10864e7e70b7aaad59141dffb9d29f05fe.zip
Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (#2399)
See https://github.com/llvm/llvm-project/pull/81539
-rw-r--r--include/wabt/common.h1
-rw-r--r--src/binary-reader-objdump.cc4
-rw-r--r--test/binary/linking-section.txt8
3 files changed, 11 insertions, 2 deletions
diff --git a/include/wabt/common.h b/include/wabt/common.h
index 4a26a166..f44ad25e 100644
--- a/include/wabt/common.h
+++ b/include/wabt/common.h
@@ -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 {
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 488ff1d2..c3be4562 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -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);
}
diff --git a/test/binary/linking-section.txt b/test/binary/linking-section.txt
index 3ba79895..a530f1c2 100644
--- a/test/binary/linking-section.txt
+++ b/test/binary/linking-section.txt
@@ -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) {
@@ -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>