Skip to content

Introduce llvm-enable-rtti option #93640

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

catap
Copy link

@catap catap commented Feb 4, 2022

This option is controls when LLVM build adds -fno-rtti. Some details available here: https://www.llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

When this option is enabled, llvm build produces a bit more symbols:

rust % nm build/x86_64-apple-darwin/llvm/lib/libLLVMCore.a | grep llvm10CallbackVHE
0000000000007120 S __ZTIN4llvm10CallbackVHE
0000000000007240 S __ZTSN4llvm10CallbackVHE
00000000000070e8 S __ZTVN4llvm10CallbackVHE

and just to compare the same build without this option (current behaviour):

rust % nm build/x86_64-apple-darwin/llvm/lib/libLLVMCore.a | grep llvm10CallbackVHE
00000000000070b8 S __ZTVN4llvm10CallbackVHE

An attempt to bootstrap rust with clang which was built with enabled RTTI may fail with linking error like:

 = note: dyld: Symbol not found: __ZTIN4llvm10CallbackVHE
            Referenced from: /opt/local/libexec/llvm-9.0/bin/../lib/libclang-cpp.dylib
            Expected in: .../build/x86_64-apple-darwin/stage2/lib/libLLVM.dylib
           in /opt/local/libexec/llvm-9.0/bin/../lib/libclang-cpp.dylib

This option is controls when LLVM build adds `-fno-rtti`. Some details
available here: https://www.llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

When this option is enabled, llvm build produces a bit more symbols:
````
rust % nm build/x86_64-apple-darwin/llvm/lib/libLLVMCore.a | grep llvm10CallbackVHE
0000000000007120 S __ZTIN4llvm10CallbackVHE
0000000000007240 S __ZTSN4llvm10CallbackVHE
00000000000070e8 S __ZTVN4llvm10CallbackVHE
````
and just to compare the same build without this option (current behaviour):
```
rust % nm build/x86_64-apple-darwin/llvm/lib/libLLVMCore.a | grep llvm10CallbackVHE
00000000000070b8 S __ZTVN4llvm10CallbackVHE
```

An attempt to bootstrap `rust` with `clang` which was built with enabled
RTTI may fail with linking error like:
```
 = note: dyld: Symbol not found: __ZTIN4llvm10CallbackVHE
            Referenced from: /opt/local/libexec/llvm-9.0/bin/../lib/libclang-cpp.dylib
            Expected in: .../build/x86_64-apple-darwin/stage2/lib/libLLVM.dylib
           in /opt/local/libexec/llvm-9.0/bin/../lib/libclang-cpp.dylib
```
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 4, 2022
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 4, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
@bjorn3
Copy link
Member

bjorn3 commented Feb 4, 2022

What is the exact purpose of this option? Why would someone want to enable it?

@catap
Copy link
Author

catap commented Feb 4, 2022

@bjorn3 I've tried to build rustc by clang which was compiled without -fno-rtti and it fails because rust's LLVM is built with -fno-rtti. So, it works fine but at stage2 build fails because it can't link anything with provided errors.

As soon as I added this option and enabled it to this build => it linked and works.

catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 4, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 5, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 6, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 6, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 6, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 6, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 6, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 7, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 7, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 7, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 8, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 8, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
@Mark-Simulacrum
Copy link
Member

I'm going to close this in favor of #93756. Thanks!

catap added a commit to catap/rust-legacy-bootstrap that referenced this pull request Feb 13, 2022
The better approach is backported to upstream as
rust-lang/rust#93640
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants