65 lines · plain
1# REQUIRES: x862## -z keep-text-section-prefix separates text sections with prefix .text.hot,3## .text.unknown, .text.unlikely, .text.startup, or .text.exit, in the absence4## of a SECTIONS command.5 6# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o7# RUN: ld.lld %t.o -o %t18# RUN: llvm-readelf -S %t1 | FileCheck --check-prefix=NOKEEP %s9# RUN: ld.lld -z nokeep-text-section-prefix %t.o -o %t210# RUN: cmp %t1 %t211 12# RUN: ld.lld -z keep-text-section-prefix %t.o -o %t.keep13# RUN: llvm-readelf -S %t.keep | FileCheck --check-prefix=KEEP %s14 15# KEEP: [ 1] .text16# KEEP-NEXT: [ 2] .text.hot17# KEEP-NEXT: [ 3] .text.unknown18# KEEP-NEXT: [ 4] .text.split19# KEEP-NEXT: [ 5] .text.startup20# KEEP-NEXT: [ 6] .text.exit21# KEEP-NEXT: [ 7] .text.unlikely22 23# NOKEEP: [ 1] .text24# NOKEEP-NOT: .text25 26## With a SECTIONS command, orphan sections are created verbatim.27## No grouping is performed for them.28# RUN: echo 'SECTIONS {}' > %t.lds29# RUN: ld.lld -T %t.lds -z keep-text-section-prefix %t.o -o %t.script30# RUN: llvm-readelf -S %t.script | FileCheck --check-prefix=SCRIPT %s31 32# SCRIPT: .text33# SCRIPT-NEXT: .text.f34# SCRIPT-NEXT: .text.hot.f_hot35# SCRIPT-NEXT: .text.unknown.f_unknown36# SCRIPT-NEXT: .text.split.f_split37# SCRIPT-NEXT: .text.startup.f_startup38# SCRIPT-NEXT: .text.exit.f_exit39# SCRIPT-NEXT: .text.unlikely.f_unlikely40 41.globl _start42_start:43 ret44 45.section .text.f,"ax"46 nop47 48.section .text.hot.f_hot,"ax"49 nop50 51.section .text.unknown.f_unknown,"ax"52 nop53 54.section .text.split.f_split,"ax"55 nop56 57.section .text.startup.f_startup,"ax"58 nop59 60.section .text.exit.f_exit,"ax"61 nop62 63.section .text.unlikely.f_unlikely,"ax"64 nop65