This is an archive of the discontinued LLVM Phabricator instance.

[lld][ELF][COFF] Fix archived bitcode files naming
ClosedPublic

Authored by evgeny777 on Mar 1 2020, 7:00 AM.

Details

Summary

This makes LTO -save-temps usable when archive contains full path to file.

Diff Detail

Event Timeline

evgeny777 created this revision.Mar 1 2020, 7:00 AM
MaskRay added inline comments.Mar 1 2020, 12:30 PM
lld/test/ELF/lto/thinlto.ll
26

Enhance the test to check one of the produced temporary files.

; 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'

The last line makes it clear the indented filename.

For the title:

Fix archived bitcode files naming

Suggested: Support -save-temps for thin archives.

The thin archive is a GNU extension. Otherwise there is no POSIX requirement to support a full path for a member. So this is not a bug.

Suggested: Support -save-temps for thin archives.

Windows libraries are not thin archives, but still contain full paths to member objects. Without this patch /lldsavetemps is almost unusable for thin LTO clang/LLVM builds on Windows.

evgeny777 updated this revision to Diff 247809.Mar 3 2020, 12:17 AM

Added check for temp file

MaskRay accepted this revision.Mar 3 2020, 8:28 AM
This revision is now accepted and ready to land.Mar 3 2020, 8:28 AM
This revision was automatically updated to reflect the committed changes.