llvm-project/lld/test/wasm/ctor-gc.test
Sam Clegg b3b4cda104 [lld][WebAssembly] Don't GC library objects under --whole-archive
Followup on https://reviews.llvm.org/D85062 which ignores
entire library objects when no symbols are used within them.
This is shouldn't apply with `--whole-archive` since this
is specified to treat them like direct object inputs.

Differential Revision: https://reviews.llvm.org/D89290
2020-10-12 21:19:19 -07:00

17 lines
782 B
Plaintext

; Verify that constructors from a .o file which it initially depends on but
; doesn't ultimately contribute to the final link are not included.
;
; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ctor-ctor.s -o %t.ctor.o
; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ctor-lib.s -o %t.lib.o
; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/ctor-start.s -o %t.start.o
; RUN: rm -f %t.lib.a
; RUN: llvm-ar rcs %t.lib.a %t.lib.o %t.ctor.o
; RUN: wasm-ld %t.start.o %t.lib.a -o %t.wasm
; RUN: wasm-ld %t.start.o --whole-archive %t.lib.a -o %t2.wasm
; RUN: obj2yaml %t.wasm | FileCheck %s
; RUN: obj2yaml %t2.wasm | FileCheck %s -check-prefix=WHOLEARCHIVE
; CHECK-NOT: __wasm_call_ctors
; WHOLEARCHIVE: __wasm_call_ctors