[PATCH] D16201: [ELF/AArch64] - Implemented set of R_AARCH64_TLSDESC_* relocations.
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 13:59:24 PST 2016
zatrazz added a comment.
I am also not sure about the position of the TLSDESC relocation, I will check that.
I also noted that the patches does not create dynamic R_AARCH64_TLSDESC relocations against local symbols. For instance:
__thread int v1;
static __thread int v2;
// We don't use these pointers, but putting them in tests alignment on
// a 64-bit target.
__thread char* p1;
char dummy;
__thread char* p2 = &dummy;
__thread int v3 = 3;
static __thread int v4 = 4;
__thread int v5;
static __thread int v6;
int*
f() {
return &v2;
}
clang++ -target aarch64-linux-gnu -fpic test.cc -c -o test.o
clang++ -target aarch64-linux-gnu -fpic test.o -shared -o test.so
Improper alignment for relocation R_AARCH64_TLSDESC_LD64_LO12_NC
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
It is due the fact is passing the wrong value on relocateOne (...). Also to avoid extra bogus dynamic relocations with recent changes in trunk I am using:
diff --git a/ELF/Target.cpp b/ELF/Target.cpp
index dbe0cc5..fef5b60 100644
--- a/ELF/Target.cpp
+++ b/ELF/Target.cpp
@@ -1220,11 +1220,14 @@ AArch64TargetInfo::AArch64TargetInfo() {
}
bool AArch64TargetInfo::isRelRelative(uint32_t Type) const {
- return Type == R_AARCH64_PREL32 || Type == R_AARCH64_ADR_PREL_PG_HI21 ||
- Type == R_AARCH64_LDST8_ABS_LO12_NC ||
- Type == R_AARCH64_LDST32_ABS_LO12_NC ||
- Type == R_AARCH64_LDST64_ABS_LO12_NC ||
- Type == R_AARCH64_ADD_ABS_LO12_NC || Type == R_AARCH64_CALL26;
+ switch (Type) {
+ default:
+ return true;
+ case R_AARCH64_ABS64:
+ case R_AARCH64_ADR_GOT_PAGE:
+ case R_AARCH64_LD64_GOT_LO12_NC:
+ return !Config->Shared;
+ }
}
Which I intend to create a patch to simplify the logic on dynamic relocation creation.
http://reviews.llvm.org/D16201
More information about the llvm-commits
mailing list