This is an archive of the discontinued LLVM Phabricator instance.

ar_to_bc.sh: Ignore non-bitcode files in archives
ClosedPublic

Authored by MaskRay on May 31 2022, 3:31 PM.

Details

Reviewers
akyrtzi
vitalybuka
Group Reviewers
Restricted Project
Commits
rG241e645036f8: ar_to_bc.sh: Ignore non-bitcode files in archives
Summary

The script uses llvm-link to link LLVM bitcode files.
5426da8ffa4a6d55adab21026ce6ebe8f1cc6ef2 used -DLLVM_DISABLE_ASSEMBLY_FILES=ON
to ignore object files compiled from lib/Support/BLAKE3/*.S.

A better approach (which fits Bazel better) is to ignore non-bitcode files.

Diff Detail

Event Timeline

MaskRay created this revision.May 31 2022, 3:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2022, 3:31 PM
MaskRay requested review of this revision.May 31 2022, 3:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2022, 3:31 PM
akyrtzi accepted this revision.May 31 2022, 3:48 PM

Should this patch also remove -DLLVM_DISABLE_ASSEMBLY_FILES=ON from symbolizer/scripts/build_symbolizer.sh?

This revision is now accepted and ready to land.May 31 2022, 3:48 PM
MaskRay updated this revision to Diff 433218.May 31 2022, 3:59 PM

remove -DLLVM_DISABLE_ASSEMBLY_FILES=ON

Should this patch also remove -DLLVM_DISABLE_ASSEMBLY_FILES=ON from symbolizer/scripts/build_symbolizer.sh?

Thanks for the quick review:) I think it's a good idea. I suspect LLVM_DISABLE_ASSEMBLY_FILES can be removed, but that can be a separate change.

It's not clear to me what symbolizer/scripts/ar_to_bc.sh is doing exactly, will there not be an issue (e.g. linker error?) when it's trying to link the object files while the .s derived ones were excluded?

MaskRay added a comment.EditedJun 1 2022, 10:11 AM

It's not clear to me what symbolizer/scripts/ar_to_bc.sh is doing exactly, will there not be an issue (e.g. linker error?) when it's trying to link the object files while the .s derived ones were excluded?

Seems that it is used by compiler-rt's "internal symbolizer". But I am unclear how it is plugged into the CMake build system.

Using clang -flto plus llvm-link is a way to use LLVMSymbolize without exposing llvm:: symbols in sanitizer runtime files.

This revision was automatically updated to reflect the committed changes.
MatzeB added a subscriber: MatzeB.Jun 27 2022, 9:09 PM
MatzeB added inline comments.
compiler-rt/lib/sanitizer_common/symbolizer/scripts/ar_to_bc.sh
33–38

I tracked down a build failure here, to the file utility reporting LLVM bitcode instead of the expected LLVM IR bitcode :-(

bash-5.0$ file --version
file-5.11
magic file from /etc/magic:/usr/share/misc/magic
MatzeB added inline comments.Jun 28 2022, 7:02 AM
compiler-rt/lib/sanitizer_common/symbolizer/scripts/ar_to_bc.sh
33–38

I put up a way to avoid this whole script in D128729