summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/binary-reader-objdump.c10
-rw-r--r--src/binary-reader.c34
-rw-r--r--src/binary-reader.h10
-rw-r--r--src/binary-writer.c12
-rw-r--r--src/binary.h2
-rw-r--r--test/binary/user-section.txt12
-rw-r--r--test/dump/debug-import-names.txt6
-rw-r--r--test/dump/debug-names.txt6
8 files changed, 46 insertions, 46 deletions
diff --git a/src/binary-reader-objdump.c b/src/binary-reader-objdump.c
index 993fbbd6..3da697fd 100644
--- a/src/binary-reader-objdump.c
+++ b/src/binary-reader-objdump.c
@@ -97,11 +97,11 @@ static WasmResult begin_section(Context* ctx,
return WASM_OK;
}
-static WasmResult begin_user_section(WasmBinaryReaderContext* ctx,
- uint32_t size,
- WasmStringSlice section_name) {
+static WasmResult begin_custom_section(WasmBinaryReaderContext* ctx,
+ uint32_t size,
+ WasmStringSlice section_name) {
Context* context = ctx->user_data;
- if (begin_section(context, "USER", ctx->offset, size))
+ if (begin_section(context, "CUSTOM", ctx->offset, size))
return WASM_ERROR;
if (context->options->mode == WASM_DUMP_DETAILS)
printf(" - name: \"" PRIstringslice "\"\n", WASM_PRINTF_STRING_SLICE_ARG(section_name));
@@ -583,7 +583,7 @@ static WasmBinaryReader s_binary_reader = {
.on_error = on_error,
// User section
- .begin_user_section = begin_user_section,
+ .begin_custom_section = begin_custom_section,
// Signature section
.begin_signature_section = begin_signature_section,
diff --git a/src/binary-reader.c b/src/binary-reader.c
index d102ec08..613b2feb 100644
--- a/src/binary-reader.c
+++ b/src/binary-reader.c
@@ -410,10 +410,10 @@ static uint32_t num_total_globals(Context* ctx) {
return ctx->num_global_imports + ctx->num_globals;
}
-static void handle_user_section(Context* ctx,
- WasmStringSlice* section_name,
- uint32_t section_size) {
- CALLBACK_CTX(begin_user_section, section_size, *section_name);
+static void handle_custom_section(Context* ctx,
+ WasmStringSlice* section_name,
+ uint32_t section_size) {
+ CALLBACK_CTX(begin_custom_section, section_size, *section_name);
if (ctx->options->read_debug_names && ctx->name_section_ok &&
strncmp(section_name->start, WASM_BINARY_SECTION_NAME,
section_name->length) == 0) {
@@ -440,7 +440,7 @@ static void handle_user_section(Context* ctx,
}
CALLBACK0(end_names_section);
}
- CALLBACK_CTX0(end_user_section);
+ CALLBACK_CTX0(end_custom_section);
}
static WasmBool skip_until_section(Context* ctx,
@@ -464,10 +464,10 @@ static WasmBool skip_until_section(Context* ctx,
if (ctx->section_end > ctx->data_size)
RAISE_ERROR("invalid section size: extends past end");
- if (section_code == WASM_BINARY_SECTION_USER) {
+ if (section_code == WASM_BINARY_SECTION_CUSTOM) {
WasmStringSlice section_name;
in_str(ctx, &section_name, "section name");
- handle_user_section(ctx, &section_name, *section_size);
+ handle_custom_section(ctx, &section_name, *section_size);
ctx->offset = ctx->section_end;
return skip_until_section(ctx, expected_code, section_size);
} else {
@@ -539,14 +539,14 @@ static void logging_on_error(WasmBinaryReaderContext* ctx,
}
}
-static WasmResult logging_begin_user_section(WasmBinaryReaderContext* context,
- uint32_t size,
- WasmStringSlice section_name) {
+static WasmResult logging_begin_custom_section(WasmBinaryReaderContext* context,
+ uint32_t size,
+ WasmStringSlice section_name) {
LoggingContext* ctx = context->user_data;
- LOGF("begin_user_section: '" PRIstringslice "' size=%d\n",
+ LOGF("begin_custom_section: '" PRIstringslice "' size=%d\n",
WASM_PRINTF_STRING_SLICE_ARG(section_name), size);
indent(ctx);
- FORWARD_CTX(begin_user_section, size, section_name);
+ FORWARD_CTX(begin_custom_section, size, section_name);
}
#define LOGGING_BEGIN(name) \
@@ -604,7 +604,7 @@ static WasmResult logging_begin_user_section(WasmBinaryReaderContext* context,
LOGGING_UINT32(begin_module)
LOGGING0(end_module)
-LOGGING_END(user_section)
+LOGGING_END(custom_section)
LOGGING_BEGIN(signature_section)
LOGGING_UINT32(on_signature_count)
LOGGING_END(signature_section)
@@ -1024,8 +1024,8 @@ static WasmBinaryReader s_logging_binary_reader = {
.begin_module = logging_begin_module,
.end_module = logging_end_module,
- .begin_user_section = logging_begin_user_section,
- .end_user_section = logging_end_user_section,
+ .begin_custom_section = logging_begin_custom_section,
+ .end_custom_section = logging_end_custom_section,
.begin_signature_section = logging_begin_signature_section,
.on_signature_count = logging_on_signature_count,
@@ -2060,8 +2060,8 @@ WasmResult wasm_read_binary(WasmAllocator* allocator,
CALLBACK_CTX0(end_data_section);
}
- /* Handle supported unnamed sections at the end. */
- skip_until_section(ctx, WASM_BINARY_SECTION_USER, &section_size);
+ /* Handle supported custom sections at the end. */
+ skip_until_section(ctx, WASM_BINARY_SECTION_CUSTOM, &section_size);
CALLBACK0(end_module);
destroy_context(allocator, ctx);
diff --git a/src/binary-reader.h b/src/binary-reader.h
index bf928d61..e51c0f01 100644
--- a/src/binary-reader.h
+++ b/src/binary-reader.h
@@ -49,11 +49,11 @@ typedef struct WasmBinaryReader {
WasmResult (*begin_module)(uint32_t version, void* user_data);
WasmResult (*end_module)(void* user_data);
- /* user section */
- WasmResult (*begin_user_section)(WasmBinaryReaderContext* ctx,
- uint32_t size,
- WasmStringSlice section_name);
- WasmResult (*end_user_section)(WasmBinaryReaderContext* ctx);
+ /* custom section */
+ WasmResult (*begin_custom_section)(WasmBinaryReaderContext* ctx,
+ uint32_t size,
+ WasmStringSlice section_name);
+ WasmResult (*end_custom_section)(WasmBinaryReaderContext* ctx);
/* signatures section */
/* TODO(binji): rename to "type" section */
diff --git a/src/binary-writer.c b/src/binary-writer.c
index d64dc734..c71ea75a 100644
--- a/src/binary-writer.c
+++ b/src/binary-writer.c
@@ -236,19 +236,19 @@ static void begin_known_section(Context* ctx,
write_u32_leb128_space(ctx, leb_size_guess, "section size (guess)");
}
-static void begin_user_section(Context* ctx,
- const char* name,
- size_t leb_size_guess) {
+static void begin_custom_section(Context* ctx,
+ const char* name,
+ size_t leb_size_guess) {
assert(ctx->last_section_leb_size_guess == 0);
char desc[100];
wasm_snprintf(desc, sizeof(desc), "section \"%s\"", name);
write_header(ctx, desc, PRINT_HEADER_NO_INDEX);
- wasm_write_u8(&ctx->stream, WASM_BINARY_SECTION_USER, "user section code");
+ wasm_write_u8(&ctx->stream, WASM_BINARY_SECTION_CUSTOM, "custom section code");
ctx->last_section_leb_size_guess = leb_size_guess;
ctx->last_section_offset =
write_u32_leb128_space(ctx, leb_size_guess, "section size (guess)");
write_str(&ctx->stream, name, strlen(name), WASM_PRINT_CHARS,
- "user section name");
+ "custom section name");
}
static void end_section(Context* ctx) {
@@ -788,7 +788,7 @@ static void write_module(Context* ctx, const WasmModule* module) {
WASM_ZERO_MEMORY(index_to_name);
char desc[100];
- begin_user_section(ctx, WASM_BINARY_SECTION_NAME, leb_size_guess);
+ begin_custom_section(ctx, WASM_BINARY_SECTION_NAME, leb_size_guess);
write_u32_leb128(&ctx->stream, module->funcs.size, "num functions");
for (i = 0; i < module->funcs.size; ++i) {
const WasmFunc* func = module->funcs.data[i];
diff --git a/src/binary.h b/src/binary.h
index 3d051837..632cd3e0 100644
--- a/src/binary.h
+++ b/src/binary.h
@@ -24,7 +24,7 @@
#define WASM_BINARY_SECTION_NAME "name"
#define WASM_FOREACH_BINARY_SECTION(V) \
- V(USER, 0) \
+ V(CUSTOM, 0) \
V(TYPE, 1) \
V(IMPORT, 2) \
V(FUNCTION, 3) \
diff --git a/test/binary/user-section.txt b/test/binary/user-section.txt
index ce0d1185..e8351d2f 100644
--- a/test/binary/user-section.txt
+++ b/test/binary/user-section.txt
@@ -8,16 +8,16 @@ section("bar") { count[5] }
section("foo") { count[6] }
(;; STDOUT ;;;
begin_module(13)
-begin_user_section: 'foo' size=5
-end_user_section
+begin_custom_section: 'foo' size=5
+end_custom_section
begin_signature_section
on_signature_count(1)
on_signature(index: 0, params: [], results: [i32])
end_signature_section
-begin_user_section: 'bar' size=5
-end_user_section
-begin_user_section: 'foo' size=5
-end_user_section
+begin_custom_section: 'bar' size=5
+end_custom_section
+begin_custom_section: 'foo' size=5
+end_custom_section
end_module
(module
(type (;0;) (func (result i32))))
diff --git a/test/dump/debug-import-names.txt b/test/dump/debug-import-names.txt
index af0aead7..87ba712b 100644
--- a/test/dump/debug-import-names.txt
+++ b/test/dump/debug-import-names.txt
@@ -27,10 +27,10 @@
000001a: 00 ; import signature index
000000f: 0b ; FIXUP section size
; section "name"
-000001b: 00 ; user section code
+000001b: 00 ; custom section code
000001c: 00 ; section size (guess)
000001d: 04 ; string length
-000001e: 6e61 6d65 name ; user section name
+000001e: 6e61 6d65 name ; custom section name
0000022: 01 ; num functions
0000023: 04 ; string length
0000024: 2466 6f6f $foo ; func name 0
@@ -41,7 +41,7 @@ debug-import-names.wasm: file format wasm 0x00000d
Sections:
TYPE start=0x0000000a end=0x0000000e (size=0x00000004) count: 1
IMPORT start=0x00000010 end=0x0000001b (size=0x0000000b) count: 1
- USER start=0x00000022 end=0x0000002e (size=0x0000000c) "name"
+ CUSTOM start=0x00000022 end=0x0000002e (size=0x0000000c) "name"
Code Disassembly:
;;; STDOUT ;;)
diff --git a/test/dump/debug-names.txt b/test/dump/debug-names.txt
index fd860550..053c24b7 100644
--- a/test/dump/debug-names.txt
+++ b/test/dump/debug-names.txt
@@ -59,10 +59,10 @@
0000022: 06 ; FIXUP func body size
0000019: 0f ; FIXUP section size
; section "name"
-0000029: 00 ; user section code
+0000029: 00 ; custom section code
000002a: 00 ; section size (guess)
000002b: 04 ; string length
-000002c: 6e61 6d65 name ; user section name
+000002c: 6e61 6d65 name ; custom section name
0000030: 02 ; num functions
0000031: 03 ; string length
0000032: 2446 31 $F1 ; func name 0
@@ -97,7 +97,7 @@ FUNCTION:
CODE:
- func 0
- func 1
-USER:
+CUSTOM:
- name: "name"
- func[0] $F1
- local[0] $F1P0