From f70502d3a65081caa11feca8df271f6f3a56369f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 28 Nov 2017 20:21:44 +0000 Subject: [PATCH] Bring r319051 back. It had been reverted because it depended on r319008 which has been recommitted. Original message: Add a missing test. We were not testing that we correctly handled a .o with a weak symbol after a .so. llvm-svn: 319217 --- lld/test/ELF/gc-sections-shared.s | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/lld/test/ELF/gc-sections-shared.s b/lld/test/ELF/gc-sections-shared.s index b9ce5de..13be58c 100644 --- a/lld/test/ELF/gc-sections-shared.s +++ b/lld/test/ELF/gc-sections-shared.s @@ -66,6 +66,62 @@ # CHECK: NEEDED Shared library: [{{.*}}3.so] # CHECK-NOT: NEEDED +# Test with %t.o at the end too. +# RUN: ld.lld --gc-sections --export-dynamic-symbol foo -o %t --as-needed %t2.so %t3.so %t4.so %t.o +# RUN: llvm-readobj --dynamic-table --dyn-symbols %t | FileCheck --check-prefix=CHECK2 %s + +# CHECK2: DynamicSymbols [ +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: +# CHECK2-NEXT: Value: +# CHECK2-NEXT: Size: +# CHECK2-NEXT: Binding: Local +# CHECK2-NEXT: Type: +# CHECK2-NEXT: Other: +# CHECK2-NEXT: Section: Undefined (0x0) +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: bar +# CHECK2-NEXT: Value: +# CHECK2-NEXT: Size: +# CHECK2-NEXT: Binding: Global +# CHECK2-NEXT: Type: +# CHECK2-NEXT: Other: +# CHECK2-NEXT: Section: .text +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: qux +# CHECK2-NEXT: Value: +# CHECK2-NEXT: Size: +# CHECK2-NEXT: Binding: Weak +# CHECK2-NEXT: Type: +# CHECK2-NEXT: Other: +# CHECK2-NEXT: Section: Undefined +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: foo +# CHECK2-NEXT: Value: +# CHECK2-NEXT: Size: +# CHECK2-NEXT: Binding: Global +# CHECK2-NEXT: Type: +# CHECK2-NEXT: Other: +# CHECK2-NEXT: Section: .text +# CHECK2-NEXT: } +# CHECK2-NEXT: Symbol { +# CHECK2-NEXT: Name: baz +# CHECK2-NEXT: Value: +# CHECK2-NEXT: Size: +# CHECK2-NEXT: Binding: Global +# CHECK2-NEXT: Type: +# CHECK2-NEXT: Other: +# CHECK2-NEXT: Section: Undefined +# CHECK2-NEXT: } +# CHECK2-NEXT: ] + +# CHECK2-NOT: NEEDED +# CHECK2: NEEDED Shared library: [{{.*}}3.so] +# CHECK2-NOT: NEEDED + .section .text.foo, "ax" .globl foo foo: -- 2.7.4