[lld] [ELF, test] Add test for R_AARCH64_* implicit addends (PR #87733)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 5 09:14:43 PDT 2024
================
@@ -0,0 +1,86 @@
+## Test certain REL relocation types generated by legacy armasm.
+# RUN: yaml2obj %s -o %t.o
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK-COUNT-17: internal linker error: cannot read addend
+
+---
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_AARCH64
+Sections:
+ - Name: .abs
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Content: fffffefffffffdfffffffffffffffcffffffffffffff
+ - Name: .rel.abs
+ Type: SHT_REL
+ Link: .symtab
+ Info: .abs
+ Relocations:
+ - {Offset: 0, Symbol: abs, Type: R_AARCH64_ABS16}
+ - {Offset: 2, Symbol: abs, Type: R_AARCH64_ABS32}
+ - {Offset: 6, Symbol: abs, Type: R_AARCH64_ABS64}
+ - {Offset: 14, Symbol: abs, Type: R_AARCH64_ADD_ABS_LO12_NC}
+
+ - Name: .uabs
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 4
+ Content: 00ffffff00ffffff00ffffff00ffffff00ffffff00ffffff
+ - Name: .rel.uabs
+ Type: SHT_REL
+ Link: .symtab
+ Info: .uabs
+ Relocations:
+ - {Offset: 0, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G0}
+ - {Offset: 4, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G0_NC}
+ - {Offset: 8, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G1}
+ - {Offset: 12, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G1_NC}
+ - {Offset: 16, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G2}
+ - {Offset: 20, Symbol: abs, Type: R_AARCH64_MOVW_UABS_G2_NC}
+
+ - Name: .prel
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 4
+ Content: 00ffffff00ffffff00ffffff00ffffff00ffffff00ffffff
+ - Name: .rel.prel
+ Type: SHT_REL
+ Link: .symtab
+ Info: .prel
+ Relocations:
+ - {Offset: 0, Symbol: .prel, Type: R_AARCH64_PREL64}
+ - {Offset: 4, Symbol: .prel, Type: R_AARCH64_PREL32}
----------------
MaskRay wrote:
I think it is fine to keep `relocation-rel-format.test` unchanged. That file shows that we support REL for certain targets.
https://github.com/llvm/llvm-project/pull/87733
More information about the llvm-commits
mailing list