2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj -o %t.o %s
|
2020-05-21 12:35:18 +08:00
|
|
|
; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/hidden.s -o %t2.o
|
2018-08-02 19:33:54 +08:00
|
|
|
; RUN: rm -f %t2.a
|
2017-12-03 10:38:04 +08:00
|
|
|
; RUN: llvm-ar rcs %t2.a %t2.o
|
|
|
|
|
2020-04-02 00:21:08 +08:00
|
|
|
; Test that symbols with hidden visibility are not export, even with
|
2018-09-28 05:06:25 +08:00
|
|
|
; --export-dynamic
|
|
|
|
; RUN: wasm-ld --export-dynamic %t.o %t2.a -o %t.wasm
|
2018-09-26 05:50:15 +08:00
|
|
|
; RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
|
2020-04-02 00:21:08 +08:00
|
|
|
; Test that symbols with default visibility are not exported without
|
2018-09-28 05:06:25 +08:00
|
|
|
; --export-dynamic
|
|
|
|
; RUN: wasm-ld %t.o %t2.a -o %t.nodef.wasm
|
2018-09-26 05:50:15 +08:00
|
|
|
; RUN: obj2yaml %t.nodef.wasm | FileCheck %s -check-prefix=NO-DEFAULT
|
|
|
|
|
2017-12-03 10:38:04 +08:00
|
|
|
|
2018-05-11 01:59:41 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2018-01-24 11:29:47 +08:00
|
|
|
|
2017-12-03 10:38:04 +08:00
|
|
|
define hidden i32 @objectHidden() {
|
|
|
|
entry:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @objectDefault() {
|
|
|
|
entry:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @archiveHidden()
|
|
|
|
declare i32 @archiveDefault()
|
|
|
|
|
2018-02-02 08:30:03 +08:00
|
|
|
define void @_start() {
|
2017-12-03 10:38:04 +08:00
|
|
|
entry:
|
|
|
|
%call1 = call i32 @objectHidden()
|
|
|
|
%call2 = call i32 @objectDefault()
|
|
|
|
%call3 = call i32 @archiveHidden()
|
|
|
|
%call4 = call i32 @archiveDefault()
|
2018-02-02 08:30:03 +08:00
|
|
|
ret void
|
2017-12-03 10:38:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: - Type: EXPORT
|
2017-12-13 04:00:30 +08:00
|
|
|
; CHECK-NEXT: Exports:
|
2017-12-03 10:38:04 +08:00
|
|
|
; CHECK-NEXT: - Name: memory
|
|
|
|
; CHECK-NEXT: Kind: MEMORY
|
|
|
|
; CHECK-NEXT: Index: 0
|
2018-03-01 17:38:02 +08:00
|
|
|
; CHECK-NEXT: - Name: objectDefault
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 1
|
2018-08-04 08:04:06 +08:00
|
|
|
; CHECK-NEXT: - Name: _start
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 2
|
2018-01-19 07:40:49 +08:00
|
|
|
; CHECK-NEXT: - Name: archiveDefault
|
|
|
|
; CHECK-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; CHECK-NEXT: Index: 4
|
2017-12-03 10:38:04 +08:00
|
|
|
; CHECK-NEXT: - Type:
|
2018-09-26 05:50:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
; NO-DEFAULT: - Type: EXPORT
|
|
|
|
; NO-DEFAULT-NEXT: Exports:
|
|
|
|
; NO-DEFAULT-NEXT: - Name: memory
|
|
|
|
; NO-DEFAULT-NEXT: Kind: MEMORY
|
|
|
|
; NO-DEFAULT-NEXT: Index: 0
|
2018-09-28 05:06:25 +08:00
|
|
|
; NO-DEFAULT-NEXT: - Name: _start
|
|
|
|
; NO-DEFAULT-NEXT: Kind: FUNCTION
|
2019-03-02 06:35:47 +08:00
|
|
|
; NO-DEFAULT-NEXT: Index: 2
|
2018-09-26 05:50:15 +08:00
|
|
|
; NO-DEFAULT-NEXT: - Type:
|