Skip to content

Error if -no-crt is used without -no-thread-locals #4704

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

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

flysand7
Copy link
Contributor

This PR enforces the use of -no-thread-locals when compiling with -no-crt. The reasoning is as follows: There are a few places in the base: collection that initialize things with thread locals, as well as a bunch of places in the core: collection. When -no-crt is used by itself, you'll just crash, because there's no libc to initialize the TLS and any access to TLS would lead to a crash. This makes it seem like an unintended behavior (#4614), but it is in fact very intended, because at the current stage we can't build our own TLS model, and we can't match any dynamic loaders' TLS model.

This PR resolves #4614 by making it an explicit error.

There's also a small typo fix in a comment that caught my eye. Oh, and I added -default-to-panic-allocator to -help, because just noticed it wasn't there.

Now using any thread-local variables with -no-crt enabled
will cause a compiler error, unless -no-thread-local is
given.

Also fixed a minor typo in a comment.
@gingerBill gingerBill merged commit fcd3cf7 into odin-lang:master Jan 17, 2025
7 checks passed
@flysand7 flysand7 deleted the 4614-thread-locals branch April 13, 2025 03:22
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.

Compiling with -no-crt on Linux causes a segmentation violation
2 participants