TargetLoweringObjectFileELF::getSectionForMachineBasicBlock() may
connect name of text section with prefix, dot and symbol name, there may
be two dots between name of text section with prefix and symbol name.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
It seems the last dot in .text.hot. was added intentionally. Add @MaskRay to have a look.
.text.hot. and .text.exit etc are intentional, otherwise with -ffunction-sections, a function named exit (in .text.exit) will be shuffled to a different place.
// Default ld.bfd --verbose .text : { *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) *(.text.startup .text.startup.*) *(.text.hot .text.hot.*) *(SORT(.text.sorted.*)) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf.em. */ *(.gnu.warning) }
Thank MaskRay for the review comment!
I don’t understand the intention of the last dot of “.text.hot.”, it’s “.text.${text-section-prefix}.”.
The example of function name exit with –ffunction-sections doesn’t include text-section-prefix, it’s “.text.${function-name}”.
Assuming normal function names don't end with ., their -ffunction-section section names can be distinguished from .text.${text-section-prefix}.
Thanks! I got the trailing dot is for distinguishing text section name with prefix and function name with --function-sections.
Is it ok adding comment to the code of adding trailing dot, like "For distinguishing between .text.${text-section-prefix}. (with trailing dot) and .text.${function-name}"?
I'll submit another patch to fix the two dots issue of Summary in the place that connects text section name with prefix and function name.
Thank MaskRay!
I submitted a new patch https://reviews.llvm.org/D96327 to add the comment and fix the issue of Summary.