-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
zig cc: add linker -Map flag #18358
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
zig cc: add linker -Map flag #18358
Conversation
} else if (mem.startsWith(u8, arg, "-Map=")) { | ||
linker_map_file = arg["-Map=".len..]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handles -Map=file
which is enough for me. Should -Map file
be handled as well?
src/Compilation.zig
Outdated
options.symbol_wrap_set.count() > 0 or | ||
options.linker_map_file != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what I'm actually doing here and whether I should do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this flag in an ELF linker? Additionally, before we consider this for merging, we need a test in test/link/elf.zig
with llvm=true
and lld=true
. Once we move away from lld as the default linker, this will help in narrowing down the missing functionality.
@kubkon I could not figure out how to check the
Can you or anyone else please suggest how to do both correctly? |
You can pass |
Please see #18356 (comment). @kubkon will be the final word on this, but I think it would be better to not even decide whether to add this functionality until some other things are done. Until then, if you need this feature you will need to use a different toolchain than zig cc. @kubkon please close this pull request if you agree. |
I have to agree with @andrewrk here - this is a new feature request that while may look innocent and easy to implement with LLD in mind, it needs some careful consideration if ported to Zig's linker. Until we decide if we want to accept your proposal, I am closing this PR as not applicable. |
Linker maps are a diagnostic/debugging feature. It causes the linker to write out memory ranges (similar to the runtime content of
/proc/self/map
on Linux) and some such info. I need this because a program I want to compile withzig cc
uses this.Fixes #18356