Skip to content

Disable source code paths in Odin builds - #90

Merged
orsinium merged 4 commits into
firefly-zero:mainfrom
applejag:patch-1
Aug 10, 2026
Merged

Disable source code paths in Odin builds#90
orsinium merged 4 commits into
firefly-zero:mainfrom
applejag:patch-1

Conversation

@applejag

@applejag applejag commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Odin includes by default the file names in the final build, as well as a lot of other error text that won't be used as asserts have no way of printing their messages.

However: this means that if the developer uses asserts themselves, then those won't be included in the build. So I'm only adding -disable-assert iff not --no-strip is set

This reduced a very simple hello world app (basically the odin triangle example) where I saved 403 Bytes thanks to -source-code-locations:none

@orsinium

Copy link
Copy Markdown
Member

I'm a bit confused how the new builds will behave.

  1. Are you sure the source code locations are only used in asserts?
  2. Why disable asserts? Won't they still work without printing the location? I'd expect them to be equivalent to "if !test then unreachable".
  3. Stripping is supposed to only remove debug info. Won't it be confusing to also affect the code behavior?

@applejag

applejag commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

I'm a bit confused how the new builds will behave.

1. Are you sure the source code locations are only used in asserts?

I was inspecting the WAT and it sure seems that way. It had multiple absolute paths in a data field.

There's other settings than none, so we could use one that only stores shorter file names instead of full absolute paths. However I fail to see how the full paths could ever benefit us, as it has no integration with firefly's misc.log_debug anyways

edit: also this does not affect debug info at all. The debug symbols for function names are still kept

2. Why disable asserts? Won't they still work without printing the location? I'd expect them to be equivalent to "if !test then unreachable".

3. Stripping is supposed to only remove debug info. Won't it be confusing to also affect the code behavior?

Yeah on second thought, let's not change the assert behavior. It's a weird default.

@applejag applejag changed the title Disable asserts and source code paths in Odin builds Disable source code paths in Odin builds Aug 10, 2026
@orsinium
orsinium merged commit b0b27c8 into firefly-zero:main Aug 10, 2026
3 checks passed
@orsinium

Copy link
Copy Markdown
Member

thank you :)

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.

2 participants