[PATCH] D60329: [gn] Use label_name rather than target_output_name for objects

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 11:39:40 PDT 2019


phosek created this revision.
phosek added a reviewer: thakis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Multiple targets in the same output directory can use the same
target_output_name. The typical example of that is having a shared
and a static library of the same, e.g. libc++.so and libc++.a.
When that's the case, the object files produced for each target
are going to conflict. Using the label_name avoids this conflict
since labels are guaranteed to be unique within a single BUILD.gn
file which corresponds to a single output directory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60329

Files:
  llvm/utils/gn/build/toolchain/BUILD.gn


Index: llvm/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/utils/gn/build/toolchain/BUILD.gn
+++ llvm/utils/gn/build/toolchain/BUILD.gn
@@ -19,7 +19,7 @@
       depsformat = "gcc"
       description = "CC {{output}}"
       outputs = [
-        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+        "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o"
       ]
     }
 
@@ -29,7 +29,7 @@
       depsformat = "gcc"
       description = "CXX {{output}}"
       outputs = [
-        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+        "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o"
       ]
     }
 
@@ -39,7 +39,7 @@
       depsformat = "gcc"
       description = "ASM {{output}}"
       outputs = [
-        "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+        "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.o"
       ]
     }
 
@@ -227,7 +227,7 @@
     depsformat = "msvc"
     description = "CC {{output}}"
     outputs = [
-      "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+      "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.obj",
     ]
   }
 
@@ -236,7 +236,7 @@
     depsformat = "msvc"
     description = "CXX {{output}}"
     outputs = [
-      "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+      "{{source_out_dir}}/{{label_name}}.{{source_name_part}}.obj",
     ]
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60329.193924.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190405/5a29f36d/attachment.bin>


More information about the llvm-commits mailing list