[PATCH] D110450: [LLD] Remove global state in lld/COFF
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 26 11:17:43 PST 2022
aganea added a comment.
In D110450#3273293 <https://reviews.llvm.org/D110450#3273293>, @MaskRay wrote:
> If other ports want to follow suit, I think storing `const COFFLinkerContext &ctx;` in classes like `*File` are fine since the instances are not too many.
>
> Placing the member in `*Section` is definitely too wasteful. For classes like `ImportThunkChunk`, I think it'd be better to avoid storing the member as well.
@akhuang mentioned that this patch only increases by 4 MB the peak mem when linking a Chromium .dll with /Gy, see above https://reviews.llvm.org/D110450#3028764
Since the COFF driver would still not be thread-safe after this patch, if you prefer we can also use `lld::context<COFFLinkerContext>()` (instead of storing ctx in *ImportThunkChunk). And then as a second step, introduce `thread_local` contexts, for cases like this where passing `ctx` through the callstack is infeasible/requires too many changes. See https://reviews.llvm.org/D108850?id=370678.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110450/new/
https://reviews.llvm.org/D110450
More information about the llvm-commits
mailing list