| ... | @@ -2958,7 +2958,24 @@ fn initHeaders( | ... | @@ -2958,7 +2958,24 @@ fn initHeaders( |
| 2958 | ehdr.entry = 0; | 2958 | ehdr.entry = 0; |
| 2959 | ehdr.phoff = 0; | 2959 | ehdr.phoff = 0; |
| 2960 | ehdr.shoff = 0; | 2960 | ehdr.shoff = 0; |
| 2961 | ehdr.flags = 0; | 2961 | ehdr.flags = switch (machine) { |
| | 2962 | .X86_64 => 0, |
| | 2963 | .LOONGARCH => e_flags: { |
| | 2964 | const target_cpu = &elf.base.comp.getTarget().cpu; |
| | 2965 | const e_flags: std.elf.loongarch.EFlags = .{ |
| | 2966 | .base_abi_modifier = if (target_cpu.has(.loongarch, .d)) |
| | 2967 | .d |
| | 2968 | else if (target_cpu.has(.loongarch, .f)) |
| | 2969 | .f |
| | 2970 | else |
| | 2971 | .s, |
| | 2972 | .abi_extension = .base, |
| | 2973 | .abi_version = 1, |
| | 2974 | }; |
| | 2975 | break :e_flags @bitCast(e_flags); |
| | 2976 | }, |
| | 2977 | else => @panic(@tagName(machine)), |
| | 2978 | }; |
| 2962 | ehdr.ehsize = @sizeOf(ElfN.Ehdr); | 2979 | ehdr.ehsize = @sizeOf(ElfN.Ehdr); |
| 2963 | ehdr.phentsize = @sizeOf(ElfN.Phdr); | 2980 | ehdr.phentsize = @sizeOf(ElfN.Phdr); |
| 2964 | ehdr.phnum = @min(phnum, std.elf.PN_XNUM); | 2981 | ehdr.phnum = @min(phnum, std.elf.PN_XNUM); |