| ... | ... | @@ -286,10 +286,6 @@ fn createFile(allocator: *Allocator, file: fs.File, options: link.Options) !Elf |
| 286 | 286 | }; |
| 287 | 287 | errdefer self.deinit(); |
| 288 | 288 | |
| 289 | | if (options.target.cpu.arch == .spu_2) { |
| 290 | | self.base.options.default_entry_addr = 0; |
| 291 | | } |
| 292 | | |
| 293 | 289 | // Index 0 is always a null symbol. |
| 294 | 290 | try self.local_symbols.append(allocator, .{ |
| 295 | 291 | .st_name = 0, |
| ... | ... | @@ -466,12 +462,13 @@ pub fn populateMissingMetadata(self: *Elf) !void { |
| 466 | 462 | const p_align = 0x1000; |
| 467 | 463 | const off = self.findFreeSpace(file_size, p_align); |
| 468 | 464 | log.debug("found PT_LOAD free space 0x{x} to 0x{x}\n", .{ off, off + file_size }); |
| 465 | const entry_addr: u64 = self.entry_addr orelse if (self.base.options.target.cpu.arch == .spu_2) @as(u64, 0) else default_entry_addr; |
| 469 | 466 | try self.program_headers.append(self.base.allocator, .{ |
| 470 | 467 | .p_type = elf.PT_LOAD, |
| 471 | 468 | .p_offset = off, |
| 472 | 469 | .p_filesz = file_size, |
| 473 | | .p_vaddr = self.base.options.default_entry_addr, |
| 474 | | .p_paddr = self.base.options.default_entry_addr, |
| 470 | .p_vaddr = entry_addr, |
| 471 | .p_paddr = entry_addr, |
| 475 | 472 | .p_memsz = file_size, |
| 476 | 473 | .p_align = p_align, |
| 477 | 474 | .p_flags = elf.PF_X | elf.PF_R, |
| ... | ... | @@ -490,13 +487,13 @@ pub fn populateMissingMetadata(self: *Elf) !void { |
| 490 | 487 | // TODO instead of hard coding the vaddr, make a function to find a vaddr to put things at. |
| 491 | 488 | // we'll need to re-use that function anyway, in case the GOT grows and overlaps something |
| 492 | 489 | // else in virtual memory. |
| 493 | | const default_got_addr = if (self.base.options.target.cpu.arch.ptrBitWidth() == 16) @as(u32, 0x8000) else 0x4000000; |
| 490 | const got_addr = if (self.base.options.target.cpu.arch.ptrBitWidth() == 16) @as(u32, 0x8000) else 0x4000000; |
| 494 | 491 | try self.program_headers.append(self.base.allocator, .{ |
| 495 | 492 | .p_type = elf.PT_LOAD, |
| 496 | 493 | .p_offset = off, |
| 497 | 494 | .p_filesz = file_size, |
| 498 | | .p_vaddr = default_got_addr, |
| 499 | | .p_paddr = default_got_addr, |
| 495 | .p_vaddr = got_addr, |
| 496 | .p_paddr = got_addr, |
| 500 | 497 | .p_memsz = file_size, |
| 501 | 498 | .p_align = p_align, |
| 502 | 499 | .p_flags = elf.PF_R, |