| ... | ... | @@ -93,7 +93,6 @@ phdr_gnu_stack_index: ?u16 = null, |
| 93 | 93 | /// TODO I think ELF permits multiple TLS segments but for now, assume one per file. |
| 94 | 94 | phdr_tls_index: ?u16 = null, |
| 95 | 95 | |
| 96 | | entry_index: ?Symbol.Index = null, |
| 97 | 96 | page_size: u32, |
| 98 | 97 | default_sym_version: elf.Elf64_Versym, |
| 99 | 98 | |
| ... | ... | @@ -1277,19 +1276,15 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod |
| 1277 | 1276 | // Any qualifing unresolved symbol will be upgraded to an absolute, weak |
| 1278 | 1277 | // symbol for potential resolution at load-time. |
| 1279 | 1278 | try self.resolveSymbols(); |
| 1279 | if (self.linkerDefinedPtr()) |obj| { |
| 1280 | try obj.initSymbols(self); |
| 1281 | } |
| 1280 | 1282 | self.markEhFrameAtomsDead(); |
| 1281 | 1283 | try self.resolveMergeSections(); |
| 1282 | 1284 | |
| 1283 | 1285 | try self.convertCommonSymbols(); |
| 1284 | 1286 | self.markImportsExports(); |
| 1285 | 1287 | |
| 1286 | | // Look for entry address in objects if not set by the incremental compiler. |
| 1287 | | if (self.entry_index == null) { |
| 1288 | | if (self.entry_name) |name| { |
| 1289 | | self.entry_index = self.globalByName(name); |
| 1290 | | } |
| 1291 | | } |
| 1292 | | |
| 1293 | 1288 | if (self.base.gc_sections) { |
| 1294 | 1289 | try gc.gcAtoms(self); |
| 1295 | 1290 | |
| ... | ... | @@ -1307,9 +1302,6 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod |
| 1307 | 1302 | try self.finalizeMergeSections(); |
| 1308 | 1303 | try self.initOutputSections(); |
| 1309 | 1304 | try self.initMergeSections(); |
| 1310 | | if (self.linkerDefinedPtr()) |obj| { |
| 1311 | | try obj.initSymbols(self); |
| 1312 | | } |
| 1313 | 1305 | self.claimUnresolved(); |
| 1314 | 1306 | |
| 1315 | 1307 | // Scan and create missing synthetic entries such as GOT indirection. |
| ... | ... | @@ -1385,7 +1377,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod |
| 1385 | 1377 | else => |e| return e, |
| 1386 | 1378 | }; |
| 1387 | 1379 | |
| 1388 | | if (self.entry_index == null and self.base.isExe()) { |
| 1380 | if (self.base.isExe() and self.linkerDefinedPtr().?.entry_index == null) { |
| 1389 | 1381 | log.debug("flushing. no_entry_point_found = true", .{}); |
| 1390 | 1382 | comp.link_error_flags.no_entry_point_found = true; |
| 1391 | 1383 | } else { |
| ... | ... | @@ -2917,10 +2909,10 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 2917 | 2909 | mem.writeInt(u32, hdr_buf[index..][0..4], 1, endian); |
| 2918 | 2910 | index += 4; |
| 2919 | 2911 | |
| 2920 | | const e_entry = if (self.entry_index) |entry_index| |
| 2921 | | @as(u64, @intCast(self.symbol(entry_index).address(.{}, self))) |
| 2922 | | else |
| 2923 | | 0; |
| 2912 | const e_entry: u64 = if (self.linkerDefinedPtr()) |obj| blk: { |
| 2913 | const entry_index = obj.entry_index orelse break :blk 0; |
| 2914 | break :blk @intCast(self.symbol(entry_index).address(.{}, self)); |
| 2915 | } else 0; |
| 2924 | 2916 | const phdr_table_offset = if (self.phdr_table_index) |phndx| self.phdrs.items[phndx].p_offset else 0; |
| 2925 | 2917 | switch (self.ptr_width) { |
| 2926 | 2918 | .p32 => { |