| ... | @@ -289,8 +289,10 @@ pub fn prepareTLS(area: []u8) usize { | ... | @@ -289,8 +289,10 @@ pub fn prepareTLS(area: []u8) usize { |
| 289 | // Copy the data | 289 | // Copy the data |
| 290 | mem.copy(u8, area[tls_image.data_offset..], tls_image.init_data); | 290 | mem.copy(u8, area[tls_image.data_offset..], tls_image.init_data); |
| 291 | | 291 | |
| 292 | // Return the corrected (if needed) value for the tp register | 292 | // Return the corrected value (if needed) for the tp register. |
| 293 | return @ptrToInt(area.ptr) + tls_tp_offset + | 293 | // Overflow here is not a problem, the pointer arithmetic involving the tp |
| | 294 | // is done with wrapping semantics. |
| | 295 | return @ptrToInt(area.ptr) +% tls_tp_offset +% |
| 294 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; | 296 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; |
| 295 | } | 297 | } |
| 296 | | 298 | |