-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lld][WebAssembly] Add --keep-section flag
This flag causes wasm-ld preserve a section even in the face of `--strip-all`. This is useful, for example, to preserve the target_features section in the ase of clang (which can run wasm-opt after linking), and emcc (which performs a bunch of post-link work). Fixes: llvm/llvm-project#60613 Fixes: llvm/llvm-project#55781 Differential Revision: https://reviews.llvm.org/D149917
- Loading branch information
Showing
7 changed files
with
73 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.start.o | ||
# RUN: wasm-ld --strip-all -o %t.wasm %t.start.o | ||
# RUN: obj2yaml %t.wasm | FileCheck %s | ||
# | ||
## Test alias -s | ||
# RUN: wasm-ld -s -o %t2.wasm %t.start.o | ||
# RUN: obj2yaml %t2.wasm | FileCheck %s | ||
# | ||
## Check that there is no name section | ||
# CHECK-NOT: Name: name | ||
# CHECK-NOT: Name: target_features | ||
# | ||
## Test --keep-section=name preserver the name section | ||
# RUN: wasm-ld --strip-all --keep-section=name -o %t3.wasm %t.start.o | ||
# RUN: obj2yaml %t3.wasm | FileCheck --check-prefix=CHECK-NAME %s | ||
# | ||
# CHECK-NAME: Name: name | ||
# CHECK-NAME-NOT: Name: target_features | ||
# | ||
## Test --keep-section can be specified more than once | ||
# RUN: wasm-ld --strip-all --keep-section=name --keep-section=target_features -o %t4.wasm %t.start.o | ||
# RUN: obj2yaml %t4.wasm | FileCheck --check-prefix=CHECK-FEATURES %s | ||
# | ||
# CHECK-FEATURES: Name: name | ||
# CHECK-FEATURES: Name: target_features | ||
|
||
.globl _start | ||
_start: | ||
.functype _start () -> () | ||
end_function | ||
|
||
.section .custom_section.target_features,"",@ | ||
.int8 1 | ||
.int8 43 | ||
.int8 15 | ||
.ascii "mutable-globals" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters