[PATCH] D62350: [wip] ELF: Create synthetic sections for loadable partitions.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 07:12:14 PDT 2019

ruiu added inline comments.

Comment at: lld/ELF/SyntheticSections.h:1127
+inline Partition &mainPartition() { return Partitions[0]; }
grimar wrote:
> What about having one more global pointer instead.
> i.e. after creating all of the partitions do:
> ```
> Partition *InM; //global, like `In`
> ...
> InM = &Partitions[0];
> ```
> And then use `InM` everywhere instead of `mainPartition`.
> I wonder what others think though.
Yeah. Looks like this function doesn't have to be a function. I thought for a while about what kind of name I'd choose, but I didn't come up with a good idea. Calling Partitions[0] as In might not be a bad idea. It's short, and we don't need to update all `In`s with `mainPartition()` which makes this patch much easier to read.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list