mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
721829227e
(This commit restores the original branch (4272372c571) and applies an additional change dropped from the original in a bad merge. This change should address the previous bot failures. Both changes reviewed by pete.) Summary: This commit builds upon Derek Schuff's 2014 commit for attaching labels to existing fragments ( Diff Revision: http://reviews.llvm.org/D5915 ) When temporary labels appear ahead of a fragment, MCObjectStreamer will track the temporary label symbol in a "Pending Labels" list. Labels are associated with fragments when a real fragment arrives; otherwise, an empty data fragment will be created if the streamer's section changes or if the stream finishes. This commit moves the "Pending Labels" list into each MCStream, so that this label-fragment matching process is resilient to section changes. If the streamer emits a label in a new section, switches to another section to do other work, then switches back to the first section and emits a fragment, that initial label will be associated with this new fragment. Labels will only receive empty data fragments in the case where no other fragment exists for that section. The downstream effects of this can be seen in Mach-O relocations. The previous approach could produce local section relocations and external symbol relocations for the same data in an object file, and this mix of relocation types resulted in problems in the ld64 Mach-O linker. This commit ensures relocations triggered by temporary labels are consistent. Reviewers: pete, ab, dschuff Reviewed By: pete, dschuff Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71368
49 lines
1.5 KiB
ArmAsm
49 lines
1.5 KiB
ArmAsm
// Verify relocations for temporary labels are referenced by real symbols
|
|
// at the same address.
|
|
//
|
|
// RUN: llvm-mc -triple x86_64-apple-darwin -filetype=obj -o - %s | llvm-objdump -r - | FileCheck %s
|
|
|
|
L1:
|
|
.section __TEXT,__text_cold,regular,pure_instructions
|
|
L2:
|
|
.text
|
|
L3:
|
|
.section __TEXT,__text_cold,regular,pure_instructions
|
|
L4:
|
|
_function2:
|
|
L5:
|
|
nop
|
|
L6:
|
|
.text
|
|
L7:
|
|
_function1:
|
|
L8:
|
|
nop
|
|
|
|
.data
|
|
__data:
|
|
.quad L1-.
|
|
.quad L2-.
|
|
.quad L3-.
|
|
.quad L4-.
|
|
.quad L5-.
|
|
.quad L6-.
|
|
.quad L7-.
|
|
.quad L8-.
|
|
// CHECK: 0000000000000038 X86_64_RELOC_SUBTRACTOR _function1-__data
|
|
// CHECK: 0000000000000038 X86_64_RELOC_UNSIGNED _function1
|
|
// CHECK: 0000000000000030 X86_64_RELOC_SUBTRACTOR _function1-__data
|
|
// CHECK: 0000000000000030 X86_64_RELOC_UNSIGNED _function1
|
|
// CHECK: 0000000000000028 X86_64_RELOC_SUBTRACTOR _function2-__data
|
|
// CHECK: 0000000000000028 X86_64_RELOC_UNSIGNED _function2
|
|
// CHECK: 0000000000000020 X86_64_RELOC_SUBTRACTOR _function2-__data
|
|
// CHECK: 0000000000000020 X86_64_RELOC_UNSIGNED _function2
|
|
// CHECK: 0000000000000018 X86_64_RELOC_SUBTRACTOR _function2-__data
|
|
// CHECK: 0000000000000018 X86_64_RELOC_UNSIGNED _function2
|
|
// CHECK: 0000000000000010 X86_64_RELOC_SUBTRACTOR _function1-__data
|
|
// CHECK: 0000000000000010 X86_64_RELOC_UNSIGNED _function1
|
|
// CHECK: 0000000000000008 X86_64_RELOC_SUBTRACTOR _function2-__data
|
|
// CHECK: 0000000000000008 X86_64_RELOC_UNSIGNED _function2
|
|
// CHECK: 0000000000000000 X86_64_RELOC_SUBTRACTOR _function1-__data
|
|
// CHECK: 0000000000000000 X86_64_RELOC_UNSIGNED _function1
|