@@ -515,32 +515,6 @@ struct DataInCodeRecord { |
| 515 | 515 | kind: u16, |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | | -fn normalized_unwind_words(bytes: &[u8]) -> Vec<u32> { |
| 519 | | - let (_, unwind) = output_section(bytes, "__TEXT", "__unwind_info").unwrap(); |
| 520 | | - let decoded = decode_unwind_info(&unwind).unwrap(); |
| 521 | | - let mut words: Vec<u32> = unwind |
| 522 | | - .chunks_exact(4) |
| 523 | | - .map(|chunk| u32::from_le_bytes(chunk.try_into().unwrap())) |
| 524 | | - .collect(); |
| 525 | | - if words.len() < 7 { |
| 526 | | - return words; |
| 527 | | - } |
| 528 | | - let indices_offset_words = words[5] as usize / 4; |
| 529 | | - let indices_count = words[6] as usize; |
| 530 | | - if indices_count == 0 || words.len() < indices_offset_words + indices_count * 3 { |
| 531 | | - return words; |
| 532 | | - } |
| 533 | | - let base = words[indices_offset_words]; |
| 534 | | - for idx in 0..indices_count { |
| 535 | | - let word = indices_offset_words + idx * 3; |
| 536 | | - words[word] = words[word].saturating_sub(base); |
| 537 | | - } |
| 538 | | - if !decoded.records.is_empty() { |
| 539 | | - assert_eq!(decoded.records[0].function_offset, base); |
| 540 | | - } |
| 541 | | - words |
| 542 | | -} |
| 543 | | - |
| 544 | 518 | fn rebased_unwind_bytes(bytes: &[u8]) -> Vec<u8> { |
| 545 | 519 | let header_base = segment_vmaddr(bytes, "__TEXT").unwrap_or(0); |
| 546 | 520 | let text_base = output_section(bytes, "__TEXT", "__text").unwrap().0 - header_base; |
@@ -4119,8 +4093,8 @@ fn linker_run_emits_backtrace_metadata_like_apple_ld() { |
| 4119 | 4093 | let our_bytes = fs::read(&our_out).unwrap(); |
| 4120 | 4094 | let apple_bytes = fs::read(&apple_out).unwrap(); |
| 4121 | 4095 | assert_eq!( |
| 4122 | | - normalized_unwind_words(&our_bytes), |
| 4123 | | - normalized_unwind_words(&apple_bytes) |
| 4096 | + rebased_unwind_bytes(&our_bytes), |
| 4097 | + rebased_unwind_bytes(&apple_bytes) |
| 4124 | 4098 | ); |
| 4125 | 4099 | assert_eq!( |
| 4126 | 4100 | normalize_function_start_offsets(&decode_function_starts(&our_bytes)), |