Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -104,7 +104,8 @@ } for (StringRef V : - {".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.", + {".text.hot.", ".text.unlikely.", ".text.startup.", ".text.exit.", + ".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.rel.ro.", ".bss.", ".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.", ".gcc_except_table.", ".tdata.", ".ARM.exidx.", ".ARM.extab."}) { StringRef Prefix = V.drop_back(); Index: test/ELF/text-section-prefix.s =================================================================== --- test/ELF/text-section-prefix.s +++ test/ELF/text-section-prefix.s @@ -0,0 +1,34 @@ +# RUN: llvm-mc -filetype=obj %s -o %t +# RUN: ld.lld %t -o %t2 +# RUN: llvm-readelf -l %t2 | FileCheck %s + +# CHECK: .text +# CHECK: .text.hot +# CHECK: .text.startup +# CHECK: .text.exit +# CHECK: .text.unlikely + + +.globl _start, f, f_hot, f_startup, f_exit, f_unlikely +_start: + ret + +.section .text.f,"ax" +f: + nop + +.section .text.hot.f_hot,"ax" +f_hot: + nop + +.section .text.startup.f_startup,"ax" +f_startup: + nop + +.section .text.exit.f_exit,"ax" +f_exit: + nop + +.section .text.unlikely.f_unlikely,"ax" +f_unlikely: + nop