Skip to content
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

Compiler-rt not properly linking #3

Open
oneechanhax opened this issue Jul 12, 2019 · 6 comments
Open

Compiler-rt not properly linking #3

oneechanhax opened this issue Jul 12, 2019 · 6 comments

Comments

@oneechanhax
Copy link

oneechanhax commented Jul 12, 2019

libc++ doesnt properly link with compiler-rt.
It leaves missing symbols such as "__divti3", "__muloti4", and "__udivti3"
Using alpine-lxc on the latest alpine release 3.10

@oneechanhax
Copy link
Author

found the solution, you can compile compiler-rt from llvm9 and install it. it gives the crts we need.
then install compiler-rt from llvm-8 over it, it doesnt overwrite the crts and gives proper builtins.
from there, its just a matter of compiling clang-9 without stack protection(it crashes compiling itself) using gcc(alpines build crashes as above), then bootstrap with itself.

I wont impliment these, sorry.
Already did it by hand.

@tpimh
Copy link
Owner

tpimh commented Jul 13, 2019

I haven't updated NGTC in a while, possibly there are more issues with it. I will take a look soon.

@tpimh
Copy link
Owner

tpimh commented Jul 16, 2019

Just had this error with libc++.so not linking properly (undefined reference to __udivti3). I tried adding -lgcc to the failing command and it worked. Now I'm building using gcc instead of clang, it generates ton of warnings, but links successfully.

@oneechanhax
Copy link
Author

you cant tell it to use compiler rt with gcc though

@tpimh
Copy link
Owner

tpimh commented Jul 17, 2019

The workaround here is crude, but it works: manually edit build.ninja and add -lgcc to LINK_LIBRARIES of lib/libc++.so.1.0.

@tpimh
Copy link
Owner

tpimh commented Jul 18, 2019

I was finally able to compile working toolchain. Also, updated the latest binary build, it successfully compiled C and C++ test programs.

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

No branches or pull requests

2 participants