[PATCH] D79600: [TargetLoweringObjectFileImpl] Produce .text.hot. instead of .text.hot for -fno-unique-section-names

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 12:20:27 PDT 2020


MaskRay added a comment.

In D79600#2027342 <https://reviews.llvm.org/D79600#2027342>, @tmsriram wrote:

> @MaskRay Could you please elaborate more on the problem being solved as it is not still fully clear to me?  Is it that only the "exit" function has this problem?  If you could also mention why the linker is not the right place to handle this problem, it would be useful.  Thanks.


GNU ld's internal linker script orders `*(.text.exit .text.exit.*)` before `*(.text .text.*)`. This property makes C functions `unlikely exit hot startup` to be ordered before other normal C functions in a -ffunction-sections build.

So in lld, I don't want to let -z keep-text-section-prefix recognize `.text.exit` (and the like). lld should just recognize `.text.exit.*`

Because of this, in -fno-unique-section-names mode, we may get `.text.exit` which will not go to the output section `.text.exit`. To fix that, name the input section `.text.exit.`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79600





More information about the llvm-commits mailing list