motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit c3f1ff8b0d2aa6fa94854775b80d57c251ce1438 (tree)
parent 19a0864e4f96d5c20026dae87c0f9a784ae54272
Author: Patrick Wickenhaeuser <35903594+patrickwick@users.noreply.github.com>
Date:   Fri,  4 Oct 2024 15:49:18 +0200

19009: zig objcopy: minor cleanup

Diffstat:
Mlib/compiler/objcopy.zig | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/compiler/objcopy.zig b/lib/compiler/objcopy.zig @@ -274,7 +274,7 @@ const usage = \\ --compress-debug-sections Compress DWARF debug sections with zlib \\ --set-section-alignment <name>=<align> Set alignment of section <name> to <align> bytes. Must be a power of two. \\ --set-section-flags <name>=<file> Set flags of section <name> to <flags> represented as a comma separated set of flags. - \\ --add-section <name>=<file> Add file content from <file> with the section name <name>. + \\ --add-section <name>=<file> Add file content from <file> with the a new section named <name>. \\ ; @@ -1251,21 +1251,18 @@ fn ElfFile(comptime is_64: bool) type { fatal("unable to open '{s}': {s}", .{ add_section.file_path, @errorName(err) }); defer section_file.close(); - const max_size = std.math.maxInt(usize); - const payload = try section_file.readToEndAlloc(arena.allocator(), max_size); - const flags = 0; - const alignment = 4; + const payload = try section_file.readToEndAlloc(arena.allocator(), std.math.maxInt(usize)); dest_sections[dest_section_idx] = Elf_Shdr{ .sh_name = user_section_name, .sh_type = elf.SHT_PROGBITS, - .sh_flags = flags, + .sh_flags = 0, .sh_addr = 0, .sh_offset = eof_offset, .sh_size = @intCast(payload.len), .sh_link = elf.SHN_UNDEF, .sh_info = elf.SHN_UNDEF, - .sh_addralign = alignment, + .sh_addralign = 4, .sh_entsize = 0, }; dest_section_idx += 1;