[PATCH] D44543: [AsmPrinter] Emit .weak directive for weak linkage on COFF

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 19 16:30:33 PDT 2021


MaskRay added a comment.
Herald added a subscriber: pengfei.

`} else if (MAI->avoidWeakIfComdat() && GV->hasComdat()) {` in AsmPrinter.cpp makes the comdat leader symbol unconditionally `.globl`.
Will it be possible to allow `.weak` leader?

If allowed, `clang -fprofile-instr-generate a.c` can place the weak `__profc_weak` in an associative comdat (`comdat nodeduplicate`) for the following code:

  __attribute__((weak)) void foo() {}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D44543



More information about the llvm-commits mailing list