[PATCH] D53408: [PPC64] Long branch thunks.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 16:41:42 PDT 2018


MaskRay added inline comments.


================
Comment at: ELF/Arch/PPC64.cpp:724
+
+  // If a symbol is a weak undefined and we are compiling an executable
+  // it doesn't need a range-extending thunk since it can't be called.
----------------
executable -> position-dependent executable?

`Config->Pic` is true when linking .so or PIE executable.


================
Comment at: ELF/SyntheticSections.cpp:3060
+void LongBranchTargetSection::addEntry(Symbol &Sym) {
+  assert(Sym.LtIndex == -1U);
+  Sym.LtIndex = Entries.size();
----------------
LtIndex is `uint32_t` but -1U is undefined. Though they are usually the same type, `UINT32_C(-1)` or `(uint32_t)-1` may be better


================
Comment at: ELF/SyntheticSections.h:980
+
+InputSection * createInterpSection();
 MergeInputSection *createCommentSection();
----------------
`InputSection *createInterpSection();`


================
Comment at: ELF/Thunks.cpp:618
+  uint16_t OffHa = (Offset + 0x8000) >> 16;
+  uint16_t OffLo = Offset;
 
----------------
With `-DLLVM_ENABLE_WARNINGS=on` & MSVC, `/W4` is turned on which warn
`uint16_t OffLo = Offset;`

`warning C4244: 'initializing': conversion from 'int64_t' to 'uint16_t', possible loss of data`


Append `& 0xffff` to suppress it.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53408





More information about the llvm-commits mailing list