| ... | ... | @@ -207,29 +207,18 @@ pub fn generateSymbol( |
| 207 | 207 | .bytes => { |
| 208 | 208 | // TODO populate .debug_info for the array |
| 209 | 209 | const payload = typed_value.val.castTag(.bytes).?; |
| 210 | | if (typed_value.ty.sentinel()) |sentinel| { |
| 211 | | try code.ensureUnusedCapacity(payload.data.len + 1); |
| 212 | | code.appendSliceAssumeCapacity(payload.data); |
| 213 | | switch (try generateSymbol(bin_file, src_loc, .{ |
| 214 | | .ty = typed_value.ty.elemType(), |
| 215 | | .val = sentinel, |
| 216 | | }, code, debug_output, reloc_info)) { |
| 217 | | .appended => return Result{ .appended = {} }, |
| 218 | | .externally_managed => |slice| { |
| 219 | | code.appendSliceAssumeCapacity(slice); |
| 220 | | return Result{ .appended = {} }; |
| 221 | | }, |
| 222 | | .fail => |em| return Result{ .fail = em }, |
| 223 | | } |
| 224 | | } else { |
| 225 | | return Result{ .externally_managed = payload.data }; |
| 226 | | } |
| 210 | const len = @intCast(usize, typed_value.ty.arrayLenIncludingSentinel()); |
| 211 | // The bytes payload already includes the sentinel, if any |
| 212 | try code.ensureUnusedCapacity(len); |
| 213 | code.appendSliceAssumeCapacity(payload.data[0..len]); |
| 214 | return Result{ .appended = {} }; |
| 227 | 215 | }, |
| 228 | 216 | .aggregate => { |
| 229 | 217 | // TODO populate .debug_info for the array |
| 230 | 218 | const elem_vals = typed_value.val.castTag(.aggregate).?.data; |
| 231 | 219 | const elem_ty = typed_value.ty.elemType(); |
| 232 | | for (elem_vals) |elem_val| { |
| 220 | const len = @intCast(usize, typed_value.ty.arrayLenIncludingSentinel()); |
| 221 | for (elem_vals[0..len]) |elem_val| { |
| 233 | 222 | switch (try generateSymbol(bin_file, src_loc, .{ |
| 234 | 223 | .ty = elem_ty, |
| 235 | 224 | .val = elem_val, |