This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Don't copy xray includes
ClosedPublic

Authored by aeubanks on Aug 25 2021, 3:26 PM.

Details

Summary

The gn build doesn't support xray, so there's no reason to make the xray
headers available. Some CMake checks check if xray includes are
available to determine if xray is usable. Since we don't build the xray
runtime, there are link errors.

Diff Detail

Event Timeline

aeubanks created this revision.Aug 25 2021, 3:26 PM
aeubanks requested review of this revision.Aug 25 2021, 3:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2021, 3:26 PM

Doesn't this break llvm/utils/gn/build/sync_source_lists_from_cmake.py as-is? If so, add a dummy "ignored" group with these files at the bottom. (...which sadly has the side effect of making this list no longer auto-syncable -- but this list doesn't change super often)

Which cmake checks check for this? Do you use the output of the gn build as the input of some other build? (Just curious; perfectly fine to do that of course.)

https://github.com/llvm/llvm-test-suite/blob/main/MicroBenchmarks/XRay/CMakeLists.txt checks for an xray header. I could also try to make that do a full compile/link test as an alternative.

Yeah running sync_source_lists_from_cmake.py would try to add these xray files back. But adding a group("ignored") I get

ERROR at //compiler-rt/include/BUILD.gn:34:13: Assignment had no effect.
  sources = [
            ^
You set the variable "sources" here and it was unused before it went
out of scope.

what's the way to explicitly ignore source files?

llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn and llvm/utils/gn/secondary/compiler-rt/lib/ubsan/BUILD.gn have examples.

This revision is now accepted and ready to land.Aug 27 2021, 5:36 AM
This revision was automatically updated to reflect the committed changes.

One somewhat unfortunate side effect of this is that the sync script can no longer auto-sync this file now. And we don't make this distinction for anything except xray.

Longer term it seems like the right thing to do (for more the the headers, too), so I suppose it's fine. The list of files in this directory doesn't change all that often.

Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 5:34 AM
Herald added a subscriber: Enna1. · View Herald Transcript