Loading lld/COFF/InputFiles.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -905,8 +905,9 @@ BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName, // filename unique. MemoryBufferRef mbref( mb.getBuffer(), saver.save(archiveName + path + (archiveName.empty() ? "" : utostr(offsetInArchive)))); saver.save(archiveName.empty() ? path : archiveName + sys::path::filename(path) + utostr(offsetInArchive))); obj = check(lto::InputFile::create(mbref)); } Loading lld/ELF/InputFiles.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -1418,9 +1418,10 @@ BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName, // into consideration at LTO time (which very likely causes undefined // symbols later in the link stage). So we append file offset to make // filename unique. StringRef name = archiveName.empty() StringRef name = archiveName.empty() ? saver.save(path) : saver.save(archiveName + "(" + path + " at " + : saver.save(archiveName + "(" + path::filename(path) + " at " + utostr(offsetInArchive) + ")"); MemoryBufferRef mbref(mb.getBuffer(), name); Loading lld/test/COFF/thinlto.ll +6 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,12 @@ ; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj ; RUN: llvm-nm %T/thinlto/main.exe1.lto.obj | FileCheck %s ; This command will store full path to foo.obj in the archive %t.lib ; Check that /lldsavetemps is still usable in such case. ; RUN: lld-link /lib %T/thinlto/foo.obj /out:%t.lib ; RUN: lld-link /lldsavetemps /out:%t.exe /entry:main /subsystem:console %T/thinlto/main.obj %t.lib ; RUN: ls '%t.libfoo.obj230.0.preopt.bc' ; CHECK-NOT: U foo target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" Loading lld/test/ELF/lto/thinlto.ll +8 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,14 @@ ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 ; Check that -save-temps is usable with thin archives ; RUN: rm -fr %t.dir ; RUN: mkdir -p %t.dir ; RUN: cp %t2.o %t.dir/t.o ; RUN: llvm-ar rcsT %t.dir/t.a %t.dir/t.o ; RUN: ld.lld -save-temps %t1.o %t.dir/t.a -o - > /dev/null ; RUN: ls '%t.dir/t.a(t.o at 0).0.preopt.bc' ; NM1: T f ; NM2: T g Loading Loading
lld/COFF/InputFiles.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -905,8 +905,9 @@ BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName, // filename unique. MemoryBufferRef mbref( mb.getBuffer(), saver.save(archiveName + path + (archiveName.empty() ? "" : utostr(offsetInArchive)))); saver.save(archiveName.empty() ? path : archiveName + sys::path::filename(path) + utostr(offsetInArchive))); obj = check(lto::InputFile::create(mbref)); } Loading
lld/ELF/InputFiles.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -1418,9 +1418,10 @@ BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName, // into consideration at LTO time (which very likely causes undefined // symbols later in the link stage). So we append file offset to make // filename unique. StringRef name = archiveName.empty() StringRef name = archiveName.empty() ? saver.save(path) : saver.save(archiveName + "(" + path + " at " + : saver.save(archiveName + "(" + path::filename(path) + " at " + utostr(offsetInArchive) + ")"); MemoryBufferRef mbref(mb.getBuffer(), name); Loading
lld/test/COFF/thinlto.ll +6 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,12 @@ ; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj ; RUN: llvm-nm %T/thinlto/main.exe1.lto.obj | FileCheck %s ; This command will store full path to foo.obj in the archive %t.lib ; Check that /lldsavetemps is still usable in such case. ; RUN: lld-link /lib %T/thinlto/foo.obj /out:%t.lib ; RUN: lld-link /lldsavetemps /out:%t.exe /entry:main /subsystem:console %T/thinlto/main.obj %t.lib ; RUN: ls '%t.libfoo.obj230.0.preopt.bc' ; CHECK-NOT: U foo target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" Loading
lld/test/ELF/lto/thinlto.ll +8 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,14 @@ ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 ; Check that -save-temps is usable with thin archives ; RUN: rm -fr %t.dir ; RUN: mkdir -p %t.dir ; RUN: cp %t2.o %t.dir/t.o ; RUN: llvm-ar rcsT %t.dir/t.a %t.dir/t.o ; RUN: ld.lld -save-temps %t1.o %t.dir/t.a -o - > /dev/null ; RUN: ls '%t.dir/t.a(t.o at 0).0.preopt.bc' ; NM1: T f ; NM2: T g Loading