[PATCH] D59269: ELF: Use bump pointer allocator for uncompressed section buffers. NFCI.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 13:36:30 PDT 2019


ruiu added inline comments.


================
Comment at: ELF/InputSection.h:217
+  // Since the feature is not used often, this is usually -1.
+  mutable int64_t UncompressedSize = -1;
 };
----------------
grimar wrote:
> ruiu wrote:
> > grimar wrote:
> > > Not relative to this patch, but I wonder why this is an `int64_t` and not a `uint64_t`.
> > To represent -1 as -1, I guess?
> But it could be `uint64_t`, we already have code around in linker that does that.
> E.g:
> 
> ```
>   // Get an offset in an output section this relocation is applied to.
>   uint64_t Offset = GetOffset.get(Rel.r_offset);
>   if (Offset == uint64_t(-1))
>     return;
> ```
> 
> I am not sure it is useful atm to have a max size of `UncompressedSize` to be `max(uint64)-1`
> instead of `max(int64_t)`, but why not...
I'm not too worried, but if you want to consistently use uint64_t, feel free to do that. By the way uint64_t(-1) has the same bit pattern as UINT64_MAX.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59269/new/

https://reviews.llvm.org/D59269





More information about the llvm-commits mailing list