-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[LLD][COFF/ELF/Mach-O] Thin archives might reference objects by absolute paths in repro tarballs #97845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-lld-macho Author: Daniel Bertalan (BertalanD)
Thin archives' contents are copied verbatim into the repro tarballs; absolute paths to members don't get changed to be relative to the tarball's root.
I've only come across this problem because I was writing a test, and This is a small test for it; modified from # REQUIRES: x86
# RUN: rm -rf %t.dir; mkdir -p %t.dir
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/foo.o
# RUN: llvm-ar rcsT %t.dir/foo.a %t.dir/foo.o
# RUN: cd %t.dir
# RUN: %lld foo.a -o /dev/null --reproduce repro.tar
## Remove the original object to make sure we are not using it.
# RUN: rm foo.o
# RUN: tar xf repro.tar
# RUN: cd repro
# RUN: %lld @<!-- -->response.txt
.globl _main
_main:
nop Running it gives: ld64.lld: error: /Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.a: could not get the member defining symbol _main: '/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.o': No such file or directory When inspecting the archive in the repro file, indeed, the member is referred to by an absolute path: $ llvm-ar t build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/repro/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.a
/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.o |
@llvm/issue-subscribers-lld-elf Author: Daniel Bertalan (BertalanD)
Thin archives' contents are copied verbatim into the repro tarballs; absolute paths to members don't get changed to be relative to the tarball's root.
I've only come across this problem because I was writing a test, and This is a small test for it; modified from # REQUIRES: x86
# RUN: rm -rf %t.dir; mkdir -p %t.dir
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/foo.o
# RUN: llvm-ar rcsT %t.dir/foo.a %t.dir/foo.o
# RUN: cd %t.dir
# RUN: %lld foo.a -o /dev/null --reproduce repro.tar
## Remove the original object to make sure we are not using it.
# RUN: rm foo.o
# RUN: tar xf repro.tar
# RUN: cd repro
# RUN: %lld @<!-- -->response.txt
.globl _main
_main:
nop Running it gives: ld64.lld: error: /Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.a: could not get the member defining symbol _main: '/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.o': No such file or directory When inspecting the archive in the repro file, indeed, the member is referred to by an absolute path: $ llvm-ar t build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/repro/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.a
/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.o |
Thin archives' contents are copied verbatim into the repro tarballs; absolute paths to members don't get changed to be relative to the tarball's root.
I've only come across this problem because I was writing a test, and
%t/foo.o
expanded to an absolute path. Not sure if this could cause an issue in realistic cases.This is a small test for it; modified from
lld/test/MachO/reproduce-thin-archives.s
(ld.lld
is likely similarly affected by looking at the code):Running it gives:
ld64.lld: error: /Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.a: could not get the member defining symbol _main: '/Users/dani/Source/llvm-project/build/tools/lld/test/MachO/Output/reproduce-thin-archives.s.tmp.dir/foo.o': No such file or directory
When inspecting the archive in the repro file, indeed, the member is referred to by an absolute path:
The text was updated successfully, but these errors were encountered: