1# REQUIRES: x86 2 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tundefined.o 4# RUN: echo "foo=42" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tdefined.o 5# RUN: echo "call foo" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %treference.o 6 7# RUN: echo "SECTIONS { .bar : { PROVIDE(foo = .); } }" > %t.script 8 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.elf 11# RUN: llvm-readobj --sections %t1.elf | FileCheck %s --check-prefix=NOSECTION 12 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.elf 15# RUN: llvm-readobj --sections %t2.elf | FileCheck %s --check-prefix=SECTION 16 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.elf 19# RUN: llvm-readobj --sections %t3.elf | FileCheck %s --check-prefix=NOSECTION 20 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.elf 23# RUN: llvm-readobj --sections %t4.elf | FileCheck %s --check-prefix=SECTION 24 25.global _start 26_start: 27 ret 28 29# SECTION: .bar 30# NOSECTION-NOT: .bar 31