~yujiri/compiler

af2c60a98a17822493e3ae54c5af01e86f8c12c3 — Evin Yulo 11 months ago 465bd73
elf: remove unused section headers
1 files changed, 3 insertions(+), 16 deletions(-)

M elf.zig
M elf.zig => elf.zig +3 -16
@@ 114,19 114,6 @@ pub fn main() !void {
    try writer.writeByteNTimes(0, 59);

    // addr 0x1058: 1st section header
    // 1st section header
    // just zero it. it's type null.
    try writer.writeByteNTimes(0, 64);

    // addr 0x1098: 2nd section header
    // just zero it. it's a note.
    try writer.writeByteNTimes(0, 64);

    // addr 0x10d8: 3rd section header
    // just zero it. it's a note.
    try writer.writeByteNTimes(0, 64);

    // addr 0x1118: 4th section header
    // name offset
    try writer.writeIntNative(u32, 49);
    // type: instructions


@@ 148,7 135,7 @@ pub fn main() !void {
    // section content entry size (unused)
    try writer.writeIntNative(u64, 0);

    // addr 0x1158: 5th section header
    // addr 0x1098: 2nd section header
    // name offset
    try writer.writeIntNative(u32, 1);
    // type: strtab


@@ 209,7 196,7 @@ pub fn writeElfHeader(writer: anytype) !void {
    // size of a section header entry
    try writer.writeIntNative(u16, 64);
    // number of section header entries
    try writer.writeIntNative(u16, 5);
    try writer.writeIntNative(u16, 2);
    // index of section header that contains section names
    try writer.writeIntNative(u16, 4);
    try writer.writeIntNative(u16, 1);
}