Skip to content

Place __muloti4 in a separate object file #348

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Place __muloti4 in a separate object file #348

wants to merge 2 commits into from

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Mar 30, 2020

libc++ defines __muloti4 builtin llvm.org/PR30643. When referenced and
linked before compiler builtins, it will likely lead to a link failure,
since all Rust implemented builtins are currently placed in a single
object file.

Workaround the issue by using a C implementation when enabled.

tmiasko added 2 commits March 31, 2020 09:07
libc++ defines __muloti4 builtin llvm.org/PR30643. When referenced and
linked before compiler builtins, it will likely lead to a link failure,
since all Rust implemented builtins are currently placed in a single
object file.

Workaround the issue by using a C implementation when enabled.
@alexcrichton
Copy link
Member

I would personally prefer to not pick up more of a C dependency where we don't already have it. I don't think that this is also isolated to just this one symbol, so I think that if this wants to be fixed it should be fixed at the rustc level to place each function into its own object file.

@tmiasko
Copy link
Contributor Author

tmiasko commented Mar 31, 2020

In the context of libc++ it is isolated to a single symbol https://github.com/llvm/llvm-project/blob/master/libcxx/src/filesystem/int128_builtins.cpp

But more generally this would definitely need a different solution, one that is compatible with Rust implementations.

@alexcrichton
Copy link
Member

Yes most other compiler-rt-like implementations have one-symbol-per-file. The Rust compiler has the rough ability to do this but we'd have to teach it to do so specially for the compiler-builtins crate (we already have a magical attribute which hooks into some custom settings like visibility)

@metajack
Copy link

metajack commented Mar 31, 2020

Is this what we're running into here? tikv/rust-rocksdb#461

We'd love a suggestion on how to work around this.

@tmiasko
Copy link
Contributor Author

tmiasko commented Apr 1, 2020

FWIW my point was that libc++ defines only this one intrinsic (not just that it is separate):

$ nm --format=posix --defined-only --extern-only /usr/lib/llvm-9/lib/libc++.a | grep '^__' | sort | uniq
__clang_call_terminate W 0 b
__muloti4 T 0 124

More generally, exposing per source module partitioning outside incremental mode might be enough to address this.

@alexcrichton
Copy link
Member

@tmiasko oh wow that is pretty odd, and unfortunate since libc++ typically comes before compiler-rt which is why I think we haven't run into this specifically before (but we have run into this in various capacities over time).

@metajack I don't know of a workaround.

@tmiasko tmiasko closed this Apr 1, 2020
@tmiasko tmiasko deleted the c++ branch April 1, 2020 18:06
tgross35 added a commit to tgross35/compiler-builtins that referenced this pull request Feb 23, 2025
Introduce generators that respect function domains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants