llvm-project/lld/test/old-elf/ARM/plt-ifunc-interwork.test

397 lines
14 KiB
Plaintext

# Check that PLT entries are properly generated for cases when
# referenced from both ARM and Thumb code.
#
# 1. ARM code generates PLT without transition veneer.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-ONE %s
# ARM-ONE: Contents of section .plt:
# ARM-ONE-NEXT: 40007c 00c68fe2 00ca8ce2 7cffbce5
# ^ regular veneer ^
# Next line shows that .plt section ends.
# ARM-ONE-NEXT: Contents of section .text:
# 2. Thumb code generates PLT with transition veneer.
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s
# THM-ONE: Contents of section .plt:
# THM-ONE-NEXT: 40007c 78470000 00c68fe2 00ca8ce2 78ffbce5
# bx pc ^^ ^ regular veneer ^
# Next line shows that .plt section ends.
# THM-ONE-NEXT: Contents of section .text:
# 3. ARM + Thumb code generate same single PLT with transition veneer.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o
# RUN: yaml2obj -format=elf -docnum 3 %s > %t-f1-thm-for-arm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f1-thm-for-arm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s
# 4. Thumb + ARM code generate same single PLT with transition veneer.
# RUN: yaml2obj -format=elf -docnum 3 %s > %t-f1-thm-for-arm.o
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-thm-for-arm.o %t-f1-arm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ONE %s
# 5. ARM + ARM code generate two PLTs without transition veneers.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o
# RUN: yaml2obj -format=elf -docnum 4 %s > %t-f2-arm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f2-arm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-TWO %s
# ARM-TWO: Contents of section .plt:
# ARM-TWO-NEXT: 400084 00c68fe2 00ca8ce2 74ffbce5 00c68fe2
# ^ regular veneer 1 ^ ^ --
# ARM-TWO-NEXT: 400094 00ca8ce2 6cffbce5
# --- regular veneer 2 ^
# Next line shows that .plt section ends.
# ARM-TWO-NEXT: Contents of section .text:
# 6. ARM + Thumb code generate two PLTs without and with transition veneer.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-f1-arm.o
# RUN: yaml2obj -format=elf -docnum 5 %s > %t-f2-thm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-arm.o %t-f2-thm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=ARM-THM-TWO %s
# ARM-THM-TWO: Contents of section .plt:
# ARM-THM-TWO-NEXT: 400084 00c68fe2 00ca8ce2 74ffbce5 78470000
# ^ regular veneer 1 ^ ^^ bx pc 2
# ARM-THM-TWO-NEXT: 400094 00c68fe2 00ca8ce2 68ffbce5
# ^ regular veneer 2 ^
# Next line shows that .plt section ends.
# ARM-THM-TWO-NEXT: Contents of section .text:
# 7. Thumb + ARM code generate two PLTs with and without transition veneer.
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o
# RUN: yaml2obj -format=elf -docnum 4 %s > %t-f2-arm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o %t-f2-arm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-ARM-TWO %s
# THM-ARM-TWO: Contents of section .plt:
# THM-ARM-TWO-NEXT: 400084 78470000 00c68fe2 00ca8ce2 70ffbce
# bx pc 1 ^^ ^ regular veneer 1 ^
# THM-ARM-TWO-NEXT: 400094 00c68fe2 00ca8ce2 68ffbce5
# ^ regular veneer 2 ^
# Next line shows that .plt section ends.
# THM-ARM-TWO-NEXT: Contents of section .text:
# 8. Thumb + Thumb code generate two PLTs with transition veneers.
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-f1-thm.o
# RUN: yaml2obj -format=elf -docnum 5 %s > %t-f2-thm.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-thm.o %t-f2-thm.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-TWO %s
# THM-TWO: Contents of section .plt:
# THM-TWO-NEXT: 400084 78470000 00c68fe2 00ca8ce2 70ffbce5
# bx pc 1 ^^ ^ regular veneer 1 ^
# THM-TWO-NEXT: 400094 78470000 00c68fe2 00ca8ce2 64ffbce5
# bx pc 2 ^^ ^ regular veneer 2 ^
# Next line shows that .plt section ends.
# THM-TWO-NEXT: Contents of section .text:
# 9. Thumb code generates PLT without transition veneer when bl->blx is done.
# RUN: yaml2obj -format=elf -docnum 6 %s > %t-f1-thm-c.o
# RUN: lld -flavor old-gnu -target arm-linux-gnu \
# RUN: -Bstatic --noinhibit-exec %t-f1-thm-c.o -o %t
# RUN: llvm-objdump -s %t | FileCheck -check-prefix=THM-BL %s
# THM-BL: Contents of section .plt:
# THM-BL-NEXT: 40007c 00c68fe2 00ca8ce2 7cffbce5
# ^ regular veneer ^
# Next line shows that .plt section ends.
# THM-BL-NEXT: Contents of section .text:
# f1-arm.o
---
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: 04B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000008
Symbol: main
Type: R_ARM_MOVW_ABS_NC
- Offset: 0x000000000000000C
Symbol: main
Type: R_ARM_MOVT_ABS
- Offset: 0x0000000000000028
Symbol: f1
Type: R_ARM_JUMP24
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f1
Type: STT_GNU_IFUNC
Section: .text
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000020
# f1-thm.o
---
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: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEBF0346184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: main
Type: R_ARM_THM_MOVW_ABS_NC
- Offset: 0x0000000000000008
Symbol: main
Type: R_ARM_THM_MOVT_ABS
- Offset: 0x000000000000001C
Symbol: f1
Type: R_ARM_THM_JUMP24
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f1
Type: STT_GNU_IFUNC
Section: .text
Value: 0x0000000000000001
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000019
# f1-thm-for-arm.o
---
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: 80B500AFFFF7FEBF0346184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: f1
Type: R_ARM_THM_JUMP24
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f
Type: STT_FUNC
Section: .text
Value: 0x0000000000000001
- Name: f1
# f2-arm.o
---
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: 04B02DE500B08DE2003000E3003040E30300A0E100D04BE204B09DE41EFF2FE100482DE904B08DE2FEFFFFEA0030A0E10300A0E10088BDE8
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000008
Symbol: f
Type: R_ARM_MOVW_ABS_NC
- Offset: 0x000000000000000C
Symbol: f
Type: R_ARM_MOVT_ABS
- Offset: 0x0000000000000028
Symbol: f2
Type: R_ARM_JUMP24
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f2
Type: STT_GNU_IFUNC
Section: .text
- Name: f
Type: STT_FUNC
Section: .text
Value: 0x0000000000000020
# f2-thm.o
---
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: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEBF0346184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: f
Type: R_ARM_THM_MOVW_ABS_NC
- Offset: 0x0000000000000008
Symbol: f
Type: R_ARM_THM_MOVT_ABS
- Offset: 0x000000000000001C
Symbol: f2
Type: R_ARM_THM_JUMP24
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f2
Type: STT_GNU_IFUNC
Section: .text
Value: 0x0000000000000001
- Name: f
Type: STT_FUNC
Section: .text
Value: 0x0000000000000019
# f1-thm-c.o
---
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: 80B400AF40F20003C0F200031846BD465DF8047B704700BF80B500AFFFF7FEFF0346184680BD00BF
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x0000000000000004
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: main
Type: R_ARM_THM_MOVW_ABS_NC
- Offset: 0x0000000000000008
Symbol: main
Type: R_ARM_THM_MOVT_ABS
- Offset: 0x000000000000001C
Symbol: f1
Type: R_ARM_THM_CALL
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000001
Symbols:
Global:
- Name: f1
Type: STT_GNU_IFUNC
Section: .text
Value: 0x0000000000000001
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000019
...