[lld] [lld][ELF] Error when deplibs adds new input file after LTO (PR #98565)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 22:23:20 PDT 2024
================
@@ -0,0 +1,39 @@
+# REQUIRES: x86
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=aarch64 -o deplibs.o deplibs.s
+# RUN: llvm-mc -filetype=obj -triple=aarch64 -o foo.o foo.s
+# RUN: llvm-as -o lto.o lto.ll
+# RUN: llvm-ar rc libdeplibs.a deplibs.o
+# RUN: llvm-ar rc libfoo.a foo.o
+
+## LTO emits a libcall (`__aarch64_ldadd4_relax`) that is resolved using a
+## library (libdeplibc.a) that contains a `.deplibs` section pointing to a file
+## not yet added to the link.
+
+# RUN: not ld.lld lto.o -u a -L. -ldeplibs 2>&1 | FileCheck %s
+# CHECK: error: input file 'foo.o' added after LTO
+
+## Including the file before LTO prevents the issue.
+
----------------
MaskRay wrote:
Delete the blank line. The convention is to have `##` immediately precede associated RUN lines.
https://github.com/llvm/llvm-project/pull/98565
More information about the llvm-commits
mailing list