From ab1923d63c3e726457ec0e4cb58737f7443cf3c8 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 15 Apr 2016 15:26:52 +0000 Subject: [PATCH] Add an interesting GC testcase. It shows that we correctly look at liveness based on the final symbol resolution. llvm-svn: 266440 --- lld/test/ELF/Inputs/gc-sections-weak.s | 8 ++++++++ lld/test/ELF/gc-sections-weak.s | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 lld/test/ELF/Inputs/gc-sections-weak.s create mode 100644 lld/test/ELF/gc-sections-weak.s diff --git a/lld/test/ELF/Inputs/gc-sections-weak.s b/lld/test/ELF/Inputs/gc-sections-weak.s new file mode 100644 index 0000000..27baa66 --- /dev/null +++ b/lld/test/ELF/Inputs/gc-sections-weak.s @@ -0,0 +1,8 @@ +.weak foo +foo: + nop + +.data +.global bar2 +bar2: +.quad foo diff --git a/lld/test/ELF/gc-sections-weak.s b/lld/test/ELF/gc-sections-weak.s new file mode 100644 index 0000000..625b613 --- /dev/null +++ b/lld/test/ELF/gc-sections-weak.s @@ -0,0 +1,24 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gc-sections-weak.s -o %t2.o +// RUN: ld.lld %t.o %t2.o -o %t.so -shared --gc-sections +// RUN: llvm-readobj -s %t.so | FileCheck %s + +.global foo +foo: +nop + +.data +.global bar1 +bar1: +.quad foo + +// CHECK: Name: .text +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_EXECINSTR +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: 1 -- 2.7.4