mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 17:36:36 +00:00

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
20 lines
509 B
LLVM
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
|
|
}
|