From 83f73f7908afc0752e929f565586c0bc607bc3e0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 23 Nov 2017 23:40:33 +0000 Subject: [PATCH] Make a test stricter. It now has a DT_NEEDED that could be removed by --gc-sections and one that cannot. Without this all tests would pass if --gc-sections just removed all DT_NEEDED. llvm-svn: 318937 --- lld/test/ELF/Inputs/gc-sections-shared.s | 3 +++ lld/test/ELF/gc-sections-shared.s | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 lld/test/ELF/Inputs/gc-sections-shared.s diff --git a/lld/test/ELF/Inputs/gc-sections-shared.s b/lld/test/ELF/Inputs/gc-sections-shared.s new file mode 100644 index 0000000..e7017f5 --- /dev/null +++ b/lld/test/ELF/Inputs/gc-sections-shared.s @@ -0,0 +1,3 @@ +.global baz +.type baz, @function +baz: diff --git a/lld/test/ELF/gc-sections-shared.s b/lld/test/ELF/gc-sections-shared.s index 3bb8ff1..80b3d61 100644 --- a/lld/test/ELF/gc-sections-shared.s +++ b/lld/test/ELF/gc-sections-shared.s @@ -1,8 +1,10 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/gc-sections-shared.s -o %t3.o # RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: ld.lld -shared %t3.o -o %t3.so # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t %t.o --as-needed %t2.so +# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t %t.o --as-needed %t2.so %t3.so # RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck %s # This test the property that we have a needed line for every undefined. @@ -45,9 +47,21 @@ # CHECK-NEXT: Other: # CHECK-NEXT: Section: .text # CHECK-NEXT: } +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: baz +# CHECK-NEXT: Value: +# CHECK-NEXT: Size: +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: +# CHECK-NEXT: Other: +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } # CHECK-NEXT: ] -# CHECK: NEEDED Shared library: [{{.*}}.so] +# CHECK-NOT: NEEDED +# CHECK: NEEDED Shared library: [{{.*}}2.so] +# CHECK: NEEDED Shared library: [{{.*}}3.so] +# CHECK-NOT: NEEDED .section .text.foo, "ax" .globl foo @@ -62,6 +76,7 @@ ret .section .text._start, "ax" .globl _start _start: +call baz ret .section .text.unused, "ax" -- 2.7.4