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
This commit is contained in:
Rafael Espindola 2017-11-23 23:40:33 +00:00
parent cb100af21c
commit 83f73f7908
2 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,3 @@
.global baz
.type baz, @function
baz:

View File

@ -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"