This is an archive of the discontinued LLVM Phabricator instance.

[gn] Use label_name rather than target_output_name for objects
ClosedPublic

Authored by phosek on Apr 5 2019, 11:38 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Apr 5 2019, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2019, 11:38 AM

Alternative I also considered would be to use {{source_out_dir}}/{{label_name}}.dir/{{source_name_part}}.o which is what CMake does, the advantage is that you end up with prettier object file names (i.e. no label_name or target_output_name prefixes) which might matter for distribution archives like libc++.a.

Ping, this is a pre-requisite for D60370 and D60372.

Ping again?

thakis accepted this revision.Apr 29 2019, 11:59 AM
This revision is now accepted and ready to land.Apr 29 2019, 11:59 AM
This revision was automatically updated to reflect the committed changes.