[PATCH] D90680: [lld][ELF][test] test LTO-removed symbols are not in symtab

Edd Dawson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 05:41:44 PST 2020


edd created this revision.
edd added reviewers: MaskRay, grimar, psmith.
Herald added subscribers: llvm-commits, steven_wu, hiraditya, inglorion, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
edd requested review of this revision.

Test that symbols eliminated by LTO do not appear in
the final .symtab section.

Added with the intention of moving coverage out of an internal
testsuite.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90680

Files:
  lld/test/ELF/lto/symtab-dead-strip.ll


Index: lld/test/ELF/lto/symtab-dead-strip.ll
===================================================================
--- /dev/null
+++ lld/test/ELF/lto/symtab-dead-strip.ll
@@ -0,0 +1,25 @@
+; REQUIRES: x86
+
+;; Test that symbols eliminated by LTO do not appear in
+;; the final .symtab section.
+
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld %t.o -o %t
+; RUN: llvm-readelf --syms %t | FileCheck %s
+
+;; Confirm that deadfunc is not present.
+; CHECK:      Symbol table '.symtab' contains 3 entries:
+; CHECK-NEXT: Num: Value  Size Type   Bind   Vis     Ndx    Name
+; CHECK-NEXT: 0:   {{.+}} 0    NOTYPE
+; CHECK-NEXT: 1:   {{.+}} 0    FILE
+; CHECK-NEXT: 2:   {{.+}} 1    FUNC   GLOBAL DEFAULT {{.+}} _start
+
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @_start() {
+  ret void
+}
+define void @deadfunc() {
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90680.302553.patch
Type: text/x-patch
Size: 930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201103/d4399be4/attachment.bin>


More information about the llvm-commits mailing list