mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-27 15:29:51 +00:00
For COFF and MachO, sections semantically have relocations that apply to them. That is not the case on ELF. In relocatable objects (.o), a section with relocations in ELF has offsets to another section where the relocations should be applied. In dynamic objects and executables, relocations don't have an offset, they have a virtual address. The section sh_info may or may not point to another section, but that is not actually used for resolving the relocations. This patch exposes that in the ObjectFile API. It has the following advantages: * Most (all?) clients can handle this more efficiently. They will normally walk all relocations, so doing an effort to iterate in a particular order doesn't save time. * llvm-readobj now prints relocations in the same way the native readelf does. * probably most important, relocations that don't point to any section are now visible. This is the case of relocations in the rela.dyn section. See the updated relocation-executable.test for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182908 91177308-0d34-0410-b5e6-96231b3b80d8
27 lines
754 B
ArmAsm
27 lines
754 B
ArmAsm
// RUN: llvm-mc -g -triple i686-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
|
|
|
|
|
|
// Test that on ELF:
|
|
// 1. the debug info has a relocation to debug_abbrev and one to to debug_line.
|
|
// 2. the debug_aranges has relocations to text and debug_line.
|
|
|
|
|
|
.text
|
|
.globl foo
|
|
.type foo, @function
|
|
.align 4
|
|
foo:
|
|
ret
|
|
.size foo, .-foo
|
|
|
|
// CHECK: Relocations [
|
|
// CHECK: Section ({{[^ ]+}}) .rel.debug_info {
|
|
// CHECK-NEXT: 0x6 R_386_32 .debug_abbrev 0x0
|
|
// CHECK-NEXT: 0xC R_386_32 .debug_line 0x0
|
|
// CHECK: }
|
|
// CHECK-NEXT: Section ({{[^ ]+}}) .rel.debug_aranges {
|
|
// CHECK-NEXT: 0x6 R_386_32 .debug_info 0x0
|
|
// CHECK-NEXT: 0x10 R_386_32 .text 0x0
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|