https://sourceware.org/bugzilla/show_bug.cgi?id=33265
--- Comment #2 from kartatz <kartatz at amanoteam dot com> --- Thanks! I applied the patch on top of binutils 2.45, and it seems to work in the scenarios where the path points to an absolute path as well as when the path is relative: ``` # Relative $ echo -e "GROUP ( libfoo.so )" > libfoo.so $ gcc -l foo -L . main.c -Xlinker -v <...> GNU ld (GNU Binutils) 2.45 /usr/bin/ld: error: linker script './libfoo.so' included recursively collect2: error: ld returned 1 exit status # Absolute $ echo -e "GROUP ( /home/ubuntu/libfoo.so )" > libfoo.so $ gcc -l foo -L . main.c -Xlinker -v <...> GNU ld (GNU Binutils) 2.45 /usr/bin/ld: error: linker script '/home/ubuntu/libfoo.so' included recursively collect2: error: ld returned 1 exit status ``` But I'm still able to reproduce the issue in this specific edge case where the path contains a leading "./" in it: ``` $ echo -e "GROUP ( ./libfoo.so )" > libfoo.so $ gcc -l foo -L . main.c -Xlinker -v <...> GNU ld (GNU Binutils) 2.45 <hangs> ``` Looking at the strace output for the bfd invocation, I see it prepending a new "./" every time it tries to open the file: ``` $ gcc -c main.c $ strace ld -L . -l foo main.o <...> openat(AT_FDCWD, "./libfoo.so", O_RDONLY) = 7 getcwd("/home/ubuntu", 4096) = 13 newfstatat(AT_FDCWD, "/home/ubuntu/libfoo.so", {st_mode=S_IFREG|0664, st_size=22, ...}, AT_SYMLINK_NOFOLLOW) = 0 ioctl(7, TCGETS, 0xffffe6311380) = -1 ENOTTY (Inappropriate ioctl for device) fstat(7, {st_mode=S_IFREG|0664, st_size=22, ...}) = 0 read(7, "GROUP ( ./libfoo.so )\n", 8192) = 22 read(7, "", 4096) = 0 read(7, "", 8192) = 0 ioctl(7, TCGETS, 0xffffe630e480) = -1 ENOTTY (Inappropriate ioctl for device) close(7) = 0 openat(AT_FDCWD, "././libfoo.so", O_RDONLY) = 7 <...> openat(AT_FDCWD, "./././libfoo.so", O_RDONLY) = 7 <...> openat(AT_FDCWD, "././././libfoo.so", O_RDONLY) = 7 <...> ``` -- You are receiving this mail because: You are on the CC list for the bug.