This is an archive of the discontinued LLVM Phabricator instance.

[libc] Allows cross compilation of membenchmarks
ClosedPublic

Authored by gchatelet on May 9 2023, 7:04 AM.

Details

Summary

This patch makes sure:

  • we pass the correct compiler options when building Google benchmarks,
  • we only import the C++ version of the memory functions.

The change in libc/cmake/modules/LLVMLibCTestRules.cmake is here to make sure CMake can generate the right command line in the presence of the CMAKE_CROSSCOMPILING_EMULATOR option.

Relevant documentation:
https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html
https://cmake.org/cmake/help/latest/command/add_custom_command.html#command:add_custom_command
"
If COMMAND specifies an executable target name (created by the add_executable() command), it will automatically be replaced by the location of the executable created at build time if either of the following is true:

  • The target is not being cross-compiled (i.e. the CMAKE_CROSSCOMPILING variable is not set to true).
  • New in version 3.6: The target is being cross-compiled and an emulator is provided (i.e. its CROSSCOMPILING_EMULATOR target property is set). In this case, the contents of CROSSCOMPILING_EMULATOR will be prepended to the command before the location of the target executable.

"

Diff Detail

Event Timeline

gchatelet created this revision.May 9 2023, 7:04 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 9 2023, 7:04 AM
gchatelet requested review of this revision.May 9 2023, 7:04 AM
gchatelet accepted this revision.May 11 2023, 1:57 AM

@sivachandra I'm submitting this. Let me know if you have any concerns.

This revision is now accepted and ready to land.May 11 2023, 1:57 AM
This revision was automatically updated to reflect the committed changes.