Skip to content

Commit 3b51e24

Browse files
xguptanavaneethshan
authored andcommitted
[llvm-dwarfdump] Support R_AARCH64_TLS_DTPREL64 in Object/RelocationResolver.cpp (#187649)
In patch llvm/llvm-project#146572 we have plan to emit R_AARCH64_TLS_DTPREL64. This give us the warning while using llvm-dwarfdump for the object file which has tls variables - warning: failed to compute relocation: R_AARCH64_TLS_DTPREL64, Invalid data was encountered while parsing the file To fix this warning we have mark the relocation as supported however final absolute address of a TLS variable is determined at runtime, resolving to the symbol's section-relative offset in the object file is mitigate the warning. (cherry picked from commit fa136df)
1 parent bde23d6 commit 3b51e24

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎llvm/lib/Object/RelocationResolver.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static bool supportsAArch64(uint64_t Type) {
7979
case ELF::R_AARCH64_PREL16:
8080
case ELF::R_AARCH64_PREL32:
8181
case ELF::R_AARCH64_PREL64:
82+
case ELF::R_AARCH64_TLS_DTPREL64:
8283
return true;
8384
default:
8485
return false;
@@ -91,6 +92,7 @@ static uint64_t resolveAArch64(uint64_t Type, uint64_t Offset, uint64_t S,
9192
case ELF::R_AARCH64_ABS32:
9293
return (S + Addend) & 0xFFFFFFFF;
9394
case ELF::R_AARCH64_ABS64:
95+
case ELF::R_AARCH64_TLS_DTPREL64:
9496
return S + Addend;
9597
case ELF::R_AARCH64_PREL16:
9698
return (S + Addend - Offset) & 0xFFFF;

‎llvm/test/DebugInfo/AArch64/tls-at-location.ll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: llc -O0 -mtriple=aarch64 --aarch64-emit-debug-tls-location -filetype=obj < %s \
2-
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=TLS
2+
; RUN: | llvm-dwarfdump - 2>&1 | FileCheck %s --check-prefix=TLS --implicit-check-not=warning:
33

44
; RUN: llc -O0 -mtriple=aarch64 --aarch64-emit-debug-tls-location=false -filetype=obj < %s \
55
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=NO-TLS

0 commit comments

Comments
 (0)