[macho] -rpath support

Summary:
Work on adding -rpath support to the mach-o linker.
This patch is based on the ld64 behavior for the command line option validation.

It includes a basic test to check that the LC_RPATH load commands are properly generated when that option is used.

It also add LC_RPATH support to the binary reader, but I don't know how to test it though.


Reviewers: kledzik

Subscribers: llvm-commits

Projects: #lld

Differential Revision: http://reviews.llvm.org/D6724

llvm-svn: 224544
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index b129c03..6cdd74b 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -413,6 +413,10 @@
   _syslibRoots = paths;
 }
 
+void MachOLinkingContext::addRpath(StringRef rpath) {
+  _rpaths.push_back(rpath);
+}
+
 void MachOLinkingContext::addModifiedSearchDir(StringRef libPath,
                                                bool isSystemPath) {
   bool addedModifiedPath = false;