llvm-project/lld/test/COFF/start-lib-cmd-diagnostics.ll
Bob Haarman 7dc5e7a0a4 reland "[lld-link] implement -start-lib and -end-lib"
Summary:
This is a re-land of r370487 with a fix for the use-after-free bug
that rev contained.

This implements -start-lib and -end-lib flags for lld-link, analogous
to the similarly named options in ld.lld. Object files after
-start-lib are included in the link only when needed to resolve
undefined symbols. The -end-lib flag goes back to the normal behavior
of always including object files in the link. This mimics the
semantics of static libraries, but without needing to actually create
the archive file.

Reviewers: ruiu, smeenai, MaskRay

Reviewed By: ruiu, MaskRay

Subscribers: akhuang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66848

llvm-svn: 370816
2019-09-03 20:32:16 +00:00

20 lines
509 B
LLVM

; REQUIRES: x86
;
; We need an input file to lld, so create one.
; RUN: llc -filetype=obj %s -o %t.obj
; RUN: not lld-link %t.obj -end-lib 2>&1 \
; RUN: | FileCheck --check-prefix=STRAY_END %s
; STRAY_END: stray -end-lib
; RUN: not lld-link -start-lib -start-lib %t.obj 2>&1 \
; RUN: | FileCheck --check-prefix=NESTED_START %s
; NESTED_START: nested -start-lib
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
define void @main() {
ret void
}