[PATCH] D103355: [InstrProfiling] Delete linkage/visibility toggling for Windows

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 13:36:58 PDT 2021


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: compiler-rt/test/profile/Windows/coverage-linkage-lld.cpp:10
+// NOGC:   T ?discarded{{.*}}
+// GC-NOT: T ?discarded{{.*}}
----------------
mstorsjo wrote:
> MaskRay wrote:
> > An issue unrelated to this patch:
> > 
> > `discarded*` in coverage-linkage.cpp are discarded.
> > 
> > However, the weak symbol `weak` has weird mangling ` .weak.?weak@@YAXXZ.default.?discarded0@@YAXXZ` (how does it contain `discarded0` in its name)? @mstorsjo 
> > 
> > 
> That's because COFF weak symbols need to point at a different, non-weak global symbol. If you have multiple object files providing a weak symbol (which is meant to be allowed, at least in mingw environments), the default symbols that they point at would collide. Therefore, the default symbols get an extra string to make them unique - it tries to add the name of a non-comdat extern symbol defined in the same object file. As long as that symbol isn't multiply defined (which would cause conflicts in itself), that should make the defaults for the weak symbols unique too.
> 
> See D75989 for this odd design (which mimics what GCC/binutils do for that case).
Thanks for the explanation!



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103355



More information about the llvm-commits mailing list