llvm-project/lld/test/COFF/pdb-thinlto.ll
Zequan Wu 531ed6d5aa [LTO][COFF] Use bitcode file names in lto native object file names.
Currently the lto native object files have names like main.exe.lto.1.obj. In
PDB, those names are used as names for each compiland. Microsoft’s tool
SizeBench uses those names to present to users the size of each object files.
So, names like main.exe.lto.1.obj is not user friendly.

This patch makes the lto native object file names more readable by using
the bitcode file names as part of the file names. For example, if the input
bitcode file has path like "path/to/foo.obj", its corresponding lto native
object file path would be "path/to/main.exe.lto.foo.obj". Since the lto native
object file name only bothers PDB, this patch only changes the lld-linker's
behavior.

Reviewed By: tejohnson, MaskRay, #lld-macho

Differential Revision: https://reviews.llvm.org/D137217
2022-11-22 10:19:58 -08:00

37 lines
1.2 KiB
LLVM

; REQUIRES: x86
; RUN: rm -rf %t && mkdir -p %t && cd %t
; RUN: opt -thinlto-bc -o main.bc %s
; RUN: opt -thinlto-bc -o foo.bc %S/Inputs/lto-dep.ll
; Even if the native object is cached, the PDB must be the same.
; RUN: rm -rf thinltocachedir && mkdir thinltocachedir
; RUN: lld-link /lldltocache:thinltocachedir /out:main.exe /entry:main /subsystem:console main.bc foo.bc /debug /pdb:main.pdb
; RUN: llvm-pdbutil dump --modules main.pdb | FileCheck %s
; Run again with the cache. Make sure we get the same object names.
; RUN: lld-link /lldltocache:thinltocachedir /out:main.exe /entry:main /subsystem:console main.bc foo.bc /debug /pdb:main.pdb
; RUN: llvm-pdbutil dump --modules main.pdb | FileCheck %s
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
define i32 @main() {
call void @foo()
ret i32 0
}
declare void @foo()
; CHECK: Modules
; CHECK: ============================================================
; CHECK: Mod 0000 | `{{.*}}main.exe.lto.main.bc`:
; CHECK: Obj: `{{.*}}main.exe.lto.main.bc`:
; CHECK: Mod 0001 | `{{.*}}main.exe.lto.foo.bc`:
; CHECK: Obj: `{{.*}}main.exe.lto.foo.bc`:
; CHECK: Mod 0002 | `* Linker *`: