| ... | @@ -2589,11 +2589,28 @@ pub fn writeElfHeader(self: *Elf) !void { | ... | @@ -2589,11 +2589,28 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 2589 | hdr_buf[index] = 1; // ELF version | 2589 | hdr_buf[index] = 1; // ELF version |
| 2590 | index += 1; | 2590 | index += 1; |
| 2591 | | 2591 | |
| 2592 | // OS ABI, often set to 0 regardless of target platform | 2592 | hdr_buf[index] = @intFromEnum(@as(elf.OSABI, switch (target.cpu.arch) { |
| | 2593 | .amdgcn => switch (target.os.tag) { |
| | 2594 | .amdhsa => .AMDGPU_HSA, |
| | 2595 | .amdpal => .AMDGPU_PAL, |
| | 2596 | .mesa3d => .AMDGPU_MESA3D, |
| | 2597 | else => .NONE, |
| | 2598 | }, |
| | 2599 | .msp430 => .STANDALONE, |
| | 2600 | else => switch (target.os.tag) { |
| | 2601 | .freebsd, .ps4 => .FREEBSD, |
| | 2602 | .hermit => .STANDALONE, |
| | 2603 | .illumos, .solaris => .SOLARIS, |
| | 2604 | .openbsd => .OPENBSD, |
| | 2605 | else => .NONE, |
| | 2606 | }, |
| | 2607 | })); |
| | 2608 | index += 1; |
| | 2609 | |
| 2593 | // ABI Version, possibly used by glibc but not by static executables | 2610 | // ABI Version, possibly used by glibc but not by static executables |
| 2594 | // padding | 2611 | // padding |
| 2595 | @memset(hdr_buf[index..][0..9], 0); | 2612 | @memset(hdr_buf[index..][0..8], 0); |
| 2596 | index += 9; | 2613 | index += 8; |
| 2597 | | 2614 | |
| 2598 | assert(index == 16); | 2615 | assert(index == 16); |
| 2599 | | 2616 | |