[PATCH] D104353: [lld-macho] Avoid force-loading the same archive twice

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 12:21:33 PDT 2021


int3 added inline comments.


================
Comment at: lld/test/MachO/force-load.s:21
+## arguments, so this is an error.
+# RUN: cd %t; not %lld %t/foo.o -force_load %t/foo.a -force_load foo.a \
+# RUN:   %t/test.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=DUP
----------------
thakis wrote:
> Hm, should we have an explicit test for this? ld64 does seem to do realpath(), and we kind of want to do that at some point too. So it seems a bit strange to have a test preventing this.
> 
> (My local ld64 test:
> ```
> % ln -s libfoo.a libbar.a
> % clang mainfoo.o libfoo.a -force_load libfoo.a -force_load libfoo.a -lfoo -L . libbar.a ../llvm-project/libfoo.a
> ```
> )
What are the contents of `libfoo.a` and `libbar.a` here?

This force-load.s test passes for me when I swap out LLD for ld64. I also tried using an explicit symlink instead of a CWD-relative path, and that passes for me too (i.e. raises a duplicate symbol error.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104353



More information about the llvm-commits mailing list