This is an archive of the discontinued LLVM Phabricator instance.

[libc] Simplify integration tests by eliminating the artificial sysroot.
ClosedPublic

Authored by sivachandra on Mar 3 2023, 10:04 PM.

Details

Summary

The test binaries are built like any other executable but with two
additional linker options -static and -nostdlib.

Diff Detail

Event Timeline

sivachandra created this revision.Mar 3 2023, 10:04 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 3 2023, 10:04 PM
sivachandra requested review of this revision.Mar 3 2023, 10:04 PM
jhuber6 added inline comments.Mar 4 2023, 5:42 AM
libc/cmake/modules/LLVMLibCTestRules.cmake
506–511

Should we use -nostdinc as well? Or do we still expect to pick up some system libraries.

sivachandra added inline comments.Mar 4 2023, 10:19 AM
libc/cmake/modules/LLVMLibCTestRules.cmake
506–511

Our libc does not [yet] provide the free standing headers like stddef.h and stdint.h. Using -nostdinc eliminates the paths to the compiler's freestanding headers also. So, we cannot [yet] use -nostdinc.

jhuber6 accepted this revision.Mar 4 2023, 10:22 AM
jhuber6 added inline comments.
libc/cmake/modules/LLVMLibCTestRules.cmake
506–511

Alright, we can update this when libc is fully self supported.

This revision is now accepted and ready to land.Mar 4 2023, 10:22 AM
  • Improve the formatting of the code.
  • Collect all deps in to a static archive which gets linked to the final binary.
jhuber6 added inline comments.Mar 4 2023, 8:29 PM
libc/cmake/modules/LLVMLibCTestRules.cmake
450

Is it possible to make these dependencies transitive on the start implementation? Since presumably these are only required to implement the corresponding crt1.o and friends. For the GPU we wouldn't use any of these.

sivachandra added inline comments.Mar 4 2023, 9:36 PM
libc/cmake/modules/LLVMLibCTestRules.cmake
450

Yes, that can be done. I can do that separately.