| ... | @@ -146,13 +146,14 @@ pub fn parseObject( | ... | @@ -146,13 +146,14 @@ pub fn parseObject( |
| 146 | archive: Archive, | 146 | archive: Archive, |
| 147 | wasm: *Wasm, | 147 | wasm: *Wasm, |
| 148 | file_contents: []const u8, | 148 | file_contents: []const u8, |
| | 149 | object_offset: u32, |
| 149 | path: Path, | 150 | path: Path, |
| 150 | host_name: Wasm.OptionalString, | 151 | host_name: Wasm.OptionalString, |
| 151 | scratch_space: *Object.ScratchSpace, | 152 | scratch_space: *Object.ScratchSpace, |
| 152 | must_link: bool, | 153 | must_link: bool, |
| 153 | gc_sections: bool, | 154 | gc_sections: bool, |
| 154 | ) !Object { | 155 | ) !Object { |
| 155 | const header = mem.bytesAsValue(Header, file_contents[0..@sizeOf(Header)]); | 156 | const header = mem.bytesAsValue(Header, file_contents[object_offset..][0..@sizeOf(Header)]); |
| 156 | if (!mem.eql(u8, &header.fmag, ARFMAG)) return error.BadHeaderDelimiter; | 157 | if (!mem.eql(u8, &header.fmag, ARFMAG)) return error.BadHeaderDelimiter; |
| 157 | | 158 | |
| 158 | const name_or_index = try header.nameOrIndex(); | 159 | const name_or_index = try header.nameOrIndex(); |
| ... | @@ -166,7 +167,7 @@ pub fn parseObject( | ... | @@ -166,7 +167,7 @@ pub fn parseObject( |
| 166 | }; | 167 | }; |
| 167 | | 168 | |
| 168 | const object_file_size = try header.parsedSize(); | 169 | const object_file_size = try header.parsedSize(); |
| 169 | const contents = file_contents[@sizeOf(Header)..][0..object_file_size]; | 170 | const contents = file_contents[object_offset + @sizeOf(Header) ..][0..object_file_size]; |
| 170 | | 171 | |
| 171 | return Object.parse(wasm, contents, path, object_name, host_name, scratch_space, must_link, gc_sections); | 172 | return Object.parse(wasm, contents, path, object_name, host_name, scratch_space, must_link, gc_sections); |
| 172 | } | 173 | } |