-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Stage2 ARM Thumb Debug: LLD fails with "undefined symbol: __clzsi2" #13465
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
Comments
After a little further poking, I wondered if this might be related to
Obviously, this isn't very clean, but I am able to successfully link a working executable in debug mode with this change. I found the new I don't know exactly what this means in terms of the root cause of this bug, but hopefully this helps. On a side note, does anyone know why CPUs marked with the |
Based on your follow up I think this is caused by #13465 |
that's the same number as this one? |
Meant #13706 |
Zig Version
0.10.0
Steps to Reproduce and Observed Behavior
When compiling embedded firmware targeting ARM Cortex M0+, using the stage2 compiler, in debug mode, the linker fails with this message:
This doesn't happen when using any of the
-Drelease-*
modes, or when using the stage1 compiler. The reason it doesn't happen in release modes may just be that all the integer division and modulo operations are optimized out. I'm not exactly sure where those are coming from, even in debug; the only division I can think of should be comptime only.It looks like
lib/compiler_rt/count0bits.zig
does have an implementation of__clzsi2
specifically for Thumb targets, but somehow the linker doesn't see it.The specific CrossTarget being used is:
It can be reproduced by running
zig build
after checking out this commit: https://github.com/bcrist/microbe/tree/0b7404760350ef3504d95eb1200d6900c8b2a374Running
zig build
again after the failure doesn't print the error again, it just triggers a FileNotFound error, but I think that's caused by a different issue: #13432Deleting the zig-cache directory and building again shows the linker error again.
Expected Behavior
The linker should succeed and generate a valid ELF binary.
The text was updated successfully, but these errors were encountered: