# REQUIRES: x86 # Unsupported on Windows due to maximum path length limitations. # UNSUPPORTED: system-windows # RUN: rm -rf %t.dir # RUN: split-file %s %t.dir # RUN: yaml2obj %p/Inputs/hello32.yaml -o %t.obj # RUN: llvm-mc -filetype=obj -triple=i386-windows %t.dir/drectve.s -o %t.dir/drectve.obj # RUN: echo '_main@0' > %t.order # RUN: touch %t.def # RUN: touch %t.cg Test link.exe-style /linkrepro: flag. # RUN: mkdir -p %t.dir/build1 # RUN: cd %t.dir/build1 # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. /out:%t.exe # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt Test lld-style /reproduce: flag. # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \ # RUN: /entry:main@0 /reproduce:repro2.tar /out:%t.exe # RUN: tar xf repro2.tar # RUN: diff %t.obj repro2/%:t.obj # RUN: diff %p/Inputs/std32.lib repro2/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP < repro2/response.txt Test LLD_REPRODUCE env var. # RUN: mkdir -p %t.dir/build2 # RUN: cd %t.dir/build2 # RUN: env LLD_REPRODUCE=repro.tar lld-link %t.obj %p/Inputs/std32.lib \ # RUN: /subsystem:console /entry:main@0 /out:%t.exe # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP < repro/response.txt Test adding .lib files with /libpath: to repro archive, and various other flags. # RUN: mkdir -p %t.dir/build3 # RUN: cd %t.dir/build3 # RUN: lld-link %t.obj /libpath:%p/Inputs /defaultlib:std32 /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. /out:%t.exe /order:@%t.order /def:%t.def # RUN: tar tf repro.tar | FileCheck --check-prefix=LIST %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.order repro/%:t.order # RUN: diff %t.def repro/%:t.def # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP-DEFAULTLIB < repro/response.txt # RUN: cd repro; lld-link @response.txt Test adding .lib files with LIB env var to repro archive, and various other flags. # RUN: mkdir -p %t.dir/build4 # RUN: cd %t.dir/build4 # RUN: env LIB=%p/Inputs lld-link %t.obj /defaultlib:std32 /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. /out:%t.exe /order:@%t.order /def:%t.def # RUN: tar tf repro.tar | FileCheck --check-prefix=LIST %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.order repro/%:t.order # RUN: diff %t.def repro/%:t.def # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP-DEFAULTLIB < repro/response.txt # RUN: cd repro; lld-link @response.txt # LIST: .obj # LIST: std32.lib # LIST: response.txt # LIST: .def # LIST: .order # RSP: linkrepro.test.tmp.obj # RSP: std32.lib # RSP: /subsystem:console # RSP: /entry:main@0 # RSP: /out: # RSP-NOT: /order:@/ # RSP-NOT: /def:/ # RSP-DEFAULTLIB: linkrepro.test.tmp.obj # RSP-DEFAULTLIB: /defaultlib:std32 # RSP-DEFAULTLIB: /subsystem:console # RSP-DEFAULTLIB: /entry:main@0 # RSP-DEFAULTLIB: /out: # RSP-DEFAULTLIB-NOT: /order:@/ # RSP-DEFAULTLIB-NOT: /def:/ Test /call-graph-ordering-file (can't be used with /order:, needs separate test) # RUN: mkdir -p %t.dir/build5 # RUN: cd %t.dir/build5 # RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. /out:%t.exe /call-graph-ordering-file:%t.cg # RUN: tar tf repro.tar | FileCheck --check-prefix=LISTCG %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.cg repro/%:t.cg # RUN: FileCheck %s --check-prefix=RSPCG < repro/response.txt # RUN: cd repro; lld-link @response.txt # LISTCG: .obj # LISTCG: response.txt # LISTCG: .cg # RSPCG-NOT: /call-graph-ordering-file:/ Test /defaultlib: from a .drectve section # RUN: mkdir -p %t.dir/build6 # RUN: cd %t.dir/build6 # RUN: lld-link %t.obj %t.dir/drectve.obj /libpath:%p/Inputs /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. -safeseh:no /out:%t.exe /order:@%t.order /def:%t.def # RUN: tar tf repro.tar | FileCheck --check-prefix=LIST %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.order repro/%:t.order # RUN: diff %t.def repro/%:t.def # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP-DRECTVE < repro/response.txt # RUN: cd repro; lld-link @response.txt # RSP-DRECTVE: linkrepro.test.tmp.obj # RSP-DRECTVE: drectve.obj # RSP-DRECTVE: /subsystem:console # RSP-DRECTVE: /entry:main@0 # RSP-DRECTVE: -safeseh:no # RSP-DRECTVE: /out: Test /wholearchive: with /linkrepro: # RUN: llvm-mc -filetype=obj -triple=i386-windows %t.dir/archive.s -o %t.dir/archive.obj # RUN: rm -f %t.dir/build7/archive.lib # RUN: llvm-ar rcs %t.dir/archive.lib %t.dir/archive.obj # RUN: mkdir -p %t.dir/build7 # RUN: cd %t.dir/build7 RUN: lld-link %t.obj /defaultlib:std32 /libpath:%p/Inputs /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. -safeseh:no /wholearchive:%t.dir/archive.lib \ # RUN: /out:%t.exe /order:@%t.order /def:%t.def # RUN: tar tf repro.tar | FileCheck --check-prefix=LIST %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.order repro/%:t.order # RUN: diff %t.def repro/%:t.def # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP-WHOLEARCHIVE < repro/response.txt # RUN: cd repro; lld-link @response.txt # RSP-WHOLEARCHIVE: linkrepro.test.tmp.obj # RSP-WHOLEARCHIVE: /defaultlib:std32 # RSP-WHOLEARCHIVE: /subsystem:console # RSP-WHOLEARCHIVE: /entry:main@0 # RSP-WHOLEARCHIVE: -safeseh:no # RSP-WHOLEARCHIVE: /wholearchive:{{.*}}archive.lib # RSP-WHOLEARCHIVE: /out: Test /start-lib / /end-lib with /linkrepro: # RUN: mkdir -p %t.dir/build8 # RUN: cd %t.dir/build8 # RUN: lld-link %t.obj /defaultlib:std32 /libpath:%p/Inputs /subsystem:console \ # RUN: /entry:main@0 /linkrepro:. -safeseh:no /start-lib %t.dir/drectve.obj /end-lib \ # RUN: /out:%t.exe /order:@%t.order /def:%t.def # RUN: tar tf repro.tar | FileCheck --check-prefix=LIST %s # RUN: tar xf repro.tar # RUN: diff %t.obj repro/%:t.obj # RUN: diff %t.order repro/%:t.order # RUN: diff %t.def repro/%:t.def # RUN: diff %p/Inputs/std32.lib repro/%:p/Inputs/std32.lib # RUN: FileCheck %s --check-prefix=RSP-STARTLIB < repro/response.txt # RUN: cd repro; lld-link @response.txt # RSP-STARTLIB: linkrepro.test.tmp.obj # RSP-STARTLIB: /defaultlib:std32 # RSP-STARTLIB: /subsystem:console # RSP-STARTLIB: /entry:main@0 # RSP-STARTLIB: -safeseh:no # RSP-STARTLIB: /start-lib # RSP-STARTLIB-NEXT: drectve.obj # RSP-STARTLIB-NEXT: /end-lib # RSP-STARTLIB: /out: #--- drectve.s .section .drectve, "yn" .ascii "/defaultlib:std32" #--- archive.s .text .intel_syntax noprefix .globl exportfn3 .p2align 4 exportfn3: ret .section .drectve,"yni" .ascii " /EXPORT:exportfn3"