This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Remove trailing dot of name of text section with prefix
AbandonedPublic

Authored by TaoPan on Feb 7 2021, 1:10 AM.

Details

Summary

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.

Diff Detail

Event Timeline

TaoPan created this revision.Feb 7 2021, 1:10 AM
TaoPan requested review of this revision.Feb 7 2021, 1:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2021, 1:10 AM
TaoPan added a comment.Feb 7 2021, 1:11 AM

Could you please have a review?

TaoPan updated this revision to Diff 321985.Feb 7 2021, 1:28 AM

Add Summary

TaoPan edited the summary of this revision. (Show Details)Feb 7 2021, 1:31 AM

It seems the last dot in .text.hot. was added intentionally. Add @MaskRay to have a look.

MaskRay requested changes to this revision.EditedFeb 7 2021, 6:43 PM

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)
  }
This revision now requires changes to proceed.Feb 7 2021, 6:43 PM
TaoPan added a comment.Feb 8 2021, 7:33 PM

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}”.

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}.

TaoPan added a comment.Feb 8 2021, 9:22 PM

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.

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.

Clarification patch sounds good..

TaoPan added a comment.Feb 9 2021, 2:26 AM

Thank MaskRay!
I submitted a new patch https://reviews.llvm.org/D96327 to add the comment and fix the issue of Summary.

TaoPan abandoned this revision.Feb 19 2021, 8:52 PM