[PATCH] D26240: [LLD][ARM][AArch64] ARM and AArch64 undefined weak reference values for relative relocations
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 12:09:35 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/InputSection.cpp:261-264
template <class ELFT>
+static uint64_t getARMUndefinedRelativeWeakVA(uint32_t Type,
+ typename ELFT::uint A,
+ typename ELFT::uint P) {
----------------
You can remove `template <class ELFT>` and use uint32_t instad of ELFT::uint or uint64_t, because we know it is ARM32.
================
Comment at: ELF/InputSection.cpp:284-287
+template <class ELFT>
+static uint64_t getAArch64UndefinedRelativeWeakVA(uint32_t Type,
+ typename ELFT::uint A,
+ typename ELFT::uint P) {
----------------
Ditto. ELF::uint -> uint64_t.
================
Comment at: ELF/InputSection.cpp:416
case R_PC:
+ if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak()) {
+ // On ARM and AArch64 a branch to an undefined weak resolves to the
----------------
Doesn't isWeak() imply !isLocal()? I assume that all weak symbols are not weak.
================
Comment at: ELF/InputSection.cpp:421
+ return getARMUndefinedRelativeWeakVA<ELFT>(Type, A, P);
+ else if (Config->EMachine == EM_AARCH64)
+ return getAArch64UndefinedRelativeWeakVA<ELFT>(Type, A, P);
----------------
nit: Since the last one ends with `return`, remove `else`.
================
Comment at: ELF/InputSection.cpp:428
case R_PAGE_PC:
+ if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak())
+ return getAArch64Page(A);
----------------
Ditto.
https://reviews.llvm.org/D26240
More information about the llvm-commits
mailing list