-
-
Notifications
You must be signed in to change notification settings - Fork 758
Compiler crash when using -use-single-module
with manual call to _startup_runtime()
#5128
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
You can actually just call It shouldn't crash of course, will have to look into that. |
If we fix up the example to directly call package scratch
import "base:runtime"
@export
_start :: proc "c" () {
context = runtime.default_context()
#force_no_inline runtime._startup_runtime()
#force_no_inline runtime._cleanup_runtime()
}
But, without it it litters an object file for each package and doesn't create
However, the original example does indeed crash the compiler, creating no object files of any kind.
|
Thanks, this works. I literally just started learning Odin yesterday 😅 |
Uh oh!
There was an error while loading. Please reload this page.
Context
Background: I'm just starting with Odin for bare-metal development. In this context, I'm taking over the entry point, so I need to call
_startup_runtime()
and_cleanup_runtime()
myself (based on entry_unix.odin). I've been using-target:freestanding_amd64_sysv
when I encountered this bug, but I was able to reproduce it even without cross-compiling (as in the repro steps below).The compiler crashes with
malloc: *** error for object 0x600000d60258: pointer being freed was not allocated
when compiling an individual module that bootstraps the runtime itself (using_startup_runtime()
) and the flag-use-single-module
is in use. If this flag is removed, it compiles fine. This also happens when using-o:size
or-o:speed
, but I think it's just because those optimization modes use-use-single-module
by default.odin report
output:Expected Behavior
The compiler should produce a single .o file without crashing.
Current Behavior
The compiler crashes as shown below.
Failure Information (for bugs)
The crash message is:
Steps to Reproduce
The text was updated successfully, but these errors were encountered: