summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-12-14 04:56:42 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-12-14 04:56:42 +0000
commit8e13bc4562c2b921b0bd4e46a1c119f6ddfba07e (patch)
treee7e7d67361279bfebc522363479b781ccfb5c632 /llvm/lib/Support/Unix
parent378b8c8f012bacb85a4057e29a4e6b522842e94d (diff)
downloadbcm5719-llvm-8e13bc4562c2b921b0bd4e46a1c119f6ddfba07e.tar.gz
bcm5719-llvm-8e13bc4562c2b921b0bd4e46a1c119f6ddfba07e.zip
[ThinLTO] Add an API to trigger file-based API for returning objects to the linker
Summary: The motivation is to support better the -object_path_lto option on Darwin. The linker needs to write down the generate object files on disk for later use by lldb or dsymutil (debug info are not present in the final binary). We're moving this into libLTO so that we can be smarter when a cache is enabled and hard-link when possible instead of duplicating the files. Reviewers: tejohnson, deadalnix, pcc Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D27507 llvm-svn: 289631
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 3812c5fb5de..e0b11aaff00 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -285,6 +285,19 @@ std::error_code create_link(const Twine &to, const Twine &from) {
return std::error_code();
}
+std::error_code create_hard_link(const Twine &to, const Twine &from) {
+ // Get arguments.
+ SmallString<128> from_storage;
+ SmallString<128> to_storage;
+ StringRef f = from.toNullTerminatedStringRef(from_storage);
+ StringRef t = to.toNullTerminatedStringRef(to_storage);
+
+ if (::link(t.begin(), f.begin()) == -1)
+ return std::error_code(errno, std::generic_category());
+
+ return std::error_code();
+}
+
std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
OpenPOWER on IntegriCloud