[libcxx-commits] [PATCH] D61039: [libcxx] Use relative path for libc++ library when generating script

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 14:21:43 PDT 2019


phosek created this revision.
phosek added reviewers: ldionne, thakis.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, christof.

This addresses the issue introduced in D60309 <https://reviews.llvm.org/D60309> which leads to linker
scripts being generated with absolute paths.


Repository:
  rCXX libc++

https://reviews.llvm.org/D61039

Files:
  libcxx/utils/gen_link_script.py


Index: libcxx/utils/gen_link_script.py
===================================================================
--- libcxx/utils/gen_link_script.py
+++ libcxx/utils/gen_link_script.py
@@ -29,11 +29,14 @@
                         help="List of libraries libc++ depends on")
     args = parser.parse_args()
 
+    # Use the relative path for the libc++ library.
+    libcxx = os.path.relpath(args.input, os.path.dirname(args.output))
+
     # Prepare the list of public libraries to link.
     public_libs = ['-l%s' % l for l in args.libraries]
 
     # Generate the linker script contents.
-    contents = "INPUT(%s)" % ' '.join([args.input] + public_libs)
+    contents = "INPUT(%s)" % ' '.join([libcxx] + public_libs)
     print("GENERATING SCRIPT: '%s' as file %s" % (contents, args.output))
 
     if args.dryrun:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61039.196327.patch
Type: text/x-patch
Size: 812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190423/b9e8e508/attachment.bin>


More information about the libcxx-commits mailing list