31 lines · plain
1# REQUIRES: x862 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tundefined.o4# RUN: echo "foo=42" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tdefined.o5# RUN: echo "call foo" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %treference.o6 7# RUN: echo "SECTIONS { .bar : { PROVIDE(foo = .); } }" > %t.script8 9# Case 1: Provided symbol is undefined and not referenced - empty section should be removed.10# RUN: ld.lld %tundefined.o -T %t.script -o %t1.elf11# RUN: llvm-readobj --sections %t1.elf | FileCheck %s --check-prefix=NOSECTION12 13# Case 2: Provided symbol is undefined and referenced - empty section should not be removed.14# RUN: ld.lld %tundefined.o %treference.o -T %t.script -o %t2.elf15# RUN: llvm-readobj --sections %t2.elf | FileCheck %s --check-prefix=SECTION16 17# Case 3: Provided symbol is defined and not referenced - empty section should be removed.18# RUN: ld.lld %tdefined.o -T %t.script -o %t3.elf19# RUN: llvm-readobj --sections %t3.elf | FileCheck %s --check-prefix=NOSECTION20 21# Case 4: Provided symbol is defined and referenced - empty section should not be removed.22# RUN: ld.lld %tdefined.o %treference.o -T %t.script -o %t4.elf23# RUN: llvm-readobj --sections %t4.elf | FileCheck %s --check-prefix=SECTION24 25.global _start26_start:27 ret28 29# SECTION: .bar30# NOSECTION-NOT: .bar31