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

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 12:58:32 PDT 2018


sfertile marked 11 inline comments as done.
sfertile added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:3060
+void LongBranchTargetSection::addEntry(Symbol &Sym) {
+  assert(Sym.LtIndex == -1U);
+  Sym.LtIndex = Entries.size();
----------------
MaskRay wrote:
> 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
I initially changed this, but looking at it again I think -its interpreted as `-(1U)` which I believe is well defined. I'll see if I can verify that.


================
Comment at: ELF/Thunks.cpp:618
+  uint16_t OffHa = (Offset + 0x8000) >> 16;
+  uint16_t OffLo = Offset;
 
----------------
MaskRay wrote:
> 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.
Thanks, I don't ever compile with MSVC so I didn't realize it would warn on this. I believe I've added similar code in previous patches,  I'll find them and clean those up in a followup NFC patch.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53408





More information about the llvm-commits mailing list