https://sourceware.org/bugzilla/show_bug.cgi?id=33265
Bug ID: 33265
Summary: The linker script interpreter does not check for
recursion before opening a new file
Product: binutils
Version: 2.44
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: kartatz at amanoteam dot com
Target Milestone: ---
I was messing around with linker scripts when, at some point, I mistakenly
created a linker script that points to itself, causing bfd to recursively
attempt to open the same file over and over. This can be reproduced with:
```
$ echo 'GROUP ( ./libfoo.so )' > ./libfoo.so
$ echo 'int main() {}' > '/main.c
$ gcc -l foo -L . ./main.c
```
It took me some time to figure out what the problem was, since the linker just
hangs forever without outputting any error message.
For reference, older versions of the linker (specifically, the one that comes
with Ubuntu 20.04 by default) output this error message instead:
```
$ gcc -l foo -L . ./main.c -Xlinker -v
<...>
GNU ld (GNU Binutils for Ubuntu) 2.34
/usr/bin/ld: cannot open linker script file ./libfoo.so: Too many open files
collect2: error: ld returned 1 exit status
```
Not a very helpful error message, but still better than outputting no error at
all.
--
You are receiving this mail because:
You are on the CC list for the bug.