From d95c74ec81738b99e2497b89bcb55ee41d20c980 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Fri, 24 Nov 2017 06:42:32 +0000 Subject: [PATCH] [ELF] Make tests with undefined symbols more explicit. Differential Revision: https://reviews.llvm.org/D40253 llvm-svn: 318939 --- lld/test/ELF/Inputs/shared3.s | 2 +- lld/test/ELF/gnu-hash-table.s | 4 +++- lld/test/ELF/lto/shlib-undefined.ll | 2 +- lld/test/ELF/progname.s | 2 +- lld/test/ELF/undef-version-script.s | 6 +++--- lld/test/ELF/weak-undef.s | 3 +++ 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lld/test/ELF/Inputs/shared3.s b/lld/test/ELF/Inputs/shared3.s index d1f6ffea1332..e7017f566411 100644 --- a/lld/test/ELF/Inputs/shared3.s +++ b/lld/test/ELF/Inputs/shared3.s @@ -1,3 +1,3 @@ .global baz -.type barz, @function +.type baz, @function baz: diff --git a/lld/test/ELF/gnu-hash-table.s b/lld/test/ELF/gnu-hash-table.s index 7df8dfc8df19..fa68ba250131 100644 --- a/lld/test/ELF/gnu-hash-table.s +++ b/lld/test/ELF/gnu-hash-table.s @@ -1,6 +1,6 @@ # REQUIRES: x86,ppc -# RUN: echo ".globl foo" > %te.s +# RUN: echo ".globl foo; .data; .dc.a foo" > %te.s # RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %te.s -o %te-i386.o # RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t-i386.o # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t-x86_64.o @@ -244,3 +244,5 @@ foo: bar: .weak zed .global xyz +.data + .dc.a baz diff --git a/lld/test/ELF/lto/shlib-undefined.ll b/lld/test/ELF/lto/shlib-undefined.ll index 0250ed761927..6d37bfa6b304 100644 --- a/lld/test/ELF/lto/shlib-undefined.ll +++ b/lld/test/ELF/lto/shlib-undefined.ll @@ -1,6 +1,6 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o -; RUN: echo .global __progname > %t2.s +; RUN: echo ".global __progname; .data; .dc.a __progname" > %t2.s ; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t2.s -o %t2.o ; RUN: ld.lld -shared %t2.o -o %t2.so ; RUN: ld.lld -o %t %t.o %t2.so diff --git a/lld/test/ELF/progname.s b/lld/test/ELF/progname.s index be8ab9e31c4f..ecd0fd872347 100644 --- a/lld/test/ELF/progname.s +++ b/lld/test/ELF/progname.s @@ -1,6 +1,6 @@ // REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -// RUN: echo .global __progname > %t2.s +// RUN: echo ".global __progname; .data; .dc.a __progname" > %t2.s // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t2.s -o %t2.o // RUN: ld.lld -shared %t2.o -o %t2.so // RUN: ld.lld -o %t %t.o %t2.so diff --git a/lld/test/ELF/undef-version-script.s b/lld/test/ELF/undef-version-script.s index 529728328747..024ac1dc0727 100644 --- a/lld/test/ELF/undef-version-script.s +++ b/lld/test/ELF/undef-version-script.s @@ -3,9 +3,6 @@ # RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so # RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s -# This does not match gold's behavior because gold does not create undefined -# symbols in dynsym without an appropriate (e.g. PLT) relocation in the input. - # CHECK: DynamicSymbols [ # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: @ @@ -38,3 +35,6 @@ .global foo .weak bar +.data + .dc.a foo + .dc.a bar diff --git a/lld/test/ELF/weak-undef.s b/lld/test/ELF/weak-undef.s index 7ee505be6ad1..09c2a4c4440f 100644 --- a/lld/test/ELF/weak-undef.s +++ b/lld/test/ELF/weak-undef.s @@ -28,3 +28,6 @@ .globl _start _start: + +.data + .dc.a foo