Skip to content

Add custom section sample and enable CI test#4891

Open
TianlongLiang wants to merge 2 commits intobytecodealliance:mainfrom
TianlongLiang:dev/add_custom_section_sample
Open

Add custom section sample and enable CI test#4891
TianlongLiang wants to merge 2 commits intobytecodealliance:mainfrom
TianlongLiang:dev/add_custom_section_sample

Conversation

@TianlongLiang
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new custom-section sample demonstrating embedding an external payload into a Wasm custom section and retrieving/printing it from the host via wasm_runtime_get_custom_section, and wires the sample into CI so it’s built and executed (Wasm + AoT).

Changes:

  • Add a new samples/custom-section sample (host app + wasm app + build/run scripts) for custom-section payload resolution via handle-based native APIs.
  • Add documentation entries for the new sample.
  • Update multiple GitHub Actions workflows to build/run the sample in CI, including AoT builds that preserve the custom section.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
samples/custom-section/wasm-apps/custom_section_payload.s Defines a .custom_section.demo section and includes an external payload via .incbin.
samples/custom-section/wasm-apps/custom_section_payload.bin Sample payload content to embed into the Wasm custom section.
samples/custom-section/wasm-apps/custom_section.c Wasm-side demo entrypoint importing host APIs to resolve and print the custom section.
samples/custom-section/src/native_impl.c Host native implementations to resolve a section name to a handle and print its bytes.
samples/custom-section/src/main.c Host executable wiring runtime init, loading the Wasm module, and calling run_demo.
samples/custom-section/run.sh Helper script to run the sample (Wasm or AoT).
samples/custom-section/build.sh Builds the host app + Wasm module and optionally an AoT artifact preserving custom sections.
samples/custom-section/README.md Sample documentation and usage instructions.
samples/custom-section/CMakeLists.txt CMake project definition enabling WAMR_BUILD_LOAD_CUSTOM_SECTION.
samples/custom-section/.gitignore Ignores the sample’s out/ directory.
samples/README.md Adds the new sample to the samples index.
.github/workflows/nightly_run.yml Builds/runs the new sample (Wasm + AoT) in nightly CI.
.github/workflows/compilation_on_macos.yml Builds/runs the new sample (Wasm + AoT) in macOS CI.
.github/workflows/compilation_on_android_ubuntu.yml Builds/runs the new sample (Wasm + AoT) in Android-on-Ubuntu CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,2 @@
.section .custom_section.demo,"",@
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .section directive looks syntactically incomplete: .section .custom_section.demo,"",@ ends with @ but no section type. With clang/LLVM integrated assembler this is likely to error out or create an unexpected section. Specify an explicit section type (and any required flags) so the payload reliably lands in a .custom_section.demo section across toolchains.

Suggested change
.section .custom_section.demo,"",@
.section .custom_section.demo,"",@progbits

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Wasm assembler requires the three-part .section
name,"flags",@ syntax but doesn't accept any ELF section type after the @.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants