-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lld][WebAssembly] Initial support for stub libraries
See the docs in lld/docs/WebAssembly.rst for more on this. This feature unlocks a lot of simplification in the emscripten toolchain since we can represent the JS libraries to wasm-ld as stub libraries. See emscripten-core/emscripten#18875 Differential Revision: https://reviews.llvm.org/D145308
- Loading branch information
Showing
14 changed files
with
224 additions
and
5 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,2 @@ | ||
#STUB | ||
foo: missing_dep,missing_dep2 |
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,3 @@ | ||
#STUB | ||
# Symbol `foo` is missing from this file which causes stub_object.s to fail | ||
bar |
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,5 @@ | ||
#STUB | ||
# This is a comment | ||
foo: foodep1,foodep2 | ||
# This symbols as no dependencies | ||
bar |
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,48 @@ | ||
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s | ||
# RUN: wasm-ld %t.o %p/Inputs/libstub.so -o %t.wasm | ||
# RUN: obj2yaml %t.wasm | FileCheck %s | ||
|
||
# When the dependencies are missing the link fails | ||
# RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-dep.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-DEP %s | ||
|
||
# When the dependencies are missing the link fails | ||
# RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-sym.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-SYM %s | ||
|
||
# MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep. Required by foo | ||
# MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep2. Required by foo | ||
|
||
# MISSING-SYM: undefined symbol: foo | ||
|
||
# The function foo is defined in libstub.so but depend on foodep1 and foodep2 | ||
.functype foo () -> () | ||
|
||
.globl foodep1 | ||
foodep1: | ||
.functype foodep1 () -> () | ||
end_function | ||
|
||
.globl foodep2 | ||
foodep2: | ||
.functype foodep2 () -> () | ||
end_function | ||
|
||
.globl _start | ||
_start: | ||
.functype _start () -> () | ||
call foo | ||
end_function | ||
|
||
# CHECK: - Type: EXPORT | ||
# CHECK-NEXT: Exports: | ||
# CHECK-NEXT: - Name: memory | ||
# CHECK-NEXT: Kind: MEMORY | ||
# CHECK-NEXT: Index: 0 | ||
# CHECK-NEXT: - Name: foodep1 | ||
# CHECK-NEXT: Kind: FUNCTION | ||
# CHECK-NEXT: Index: 1 | ||
# CHECK-NEXT: - Name: foodep2 | ||
# CHECK-NEXT: Kind: FUNCTION | ||
# CHECK-NEXT: Index: 2 | ||
# CHECK-NEXT: - Name: _start | ||
# CHECK-NEXT: Kind: FUNCTION | ||
# CHECK-NEXT: Index: 3 |
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
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
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