This is an archive of the discontinued LLVM Phabricator instance.

[libc] Set the stub filename to the target name instead of the source
ClosedPublic

Authored by jhuber6 on Mar 13 2023, 2:37 AM.

Details

Summary

The GPU target requires some weird special case handling to create fat
binaries. CMake offers no way to set the name of an object library. The
only way to do this is to create a file with the desired name and use
that. Currently we name it after the source filename. However, this
breaks if there is more than a single source. This patch changes the
logic to instead look up the object target name and use that. E.g.
src.__support.OSUtil.osutil will be osutil.cpp.

Diff Detail

Event Timeline

jhuber6 created this revision.Mar 13 2023, 2:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 13 2023, 2:37 AM
sivachandra accepted this revision.Mar 13 2023, 12:53 PM
sivachandra added inline comments.
libc/cmake/modules/LLVMLibCObjectRules.cmake
88–115

Nit: Local vars are given names in the lower case snake_case style. So, here, it could just be gpu_obj_src.

This revision is now accepted and ready to land.Mar 13 2023, 12:53 PM
jhuber6 marked an inline comment as done.Mar 13 2023, 12:57 PM