This is an archive of the discontinued LLVM Phabricator instance.

Add CMake option not to build BOLT tests
AbandonedPublic

Authored by kongyi on Mar 2 2022, 4:58 AM.

Details

Diff Detail

Event Timeline

kongyi created this revision.Mar 2 2022, 4:58 AM
Herald added a project: Restricted Project. · View Herald Transcript
kongyi requested review of this revision.Mar 2 2022, 4:58 AM
kongyi updated this revision to Diff 412438.Mar 2 2022, 8:38 AM
kongyi updated this revision to Diff 412442.Mar 2 2022, 8:44 AM
Amir added a comment.Mar 2 2022, 11:09 AM

Can you please elaborate the goal? BOLT tests are disabled if LLVM tests are disabled (LLVM_INCLUDE_TESTS=OFF), or if prerequisites are not met (clang/lld are not built or not specified via BOLT_{CLANG,LLD}_EXE). Likewise, they are enabled if LLVM_INCLUDE_TESTS is on.
If the goal is to control BOLT tests independent from LLVM tests, can you please confirm by specifying LLVM_INCLUDE_TESTS=ON and BOLT_INCLUDE_TESTS=OFF and vice versa.

Can you please elaborate the goal? BOLT tests are disabled if LLVM tests are disabled (LLVM_INCLUDE_TESTS=OFF), or if prerequisites are not met (clang/lld are not built or not specified via BOLT_{CLANG,LLD}_EXE). Likewise, they are enabled if LLVM_INCLUDE_TESTS is on.
If the goal is to control BOLT tests independent from LLVM tests, can you please confirm by specifying LLVM_INCLUDE_TESTS=ON and BOLT_INCLUDE_TESTS=OFF and vice versa.

BOLT_INCLUDE_TESTS also controls whether merge-fdata gets built with relocation. My goal is to build LLVM with tests but without relocation for merge-fdata.

Amir added a comment.Mar 2 2022, 3:13 PM

Can you please elaborate the goal? BOLT tests are disabled if LLVM tests are disabled (LLVM_INCLUDE_TESTS=OFF), or if prerequisites are not met (clang/lld are not built or not specified via BOLT_{CLANG,LLD}_EXE). Likewise, they are enabled if LLVM_INCLUDE_TESTS is on.
If the goal is to control BOLT tests independent from LLVM tests, can you please confirm by specifying LLVM_INCLUDE_TESTS=ON and BOLT_INCLUDE_TESTS=OFF and vice versa.

BOLT_INCLUDE_TESTS also controls whether merge-fdata gets built with relocation. My goal is to build LLVM with tests but without relocation for merge-fdata.

Makes sense. Although why is building with relocs a problem? (It might be a problem with gold linker that doesn't accept -emit-relocs together with -icf or -gc-sections)

bolt/CMakeLists.txt
17

Should this definition also be changed to set a cache entry?

29

Add FORCE to override a cache entry in case prerequisites are not met

Can you please elaborate the goal? BOLT tests are disabled if LLVM tests are disabled (LLVM_INCLUDE_TESTS=OFF), or if prerequisites are not met (clang/lld are not built or not specified via BOLT_{CLANG,LLD}_EXE). Likewise, they are enabled if LLVM_INCLUDE_TESTS is on.
If the goal is to control BOLT tests independent from LLVM tests, can you please confirm by specifying LLVM_INCLUDE_TESTS=ON and BOLT_INCLUDE_TESTS=OFF and vice versa.

BOLT_INCLUDE_TESTS also controls whether merge-fdata gets built with relocation. My goal is to build LLVM with tests but without relocation for merge-fdata.

Makes sense. Although why is building with relocs a problem? (It might be a problem with gold linker that doesn't accept -emit-relocs together with -icf or -gc-sections)

Due to some Darwin specific issues, we can only --strip-debug on the final library instead of --strip-all, and this causes error (symbol named in a relocation).

Amir accepted this revision.Mar 3 2022, 3:19 PM

Please address the feedback, but otherwise LGTM. The proper way to solve the problem you're running into would be to disable relocs for merge-fdata and meta merge-fdata test on Darwin host, but it's orthogonal to disabling BOLT tests separate from the rest of LLVM tests. I'll take care of it.

Can you please elaborate the goal? BOLT tests are disabled if LLVM tests are disabled (LLVM_INCLUDE_TESTS=OFF), or if prerequisites are not met (clang/lld are not built or not specified via BOLT_{CLANG,LLD}_EXE). Likewise, they are enabled if LLVM_INCLUDE_TESTS is on.
If the goal is to control BOLT tests independent from LLVM tests, can you please confirm by specifying LLVM_INCLUDE_TESTS=ON and BOLT_INCLUDE_TESTS=OFF and vice versa.

BOLT_INCLUDE_TESTS also controls whether merge-fdata gets built with relocation. My goal is to build LLVM with tests but without relocation for merge-fdata.

Makes sense. Although why is building with relocs a problem? (It might be a problem with gold linker that doesn't accept -emit-relocs together with -icf or -gc-sections)

Due to some Darwin specific issues, we can only --strip-debug on the final library instead of --strip-all, and this causes error (symbol named in a relocation).

This revision is now accepted and ready to land.Mar 3 2022, 3:19 PM
Amir added a comment.Mar 9 2022, 2:14 PM

@kongyi

I've double checked the test and I'm not sure why you're running into issues with it:

# Emit relocations for BOLT meta test (bolt/test/runtime/meta-merge-fdata.test)
if (BOLT_INCLUDE_TESTS AND UNIX AND NOT APPLE)
  target_link_options(merge-fdata PRIVATE LINKER:--emit-relocs)
endif()

REQUIRES: x86_64-linux

kongyi abandoned this revision.Dec 12 2022, 9:39 PM