This is an archive of the discontinued LLVM Phabricator instance.

[runtimes][VE] Change to compile crtbegin/end before compiler-rt
AbandonedPublic

Authored by kaz7 on Dec 3 2021, 5:05 AM.

Details

Summary

VE doesn't distribute crtbegin/end, so compilation of LLVM for VE
requires to compile crtbegin/end first similar to builtin.

Diff Detail

Event Timeline

kaz7 created this revision.Dec 3 2021, 5:05 AM
kaz7 requested review of this revision.Dec 3 2021, 5:05 AM
kaz7 added a comment.EditedDec 3 2021, 5:16 AM

This patch add mechanism to compile crtbegin/end before other libraries which is similar to a mechanism to compile builtins before compile-rt.

The crtbegin/end files are not available for VE freely. Those are distributed as a part of propariatary libraries. Therefore, we need to compile crtbegin/end before other libraries. This patch modifies building mechanism to compile crtbegin/end similar to builtins without other libraries. Then, compile compiler-rt again in the middle of compilation. This patch is useful for not only for SX-Aurora VE, but also other architectures which has no crtbegin/end freely.

However, I'm not sure what kind of mechanism is good for other architectures. For example, I can define LLVM_BUILTIN_CRTBEGIN_TARGETS variable to enable this feature. However, I'm not sure what is the best. So, this time, I send this patch for only crtbegin/end before other libraies for only VE at the moment. I appreciate any comments and requests for changes. Thanks!!

This patch add mechanism to compile crtbegin/end before other libraries which is similar to a mechanism to compile builtins before compile-rt.

The crtbegin/end files are not available for VE freely. Those are distributed as a part of propariatary libraries. Therefore, we need to compile crtbegin/end before other libraries. This patch modifies building mechanism to compile crtbegin/end similar to builtins without other libraries. Then, compile compiler-rt again in the middle of compilation. This patch is useful for not only for SX-Aurora VE, but also other architectures which has no crtbegin/end freely.

However, I'm not sure what kind of mechanism is good for other architectures. For example, I can define LLVM_BUILTIN_CRTBEGIN_TARGETS variable to enable this feature. However, I'm not sure what is the best. So, this time, I send this patch for only crtbegin/end before other libraies for only VE at the moment. I appreciate any comments and requests for changes. Thanks!!

Thank you for this change. We've discussed this before with other contributors. The main concern over adding another sub-build is the increased overhead since every CMake run takes considerable time. To address that, I have implemented D89492 which makes it possible to build builtins and crtbegin/crtend in a single CMake build without requiring another sub-build. That change is ready to land but it's been waiting for someone to review it, do you want to take a look if it addresses your use case?

kaz7 abandoned this revision.Dec 3 2021, 7:20 PM

This patch add mechanism to compile crtbegin/end before other libraries which is similar to a mechanism to compile builtins before compile-rt.

Thank you for this change. We've discussed this before with other contributors. The main concern over adding another sub-build is the increased overhead since every CMake run takes considerable time. To address that, I have implemented D89492 which makes it possible to build builtins and crtbegin/crtend in a single CMake build without requiring another sub-build. That change is ready to land but it's been waiting for someone to review it, do you want to take a look if it addresses your use case?

Thank you for trying to achieve pre-compiling of crtbegin/crtend and builtins. I'll join D89492 and review it.