[PATCH] D135737: [LLD][ELF] restore behaviour of __real_foo being a weak reference to a lazy foo

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 16:40:24 PDT 2022


MaskRay added a comment.

For `wrap-extract-real.s`, I don't think the new behavior improves semantics.

  ld.lld %t/a.o --wrap foo  # error: undefined symbol: __real_foo
  ld.lld %t/a.o --start-lib %t/b.o --end-lib --wrap foo  # ok, even if %t/b.o is not extracted. This is weird



================
Comment at: lld/test/ELF/wrap-extract-real.s:4
+
+# RUN: rm -rf %t && split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
----------------
`# RUN: rm -rf %t && split-file %s %t && cd %t` so that you can omit `%t/` below


================
Comment at: lld/test/ELF/wrap-extract-real.s:7
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/b.s -o %t/b.o
+# RUN: ld.lld %t/a.o --start-lib %t/b.o --end-lib -o %t/a --wrap foo -o /dev/null --trace 2>&1 | FileCheck %s
+
----------------
To make better use of the test, use an output and dump the full symbol table with llvm-readelf -s.



================
Comment at: lld/test/ELF/wrap-extract-real.s:9
+
+CHECK-NOT: b.o
+
----------------



================
Comment at: lld/test/ELF/wrap-extract-unreferenced-orig.s:1
+# REQUIRES: x86
+## Show that lld pulls in a definition of foo from an archive
----------------
The change does not affect the behavior of this test. What does this test check?


================
Comment at: lld/test/ELF/wrap-extract-unreferenced-orig.s:9
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/c.s -o %t/c.o
+# RUN: ld.lld %t/a.o %t/b.o --start-lib %t/c.o --end-lib -o %t/a --wrap foo -o /dev/null --trace 2>&1 | FileCheck %s
+
----------------
Two `-o`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135737/new/

https://reviews.llvm.org/D135737



More information about the llvm-commits mailing list