[PATCH] D120626: [ELF] Move section assignment from initializeSymbols to postParse

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 00:09:26 PST 2022


MaskRay added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:1162
+      if (sym.traced) {
+        printTraceSymbol(Undefined{this, sym.getName(), sym.binding,
+                                   sym.stOther, sym.type, secIdx},
----------------
peter.smith wrote:
> MaskRay wrote:
> > peter.smith wrote:
> > > If this is happening in parallel, is there a chance of interleaved output? For example a traced symbol in multiple groups? I guess that would need something like driver->duplicates?
> > > 
> > Yes. If the determinism is desired, `elf::printTraceSymbol(` needs to some refactoring: the `message` call needs to be replaced with something like `driver->duplicates`.
> > 
> > Placing `duplicates` in `LinkerDriver` is a bit arbitrary. I wonder whether we should use `ctx->duplicates`.
> By interleaved output I was thinking of something along the lines of:
> ```
> Some people, when confronted with a problem, think, “I know, I’ll use threads,” and then two they hav erpoblesms.
> ```
> from https://nedbatchelder.com/blog/201204/two_problems.html 
> 
> Perhaps another mutex for the block if it is susceptible. It is possible that the stream is protected with a lock though.
> 
> ctx->duplicates is probably more friendly to the people that want to use LLD in the context of a library.
There is no interleaving. A single-line or multi-line message is emitted as a whole.

`lld/Common/ErrorHandler.cpp` uses `lock_guard` for messages and diagnostics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120626



More information about the llvm-commits mailing list