This is an archive of the discontinued LLVM Phabricator instance.

[LTO] onfig::addSaveTemps: clear ResolutionFile upon an error
ClosedPublic

Authored by MaskRay on Mar 1 2020, 12:11 PM.

Details

Summary

Otherwise ld.lld -save-temps will crash when writing to ResolutionFile.

llvm-lto2 -save-temps does not crash because it exits immediately.

Diff Detail

Event Timeline

MaskRay created this revision.Mar 1 2020, 12:11 PM
This revision is now accepted and ready to land.Mar 2 2020, 12:26 AM
This revision was automatically updated to reflect the committed changes.
hoyFB added a subscriber: hoyFB.Mar 3 2020, 1:43 PM
hoyFB added inline comments.
lld/test/ELF/lto/resolution-err.ll
6

The chmod is an issue when the test is run on a server without root access. Do you have an suggestion how to make it work? Thanks.

MaskRay marked an inline comment as done.Mar 3 2020, 2:13 PM
MaskRay added inline comments.
lld/test/ELF/lto/resolution-err.ll
6

Quote https://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html

Only a process whose effective user ID matches the user ID of the file, or a process with appropriate privileges, shall be permitted to change the file mode bits of a file.

The user ID of %t.resolution.txt is the current effective user ID. The current effective user ID can chmod -w the file. See llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test for another example.

Is that not the case on your system?

MaskRay marked an inline comment as done.Mar 3 2020, 2:15 PM
MaskRay added inline comments.
lld/test/ELF/lto/resolution-err.ll
6

Or do you mean with root access?

This is so uncommon that I think maybe you should just disable the test internally.

hoyFB added inline comments.Mar 3 2020, 3:16 PM
lld/test/ELF/lto/resolution-err.ll
6

Thanks for the quick response! Let me take a deeper look into our file system. The test fails on our remote server with ld.lld run printing nothing which basically means the resolution file is either not created or is not write-protected.