llvm.org GIT mirror llvm / master test / tools / llvm-objcopy / ELF / dynamic-relocations.test
master

Tree @master (Download .tar.gz)

dynamic-relocations.test @masterraw · history · blame

## Check that llvm-objcopy can handle an object
## containing dynamic relocations properly.

# RUN: yaml2obj %s > %t1
# RUN: llvm-objcopy %t1 %t2
# RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s

# CHECK:         Name: .rela.plt
# CHECK-NEXT:    Type: SHT_RELA
# CHECK-NEXT:    Flags [
# CHECK-NEXT:      SHF_ALLOC
# CHECK-NEXT:    ]
# CHECK-NEXT:    Address:
# CHECK-NEXT:    Offset:
# CHECK-NEXT:    Size: 24
# CHECK-NEXT:    Link:
# CHECK-NEXT:    Info:
# CHECK-NEXT:    AddressAlignment: 8
# CHECK-NEXT:    EntrySize: 24
# CHECK-NEXT:    SectionData (
# CHECK-NEXT:       0000: 18202000 00000000 07000000 01000000  |.  .............|
# CHECK-NEXT:       0010: 00000000 00000000                    |........|
# CHECK-NEXT:    )

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:         .rela.plt
    Type:         SHT_RELA
    Flags:        [ SHF_ALLOC ]
    Address:      0x0000000000200220
    Link:         0
    AddressAlign: 0x0000000000000008
    Relocations:
      - Offset: 0x0000000000202018
        Symbol: foo
        Type:   R_X86_64_JUMP_SLOT
Symbols:
  - Name:    foo
    Binding: STB_GLOBAL