| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # 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 gnu -target arm -m armelf_linux_eabi -Bstatic \ | ||
| # RUN: -e plt_func %t-o.o -o %t | ||
| # RUN: llvm-objdump -s -t %t -disassemble | FileCheck %s | ||
|
|
||
| # CHECK: Disassembly of section .text: | ||
| # CHECK: plt_func: | ||
| # CHECK: 400074: 00 c6 8f e2 add r12, pc, #0, #12 | ||
| # ^ after execution: r12=0x40007c | ||
| # CHECK: 400078: 00 ca 8c e2 add r12, r12, #0, #20 | ||
| # ^ after execution: r12=0x40007C | ||
| # CHECK: 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 | ||
| ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Check handling of IFUNC (gnu_indirect_function). | ||
| # RUN: yaml2obj -format=elf %s > %t-o.o | ||
| # RUN: lld -flavor gnu -target arm -m armelf_linux_eabi -Bstatic \ | ||
| # RUN: %t-o.o -o %t | ||
| # RUN: llvm-objdump -s -t %t | FileCheck %s | ||
|
|
||
| # CHECK: Contents of section .rel.plt: | ||
| # CHECK: 400074 00104000 | ||
| # CHECK: Contents of section .plt: | ||
| # CHECK: 400080 00c68fe2 00ca8ce2 78ffbce5 | ||
| # CHECK: Contents of section .text: | ||
| # CHECK: 4001ac 00482de9 04b08de2 d4ffffeb b0ffffeb | ||
| # ^ bl #-320 (to address 0x400080=__plt_ifunc_myfunc) | ||
| # CHECK: Contents of section .got.plt: | ||
| # CHECK: 401000 c4004000 | ||
| # CHECK: SYMBOL TABLE: | ||
| # CHECK: 00400080 l F .plt 0000000c __plt_ifunc_myfunc | ||
| # CHECK: 004000c4 g .text 00000020 myfunc | ||
| # CHECK: 00400074 g *ABS* 00000000 __rel_iplt_start | ||
| # CHECK: 0040007c g *ABS* 00000000 __rel_iplt_end | ||
|
|
||
| --- | ||
| FileHeader: | ||
| Class: ELFCLASS32 | ||
| Data: ELFDATA2LSB | ||
| Type: ET_REL | ||
| Machine: EM_ARM | ||
| Flags: [ EF_ARM_EABI_VER5 ] | ||
| Sections: | ||
| - Name: .text | ||
| Type: SHT_PROGBITS | ||
| Flags: [ SHF_ALLOC, SHF_EXECINSTR ] | ||
| AddressAlign: 0x0000000000000004 | ||
| Content: 04B02DE500B08DE20130A0E30300A0E100D04BE204B09DE41EFF2FE104B02DE500B08DE20230A0E30300A0E100D04BE204B09DE41EFF2FE104B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE208D04DE208000BE508301BE533FF2FE10030A0E10300A0E104D04BE20088BDE800482DE904B08DE210D04DE2003000E3003040E308300BE5190000EA08301BE50C300BE50C301BE5003093E510300BE50C301BE5043093E57330EFE614300BE514301BE5A00053E30130A0030030A0137330EFE6000053E30600000A10301BE5003093E50300A0E1DAFFFFEB0020A0E110301BE5002083E508301BE5083083E208300BE508201BE5003000E3003040E3030052E1E0FFFF3A04D04BE20088BDE800482DE904B08DE2D4FFFFEBFEFFFFEB0030A0E30300A0E10088BDE8 | ||
| - Name: .rel.text | ||
| Type: SHT_REL | ||
| Link: .symtab | ||
| AddressAlign: 0x0000000000000004 | ||
| Info: .text | ||
| Relocations: | ||
| - Offset: 0x0000000000000040 | ||
| Symbol: myfunc1 | ||
| Type: R_ARM_MOVW_ABS_NC | ||
| - Offset: 0x0000000000000044 | ||
| Symbol: myfunc1 | ||
| Type: R_ARM_MOVT_ABS | ||
| - Offset: 0x000000000000008C | ||
| Symbol: __rel_iplt_start | ||
| Type: R_ARM_MOVW_ABS_NC | ||
| - Offset: 0x0000000000000090 | ||
| Symbol: __rel_iplt_start | ||
| Type: R_ARM_MOVT_ABS | ||
| - Offset: 0x0000000000000108 | ||
| Symbol: __rel_iplt_end | ||
| Type: R_ARM_MOVW_ABS_NC | ||
| - Offset: 0x000000000000010C | ||
| Symbol: __rel_iplt_end | ||
| Type: R_ARM_MOVT_ABS | ||
| - Offset: 0x000000000000012C | ||
| Symbol: myfunc | ||
| Type: R_ARM_CALL | ||
| Symbols: | ||
| Local: | ||
| - Name: .text | ||
| Type: STT_SECTION | ||
| Section: .text | ||
| - Name: '$a' | ||
| Section: .text | ||
| - Name: elf_ifunc_invoke | ||
| Type: STT_FUNC | ||
| Section: .text | ||
| Value: 0x0000000000000058 | ||
| Size: 0x0000000000000028 | ||
| - Name: apply_irel | ||
| Type: STT_FUNC | ||
| Section: .text | ||
| Value: 0x0000000000000080 | ||
| Size: 0x00000000000000A0 | ||
| Global: | ||
| - Name: myfunc1 | ||
| Type: STT_FUNC | ||
| Section: .text | ||
| Size: 0x000000000000001C | ||
| - Name: myfunc2 | ||
| Type: STT_FUNC | ||
| Section: .text | ||
| Value: 0x000000000000001C | ||
| Size: 0x000000000000001C | ||
| - Name: myfunc | ||
| Type: STT_GNU_IFUNC | ||
| Section: .text | ||
| Value: 0x0000000000000038 | ||
| Size: 0x0000000000000020 | ||
| - Name: _start | ||
| Type: STT_FUNC | ||
| Section: .text | ||
| Value: 0x0000000000000120 | ||
| Size: 0x000000000000001C | ||
| Weak: | ||
| - Name: __rel_iplt_start | ||
| - Name: __rel_iplt_end | ||
| ... |