-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add ability to output raw binary #4291
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
Conversation
Isn't this better suited as a easy-to-use build step rather than as a compiler feature? |
I agree with @LemonBoy here. A pure userland solution integrated with zig build would solve the real use case, and then later in the self hosted compiler it can take advantage of this code to integrate with the CLI. We can get away with stage1 not having CLI support for this. And we should get away with as minimal stage1 as possible to keep complexity under control. |
I'll change my PR to be userland-only in the zig build system |
See also the accepted proposal #2279 (comment) |
2329a72
to
faa08c5
Compare
…m-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep Part of ziglang#2826
faa08c5
to
7cc25a5
Compare
Pushed a new version with only build system code |
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.
Nice work!
elf_program.p_type = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); | ||
elf_program.p_offset = @as(Elf64_Off, try in.readInt(Elf32_Off, elf.endian)); | ||
elf_program.p_vaddr = @as(Elf64_Addr, try in.readInt(Elf32_Addr, elf.endian)); | ||
elf_program.p_paddr = @as(Elf64_Addr, try in.readInt(Elf32_Addr, elf.endian)); | ||
elf_program.p_filesz = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); | ||
elf_program.p_memsz = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); | ||
elf_program.p_flags = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); | ||
elf_program.p_align = @as(Elf64_Word, try in.readInt(Elf32_Word, elf.endian)); |
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 believe all these @as
are superfluous.
elf_section.sh_link = try in.readInt(u32, elf.endian); | ||
elf_section.sh_info = try in.readInt(u32, elf.endian); | ||
elf_section.sh_addralign = @as(u64, try in.readInt(u32, elf.endian)); | ||
elf_section.sh_entsize = @as(u64, try in.readInt(u32, elf.endian)); |
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 believe this TODO comment can be deleted and the @as
can be removed
Add InstallRawStep to Zig build system that does a similar job to llvm-objcopy. To use it, do
where exe is a LibExeObjStep
Part of #2826
See commit wendigojaeger/ZigGBA@4f7ffdc for an example of usage with the build system