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

odin build with -obfuscate-source-code-locations still leaves absolute paths in the output binary #4793

Closed
VaskoBozhurski opened this issue Feb 5, 2025 · 1 comment · Fixed by #4796

Comments

@VaskoBozhurski
Copy link

Context

When I try to build my project using odin build . -o:speed -obfuscate-source-code-locations there are a lot of absolute source code paths from my project as well as from the Odin core libraries.

        Odin:    dev-2025-01-nightly:2aae4cf
        OS:      Windows 11 Enterprise (version: 23H2), build 22631.4751
        CPU:     11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
        RAM:     16087 MiB
        Backend: LLVM 18.1.8

Expected Behavior

I expect builds with the -obfuscate-source-code-locations flag to obfuscate all absolute source code paths to the Odin root directory as well as to my own project's directory.

Current Behavior

-obfuscate-source-code-locations does not hide all source code locations from the binary output.

Steps to Reproduce

  1. Save following source file:
package example

main :: proc() {
	arr: [10]int = {}
	slice := arr[:]
	for i := 0; i < 10; i += 1 {
		slice[i] = i
	}
}
  1. odin build . -o:speed -obfuscate-source-code-locations
  2. Open the output binary with a text editor and search for Odin root (in my case that is C:/odin/) directory paths.

Currently for the snippet above it included the following absolute paths:

C:/odin/base/runtime/entry_windows.odin
C:/odin/base/runtime/default_temp_allocator_arena.odin
C:/odin/base/runtime/heap_allocator.odin
@VaskoBozhurski
Copy link
Author

After some testing I found 2 things that escape the obfuscation:

  1. Bounds checking where when I used -no-bounds-check a majority of the unobfuscated embeddings were gone.
  2. Type casting a union using actual := u.(int) there is some file name generation as well. Interestingly when I did actual, ok :=u.(int) the embedded string disappears.

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 a pull request may close this issue.

1 participant