| ... | ... | @@ -4331,7 +4331,17 @@ fn allocateAllocSections(self: *Elf) error{OutOfMemory}!void { |
| 4331 | 4331 | |
| 4332 | 4332 | /// Allocates alloc sections when merging relocatable objects files together. |
| 4333 | 4333 | fn allocateAllocSectionsObject(self: *Elf) !void { |
| 4334 | | _ = self; |
| 4334 | for (self.shdrs.items) |*shdr| { |
| 4335 | if (shdr.sh_type == elf.SHT_NULL) continue; |
| 4336 | if (shdr.sh_flags & elf.SHF_ALLOC == 0) continue; |
| 4337 | const needed_size = shdr.sh_size; |
| 4338 | if (needed_size > self.allocatedSize(shdr.sh_offset)) { |
| 4339 | shdr.sh_size = 0; |
| 4340 | const new_offset = self.findFreeSpace(needed_size, shdr.sh_addralign); |
| 4341 | shdr.sh_offset = new_offset; |
| 4342 | shdr.sh_size = needed_size; |
| 4343 | } |
| 4344 | } |
| 4335 | 4345 | } |
| 4336 | 4346 | |
| 4337 | 4347 | /// Allocates non-alloc sections (debug info, symtabs, etc.). |