mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
d8ee23f34c
The only difference from r219829 is using getOrCreateSectionSymbol(*ELFSec) instead of GetOrCreateSymbol(ELFSec->getSectionName()) in ELFObjectWriter which causes us to use the correct section symbol even if we have multiple sections with the same name. Original messages: r219829: Correctly handle references to section symbols. When processing assembly like .long .text we were creating a new undefined symbol .text. GAS on the other hand would handle that as a reference to the .text section. This patch implements that by creating the section symbols earlier so that they are visible during asm parsing. The patch also updates llvm-readobj to print the symbol number in the relocation dump so that the test can differentiate between two sections with the same name. r219835: Allow forward references to section symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220021 91177308-0d34-0410-b5e6-96231b3b80d8
92 lines
2.2 KiB
ArmAsm
92 lines
2.2 KiB
ArmAsm
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -t -r --expand-relocs | FileCheck %s
|
|
|
|
.section foo, "aG", @progbits, f1, comdat
|
|
.section foo, "G", @progbits, f2, comdat
|
|
.section bar
|
|
.long foo
|
|
|
|
// Test that the relocation points to the first section foo.
|
|
|
|
// The first seciton foo has index 6
|
|
// CHECK: Section {
|
|
// CHECK: Index: 6
|
|
// CHECK-NEXT: Name: foo (28)
|
|
// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
|
|
// CHECK-NEXT: Flags [ (0x202)
|
|
// CHECK-NEXT: SHF_ALLOC (0x2)
|
|
// CHECK-NEXT: SHF_GROUP (0x200)
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: Address: 0x0
|
|
// CHECK-NEXT: Offset: 0x50
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Link: 0
|
|
// CHECK-NEXT: Info: 0
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
// CHECK-NEXT: EntrySize: 0
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Section {
|
|
// CHECK-NEXT: Index: 7
|
|
// CHECK-NEXT: Name: foo (28)
|
|
// CHECK-NEXT: Type: SHT_PROGBITS (0x1)
|
|
// CHECK-NEXT: Flags [ (0x200)
|
|
// CHECK-NEXT: SHF_GROUP (0x200)
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: Address: 0x0
|
|
// CHECK-NEXT: Offset: 0x50
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Link: 0
|
|
// CHECK-NEXT: Info: 0
|
|
// CHECK-NEXT: AddressAlignment: 1
|
|
// CHECK-NEXT: EntrySize: 0
|
|
// CHECK-NEXT: }
|
|
|
|
// The relocation points to symbol 6
|
|
// CHECK: Relocations [
|
|
// CHECK-NEXT: Section (9) .relabar {
|
|
// CHECK-NEXT: Relocation {
|
|
// CHECK-NEXT: Offset: 0x0
|
|
// CHECK-NEXT: Type: R_X86_64_32 (10)
|
|
// CHECK-NEXT: Symbol: foo (6)
|
|
// CHECK-NEXT: Addend: 0x0
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
|
|
|
|
// The symbol 6 corresponds section 6
|
|
// CHECK: Symbols [
|
|
|
|
// symbol 0
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name:
|
|
|
|
// symbol 1
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: f1
|
|
|
|
// symbol 2
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: f2
|
|
|
|
// symbol 3
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: .text
|
|
|
|
// symbol 4
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: .data
|
|
|
|
// symbol 5
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: .bss
|
|
|
|
// symbol 6
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: foo
|
|
// CHECK: Section: foo (0x6)
|
|
|
|
// symbol 7
|
|
// CHECK-NOT: Name
|
|
// CHECK: Name: foo
|
|
// CHECK: Section: foo (0x7)
|