Skip to content

zig cc: undefined symbol: __ubsan_handle_add_overflow #17097

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
xzto opened this issue Sep 8, 2023 · 2 comments
Closed

zig cc: undefined symbol: __ubsan_handle_add_overflow #17097

xzto opened this issue Sep 8, 2023 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@xzto
Copy link

xzto commented Sep 8, 2023

Zig Version

0.12.0-dev.289+b642bb92e

Steps to Reproduce and Observed Behavior

// overflow.c
unsigned foo(unsigned a, unsigned b) {
    return a + b;
}

int main(void) {return 0;}

$ zig cc overflow.c -fsanitize=unsigned-integer-overflow

LLD Link... ld.lld: error: undefined symbol: __ubsan_handle_add_overflow
>>> referenced by overflow.c:2
>>>               /home/xzto/.cache/zig/o/f31c2c508be8c5b115df26da78214296/overflow.o:(foo)

It works if you replace zig cc with clang.

Expected Behavior

Successful compilation.

@xzto xzto added the bug Observed behavior contradicts documented or intended behavior label Sep 8, 2023
@rohlem
Copy link
Contributor

rohlem commented Sep 9, 2023

I think the main tracking issue for UBSan is currently #5163 .

@alexrp
Copy link
Member

alexrp commented May 27, 2025

ubsan-rt was added in Zig 0.14.0.

@alexrp alexrp closed this as completed May 27, 2025
@alexrp alexrp added this to the 0.14.0 milestone May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants