diff options
| -rw-r--r-- | lld/ELF/Target.cpp | 1 | ||||
| -rw-r--r-- | lld/test/ELF/arm-pie-relative.s | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 51060511f94..359465911e5 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -1739,6 +1739,7 @@ void ARMTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type, case R_ARM_GOT_BREL: case R_ARM_GOT_PREL: case R_ARM_REL32: + case R_ARM_RELATIVE: case R_ARM_TARGET1: case R_ARM_TARGET2: case R_ARM_TLS_GD32: diff --git a/lld/test/ELF/arm-pie-relative.s b/lld/test/ELF/arm-pie-relative.s new file mode 100644 index 00000000000..223fcca08a2 --- /dev/null +++ b/lld/test/ELF/arm-pie-relative.s @@ -0,0 +1,25 @@ +// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t +// RUN: ld.lld %t --pie -o %t2 +// RUN: llvm-readobj -r %t2 | FileCheck %s +// RUN: llvm-objdump -s %t2 | FileCheck %s --check-prefix=GOT +// REQUIRES: arm + +// Test that a R_ARM_GOT_BREL relocation with PIE results in a R_ARM_RELATIVE +// dynamic relocation + .syntax unified + .text + .global _start +_start: + .word sym(GOT) + + .data + .global sym +sym: + .word 0 + +// CHECK: Relocations [ +// CHECK-NEXT: Section (4) .rel.dyn { +// CHECK-NEXT: 0x2058 R_ARM_RELATIVE + +// GOT: Contents of section .got: +// GOT-NEXT: 2058 00300000 |

