| ... | ... | @@ -648,7 +648,6 @@ pub fn initMetadata(self: *Elf, options: InitMetadataOptions) !void { |
| 648 | 648 | const ptr_size = self.ptrWidthBytes(); |
| 649 | 649 | const target = self.base.comp.root_mod.resolved_target.result; |
| 650 | 650 | const ptr_bit_width = target.ptrBitWidth(); |
| 651 | | const has_os = target.os.tag != .freestanding; |
| 652 | 651 | const zig_object = self.zigObjectPtr().?; |
| 653 | 652 | |
| 654 | 653 | const fillSection = struct { |
| ... | ... | @@ -684,9 +683,7 @@ pub fn initMetadata(self: *Elf, options: InitMetadataOptions) !void { |
| 684 | 683 | } |
| 685 | 684 | |
| 686 | 685 | if (self.phdr_zig_got_index == null) { |
| 687 | | // We really only need ptr alignment but since we are using PROGBITS, linux requires |
| 688 | | // page align. |
| 689 | | const alignment = if (has_os) self.page_size else @as(u16, ptr_size); |
| 686 | const alignment = self.page_size; |
| 690 | 687 | const filesz = @as(u64, ptr_size) * options.symbol_count_hint; |
| 691 | 688 | const off = self.findFreeSpace(filesz, alignment); |
| 692 | 689 | self.phdr_zig_got_index = try self.addPhdr(.{ |
| ... | ... | @@ -701,7 +698,7 @@ pub fn initMetadata(self: *Elf, options: InitMetadataOptions) !void { |
| 701 | 698 | } |
| 702 | 699 | |
| 703 | 700 | if (self.phdr_zig_load_ro_index == null) { |
| 704 | | const alignment = if (has_os) self.page_size else @as(u16, ptr_size); |
| 701 | const alignment = self.page_size; |
| 705 | 702 | const filesz: u64 = 1024; |
| 706 | 703 | const off = self.findFreeSpace(filesz, alignment); |
| 707 | 704 | self.phdr_zig_load_ro_index = try self.addPhdr(.{ |
| ... | ... | @@ -716,7 +713,7 @@ pub fn initMetadata(self: *Elf, options: InitMetadataOptions) !void { |
| 716 | 713 | } |
| 717 | 714 | |
| 718 | 715 | if (self.phdr_zig_load_rw_index == null) { |
| 719 | | const alignment = if (has_os) self.page_size else @as(u16, ptr_size); |
| 716 | const alignment = self.page_size; |
| 720 | 717 | const filesz: u64 = 1024; |
| 721 | 718 | const off = self.findFreeSpace(filesz, alignment); |
| 722 | 719 | self.phdr_zig_load_rw_index = try self.addPhdr(.{ |
| ... | ... | @@ -731,7 +728,7 @@ pub fn initMetadata(self: *Elf, options: InitMetadataOptions) !void { |
| 731 | 728 | } |
| 732 | 729 | |
| 733 | 730 | if (self.phdr_zig_load_zerofill_index == null) { |
| 734 | | const alignment = if (has_os) self.page_size else @as(u16, ptr_size); |
| 731 | const alignment = self.page_size; |
| 735 | 732 | self.phdr_zig_load_zerofill_index = try self.addPhdr(.{ |
| 736 | 733 | .type = elf.PT_LOAD, |
| 737 | 734 | .addr = if (ptr_bit_width >= 32) 0x14000000 else 0xf000, |