[PATCH] D40253: [ELF] Make tests with undefined symbols more explicit.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 09:19:10 PST 2017


LGTM


Igor Kudrin via Phabricator <reviews at reviews.llvm.org> writes:

> ikudrin created this revision.
> ikudrin added a project: lld.
> Herald added subscribers: arichardson, emaste.
>
> These changes are required for https://reviews.llvm.org/D38790, where undefined symbols are going to be removed from symbol tables if they are not really used.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D40253
>
> Files:
>   test/ELF/Inputs/shared3.s
>   test/ELF/gnu-hash-table.s
>   test/ELF/lto/shlib-undefined.ll
>   test/ELF/progname.s
>   test/ELF/undef-version-script.s
>   test/ELF/weak-undef.s
>
>
> Index: test/ELF/weak-undef.s
> ===================================================================
> --- test/ELF/weak-undef.s
> +++ test/ELF/weak-undef.s
> @@ -28,3 +28,6 @@
>  
>  .globl _start
>  _start:
> +
> +.data
> +  .dc.a foo
> Index: test/ELF/undef-version-script.s
> ===================================================================
> --- test/ELF/undef-version-script.s
> +++ 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
> Index: test/ELF/progname.s
> ===================================================================
> --- test/ELF/progname.s
> +++ 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
> Index: test/ELF/lto/shlib-undefined.ll
> ===================================================================
> --- test/ELF/lto/shlib-undefined.ll
> +++ 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
> Index: test/ELF/gnu-hash-table.s
> ===================================================================
> --- test/ELF/gnu-hash-table.s
> +++ 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 @@
>  bar:
>  .weak zed
>  .global xyz
> +.data
> +  .dc.a baz
> Index: test/ELF/Inputs/shared3.s
> ===================================================================
> --- test/ELF/Inputs/shared3.s
> +++ test/ELF/Inputs/shared3.s
> @@ -1,3 +1,3 @@
>  .global baz
> -.type barz, @function
> +.type baz, @function
>  baz:
>
>
> Index: test/ELF/weak-undef.s
> ===================================================================
> --- test/ELF/weak-undef.s
> +++ test/ELF/weak-undef.s
> @@ -28,3 +28,6 @@
>  
>  .globl _start
>  _start:
> +
> +.data
> +  .dc.a foo
> Index: test/ELF/undef-version-script.s
> ===================================================================
> --- test/ELF/undef-version-script.s
> +++ 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
> Index: test/ELF/progname.s
> ===================================================================
> --- test/ELF/progname.s
> +++ 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
> Index: test/ELF/lto/shlib-undefined.ll
> ===================================================================
> --- test/ELF/lto/shlib-undefined.ll
> +++ 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
> Index: test/ELF/gnu-hash-table.s
> ===================================================================
> --- test/ELF/gnu-hash-table.s
> +++ 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 @@
>  bar:
>  .weak zed
>  .global xyz
> +.data
> +  .dc.a baz
> Index: test/ELF/Inputs/shared3.s
> ===================================================================
> --- test/ELF/Inputs/shared3.s
> +++ test/ELF/Inputs/shared3.s
> @@ -1,3 +1,3 @@
>  .global baz
> -.type barz, @function
> +.type baz, @function
>  baz:


More information about the llvm-commits mailing list