summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-12-17 16:45:04 -0800
committerFangrui Song <maskray@google.com>2019-12-29 23:05:11 -0800
commitbb87364f26ce6b1fbb2cc5e155fd8ff82aafbe8d (patch)
tree94d733f419e1b8308cc9a3b2c9670726c676aa8f /lld/test/ELF
parentfb2944bd7f8ac6d7c4bccd3ac2033ba58c690038 (diff)
downloadbcm5719-llvm-bb87364f26ce6b1fbb2cc5e155fd8ff82aafbe8d.tar.gz
bcm5719-llvm-bb87364f26ce6b1fbb2cc5e155fd8ff82aafbe8d.zip
[ELF][PPC64] Improve "call lacks nop" diagnostic and make it compatible with GCC<5.5 and GCC<6.4
GCC before r245813 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79439) did not emit nop after b/bl. This can happen with recursive calls. r245813 was back ported to GCC 5.5 and GCC 6.4. This is common, for example, libstdc++.a(locale.o) shipped with GCC 4.9 and many objects in netlib lapack can cause lld to error. gold allows such calls to the same section. Our __plt_foo symbol's `section` field is used for ThunkSection, so we can't implement a similar loosen rule easily. But we can make use of its `file` field which is currently NULL. Differential Revision: https://reviews.llvm.org/D71639
Diffstat (limited to 'lld/test/ELF')
-rw-r--r--lld/test/ELF/ppc64-bsymbolic-toc-restore.s2
-rw-r--r--lld/test/ELF/ppc64-error-toc-restore.s2
-rw-r--r--lld/test/ELF/ppc64-error-toc-tail-call.s8
3 files changed, 9 insertions, 3 deletions
diff --git a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
index ff5eb148273..929c82cd24b 100644
--- a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
+++ b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
@@ -12,7 +12,7 @@
# RUN: llvm-objdump -d -r %t | FileCheck %s
# RUN: not ld.lld -shared %t1.o %t2.o -o %t 2>&1 | FileCheck --check-prefix=FAIL %s
-# FAIL: call lacks nop, can't restore toc
+# FAIL: call to def lacks nop, can't restore toc
# Test to document the toc-restore behavior with -Bsymbolic option. Since
# -Bsymbolic causes the call to bind to the internal defintion we know the
diff --git a/lld/test/ELF/ppc64-error-toc-restore.s b/lld/test/ELF/ppc64-error-toc-restore.s
index 19153b730ce..9700322a5e6 100644
--- a/lld/test/ELF/ppc64-error-toc-restore.s
+++ b/lld/test/ELF/ppc64-error-toc-restore.s
@@ -11,7 +11,7 @@
// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
# Calling external function bar needs a nop
-// CHECK: call lacks nop, can't restore toc
+// CHECK: call to foo lacks nop, can't restore toc
.text
.abiversion 2
diff --git a/lld/test/ELF/ppc64-error-toc-tail-call.s b/lld/test/ELF/ppc64-error-toc-tail-call.s
index da8fea26cc2..b303810b81d 100644
--- a/lld/test/ELF/ppc64-error-toc-tail-call.s
+++ b/lld/test/ELF/ppc64-error-toc-tail-call.s
@@ -11,10 +11,16 @@
// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
# A tail call to an external function without a nop should issue an error.
-// CHECK: call lacks nop, can't restore toc
+// CHECK: call to foo lacks nop, can't restore toc
+// CHECK-NOT: lacks nop
.text
.abiversion 2
.global _start
_start:
b foo
+
+ // gcc/gfortran 5.4, 6.3 and earlier versions do not add nop for recursive
+ // calls.
+ b _start
+ b _start
OpenPOWER on IntegriCloud