# Check handling of group relocations (R_ARM_ALU_PC_G0_NC, R_ARM_ALU_PC_G1_NC, # R_ARM_LDR_PC_G2). # # RUN: yaml2obj -format=elf %s > %t-o.o # RUN: lld -flavor old-gnu -target arm -m armelf_linux_eabi -Bstatic \ # RUN: -e plt_func %t-o.o -o %t # RUN: llvm-objdump -s -t %t | FileCheck %s # CHECK: Contents of section .text: # CHECK: 400074 00c68fe2 00ca8ce2 84ffbce5 # Disassembly of section .text: # plt_func: # 400074: 00 c6 8f e2 add r12, pc, #0, #12 # ^ after execution: r12=0x40007c # 400078: 00 ca 8c e2 add r12, r12, #0, #20 # ^ after execution: r12=0x40007C # 40007c: 84 ff bc e5 ldr pc, [r12, #3972]! # ^ referenced address is 0x401000, after execution pc=0x400074 # CHECK: Contents of section .data: # CHECK: 401000 74004000 # ^ this value is written to pc after execution of comand 0x40007c # ^ this address is referenced by command at 0x40007c # CHECK: SYMBOL TABLE: # CHECK: 00400074 g F .text 0000000c plt_func # CHECK: 00401000 g .data 00000004 got_func --- FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_ARM Sections: - Name: .text Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] AddressAlign: 0x4 Content: 00C08FE200C08CE200F0BCE5 - Name: .rela.text Type: SHT_RELA Link: .symtab Info: .text AddressAlign: 0x4 Relocations: - Offset: 0 Symbol: got_func Type: R_ARM_ALU_PC_G0_NC Addend: -8 - Offset: 0x4 Symbol: got_func Type: R_ARM_ALU_PC_G1_NC Addend: -4 - Offset: 0x8 Symbol: got_func Type: R_ARM_LDR_PC_G2 - Name: .data Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x4 Content: 74004000 Symbols: Local: Global: - Name: plt_func Type: STT_FUNC Section: .text Size: 0xC - Name: got_func Section: .data Size: 0x4 ...