Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lld/test/wasm/archive-export.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ CHECK: Exports:
CHECK-NEXT: - Name: memory
CHECK-NEXT: Kind: MEMORY
CHECK-NEXT: Index: 0
CHECK-NEXT: - Name: __stack_pointer
CHECK-NEXT: Kind: GLOBAL
CHECK-NEXT: Index: 0
CHECK-NEXT: - Name: foo
CHECK-NEXT: Kind: FUNCTION
CHECK-NEXT: Index: 1
Expand Down
3 changes: 3 additions & 0 deletions lld/test/wasm/comdats.ll
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ entry:
; CHECK-NEXT: - Name: memory
; CHECK-NEXT: Kind: MEMORY
; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: __stack_pointer
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: _start
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 1
Expand Down
3 changes: 3 additions & 0 deletions lld/test/wasm/visibility-hidden.ll
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ entry:
; CHECK-NEXT: - Name: memory
; CHECK-NEXT: Kind: MEMORY
; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: __stack_pointer
; CHECK-NEXT: Kind: GLOBAL
; CHECK-NEXT: Index: 0
; CHECK-NEXT: - Name: objectDefault
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: Index: 1
Expand Down
15 changes: 10 additions & 5 deletions lld/wasm/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,10 @@ static InputGlobal *createGlobal(StringRef name, bool isMutable) {
return make<InputGlobal>(wasmGlobal, nullptr);
}

static GlobalSymbol *createGlobalVariable(StringRef name, bool isMutable) {
static GlobalSymbol *createGlobalVariable(StringRef name, bool isMutable,
uint32_t flags = 0) {
InputGlobal *g = createGlobal(name, isMutable);
return symtab->addSyntheticGlobal(name, WASM_SYMBOL_VISIBILITY_HIDDEN, g);
return symtab->addSyntheticGlobal(name, flags, g);
}

static GlobalSymbol *createOptionalGlobal(StringRef name, bool isMutable) {
Expand Down Expand Up @@ -966,9 +967,13 @@ static void createSyntheticSymbols() {
}

if (ctx.arg.sharedMemory) {
ctx.sym.tlsBase = createGlobalVariable("__tls_base", true);
ctx.sym.tlsSize = createGlobalVariable("__tls_size", false);
ctx.sym.tlsAlign = createGlobalVariable("__tls_align", false);
// TLS symbols are all hidden/dso-local
ctx.sym.tlsBase =
createGlobalVariable("__tls_base", true, WASM_SYMBOL_VISIBILITY_HIDDEN);
ctx.sym.tlsSize = createGlobalVariable("__tls_size", false,
WASM_SYMBOL_VISIBILITY_HIDDEN);
ctx.sym.tlsAlign = createGlobalVariable("__tls_align", false,
WASM_SYMBOL_VISIBILITY_HIDDEN);
ctx.sym.initTLS = symtab->addSyntheticFunction(
"__wasm_init_tls", WASM_SYMBOL_VISIBILITY_HIDDEN,
make<SyntheticFunction>(is64 ? i64ArgSignature : i32ArgSignature,
Expand Down