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

figure out why unused functions from builtin.a are not getting omitted from final binary #2062

Open
andrewrk opened this issue Mar 14, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@andrewrk
Copy link
Member

commented Mar 14, 2019

I'm pretty sure when I solved #54 it was working but now if I do this:

$ ./zig build-exe ../examples/hello_world/hello.zig --release-small
$ objdump -d hello
...
0000000000201a40 <sqrt>:
...
0000000000201bf0 <sqrtf>:
...

That's not supposed to be in there. sqrt (among others) isn't called from this application.

On the other hand functions from compiler_rt.a are correctly getting omitted.

Maybe we should do -ffunction-sections?

@andrewrk andrewrk added this to the 0.5.0 milestone Mar 14, 2019

@vegecode

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

It seems to happen only in release-safe and release-fast modes for me when compiling for
armv7em-freestanding-eabihf.

In debug and release small modes, there are no calls to any compiler-rt functions that I can see.

@andrewrk

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2019

Note for webassembly what @shritesh found: #2248 (comment)

@vegecode

This comment has been minimized.

Copy link
Contributor

commented May 12, 2019

I just pulled the latest zig and my freestanding arm project won't build anymore:

lld: error: undefined symbol: __zig_probe_stack
>>> referenced by debug.zig:1822 (/home/alexander/Code/zig/build/lib/zig/std/debug.zig:1822)
>>>               /home/alexander/Code/msp432-tiva-zig/zig-cache/o/siMKlSLAjLobrJZ7TlKJUPyWP9vPyHsp5b0NmB2ajmfniXlyxalD_J1uFQo1EQ7b/build.o:(std.debug.getLineNumberInfoDwarf)

I think it is related to this issue.

Also, unlike my previous comment, this error happens in all build modes.

EDIT: nevermind, build issue... sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.