brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 268faa4 Raw
61 lines · plain
1# REQUIRES: x862 3# This test verifies that garbage-collection is correctly garbage collecting4# unused sections when the symbol of the unused section is only referred by5# an unused PROVIDE symbol.6 7# RUN: rm -rf %t && split-file %s %t && cd %t8# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o9# RUN: ld.lld -o a_nogc a.o -T script.t10# RUN: llvm-nm a_nogc | FileCheck -check-prefix=NOGC %s11# RUN: ld.lld -o a_gc a.o --gc-sections --print-gc-sections -T script.t | FileCheck --check-prefix=GC_LINK %s12# RUN: llvm-nm a_gc | FileCheck -check-prefix=GC %s13 14NOGC-NOT: another_unused15NOGC: another_used16NOGC: bar17NOGC: baz18NOGC: baz_ref19NOGC: foo20NOGC-NOT: unused21NOGC: used22 23GC_LINK: removing unused section a.o:(.text.bar)24 25GC-NOT: another_unused26GC: another_used27GC-NOT: bar28GC: baz29GC: baz_ref30GC: foo31GC-NOT: unused32GC: used33 34#--- a.s35.global _start36_start:37 call foo38 call used39 40.section .text.foo,"ax",@progbits41foo:42 nop43 44.section .text.bar,"ax",@progbits45.global bar46bar:47 nop48 49.section .text.baz,"ax",@progbits50.global baz51baz:52 nop53 54 55#--- script.t56PROVIDE(unused = bar + "used");57PROVIDE("used" = another_used);58PROVIDE(baz_ref = baz);59PROVIDE(another_used = baz_ref);60PROVIDE(another_unused = unused + bar + 0x1);61