This is an archive of the discontinued LLVM Phabricator instance.

[libc][Fix] Move generic stdio implementations to a new directory
ClosedPublic

Authored by jhuber6 on Aug 9 2023, 1:09 PM.

Details

Summary

For whatever reason, the CMake did not like having the generic_
version live in the same directory. This patch pushes them to a new
directory, which is probably clearer anyway.

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 9 2023, 1:09 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 9 2023, 1:09 PM
jhuber6 requested review of this revision.Aug 9 2023, 1:09 PM
michaelrj accepted this revision.Aug 9 2023, 1:19 PM

LGTM with nit

libc/src/stdio/CMakeLists.txt
25

shouldn't this be in an else with the above condition?

This revision is now accepted and ready to land.Aug 9 2023, 1:19 PM
jhuber6 added inline comments.Aug 9 2023, 1:23 PM
libc/src/stdio/CMakeLists.txt
25

We already have a linux/ special-case which cause this to not be built. I believe this is the same approach we do for the math since even though we make the target, if there's no top level dependency on it we won't actually use it.

jhuber6 updated this revision to Diff 548757.Aug 9 2023, 1:32 PM

Make the GPU early exit in the generic version. This is the same approach that the math uses but we don't make all the entrypoints in this case so just special case exit for the GPU.

This revision was landed with ongoing or failed builds.Aug 9 2023, 1:32 PM
This revision was automatically updated to reflect the committed changes.
sivachandra added inline comments.Aug 9 2023, 2:03 PM
libc/src/stdio/CMakeLists.txt
25

I suggested elseif instead of else because we want to ignore (may be with a VERBOSE message) if neither an OS-specific implementation nor a generic implementation is available. This is useful in the case when a particular entrypoint is not enabled in entrypoints.txt. In such a case, the real entrypoint will be skipped and hence the ALIAS should also be skipped. The right fix is likely here: https://github.com/llvm/llvm-project/blob/main/libc/cmake/modules/LLVMLibCObjectRules.cmake#L309. But, that is beyond the scope of this change.