[PATCH] D92073: [CodeGen] Add text section prefix for COFF object file

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 07:17:54 PST 2020


rnk accepted this revision.
rnk added a comment.

I think this is an improvement, so let's go ahead and land it, but I'm not sure this will really work for mingw.

One last think I will note is that COFF linkers will sort input sections by the part of the section name after the dollar sign. There isn't any special treatment of `.text$hot` / `.text$unlikely`. They are sorted early and late by their ASCII ordering. That seems to achieve the right behavior, but maybe PGO should use more intentional section prefixes to get the desired ordering.



================
Comment at: llvm/test/CodeGen/X86/text-section-prefix.ll:20
+; COFF-MSVC:  .section  .text$unlikely,"xr",one_only,foo2
+; COFF-GNU:   .section  .text$unlikely$foo2,"xr",one_only,foo2
+  ret void
----------------
@mstorsjo This seems a bit more complicated than I originally thought it would be.


================
Comment at: llvm/test/Transforms/CodeGenPrepare/X86/section.ll:47
 ; CHECK: cold_func1{{.*}}!section_prefix ![[COLD_ID:[0-9]+]]
 ; ASM1: .section .text.unlikely.,"ax", at progbits
 ; ASM2: .section .text.unlikely.cold_func1,"ax", at progbits
----------------
The section name is `.text.unlikely.`, with a trailing dot. I guess that is the existing behavior, but it seems odd to me. Nevermind.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92073



More information about the llvm-commits mailing list