authorgravatar for 35903594+patrickwick@users.noreply.github.comPatrick Wickenhaeuser <35903594+patrickwick@users.noreply.github.com> 2024-10-04 15:49:18+02:00
committergravatar for 35903594+patrickwick@users.noreply.github.comPatrick Wickenhaeuser <35903594+patrickwick@users.noreply.github.com> 2024-10-04 15:49:50+02:00
logc3f1ff8b0d2aa6fa94854775b80d57c251ce1438
tree9a008250a3a7357d82433a18e00ec17c80ec3f14
parent19a0864e4f96d5c20026dae87c0f9a784ae54272

19009: zig objcopy: minor cleanup


1 files changed, 4 insertions(+), 7 deletions(-)

lib/compiler/objcopy.zig+4-7
......@@ -274,7 +274,7 @@ const usage =
274274 \\ --compress-debug-sections Compress DWARF debug sections with zlib
275275 \\ --set-section-alignment <name>=<align> Set alignment of section <name> to <align> bytes. Must be a power of two.
276276 \\ --set-section-flags <name>=<file> Set flags of section <name> to <flags> represented as a comma separated set of flags.
277 \\ --add-section <name>=<file> Add file content from <file> with the section name <name>.
277 \\ --add-section <name>=<file> Add file content from <file> with the a new section named <name>.
278278 \\
279279;
280280
......@@ -1251,21 +1251,18 @@ fn ElfFile(comptime is_64: bool) type {
12511251 fatal("unable to open '{s}': {s}", .{ add_section.file_path, @errorName(err) });
12521252 defer section_file.close();
12531253
1254 const max_size = std.math.maxInt(usize);
1255 const payload = try section_file.readToEndAlloc(arena.allocator(), max_size);
1256 const flags = 0;
1257 const alignment = 4;
1254 const payload = try section_file.readToEndAlloc(arena.allocator(), std.math.maxInt(usize));
12581255
12591256 dest_sections[dest_section_idx] = Elf_Shdr{
12601257 .sh_name = user_section_name,
12611258 .sh_type = elf.SHT_PROGBITS,
1262 .sh_flags = flags,
1259 .sh_flags = 0,
12631260 .sh_addr = 0,
12641261 .sh_offset = eof_offset,
12651262 .sh_size = @intCast(payload.len),
12661263 .sh_link = elf.SHN_UNDEF,
12671264 .sh_info = elf.SHN_UNDEF,
1268 .sh_addralign = alignment,
1265 .sh_addralign = 4,
12691266 .sh_entsize = 0,
12701267 };
12711268 dest_section_idx += 1;