2 ; RUN: llvm-as %s -o %t.o
3 ; RUN: ld.lld %t.o -o %t.so -shared
4 ; RUN: llvm-readelf -S %t.so | FileCheck %s
5 ; RUN: ld.lld %t.o -o %t.so -shared --gc-sections -z nostart-stop-gc
6 ; RUN: llvm-readelf -S %t.so | FileCheck --check-prefix=GC %s
8 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
9 target triple = "x86_64-unknown-linux-gnu"
11 @foo = hidden global i32 42, section "foo_section"
12 @bar = hidden global i32 42, section "bar_section"
13 @zed = hidden global i32 42, section "zed_section"
15 @__start_foo_section = external global i32
16 @__stop_bar_section = external global i32
18 define hidden ptr @use1() {
19 ret ptr @__start_foo_section
23 ret ptr @__stop_bar_section
26 ; CHECK-NOT: zed_section
27 ; CHECK: foo_section PROGBITS
28 ; CHECK-NEXT: bar_section PROGBITS
29 ; CHECK-NOT: zed_section
33 ; GC: bar_section PROGBITS