diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-08-15 06:18:30 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-08-18 05:13:57 -0700 |
commit | 4e46c5a14f39342897cfcb7ecb9c0270f30247f4 (patch) | |
tree | 0898957c1ad6ddd58e06c5ef5fb1da224ed3997f /zlib | |
parent | 570f4c0c11910d845c35e94764ded54cb1111583 (diff) | |
download | binutils-4e46c5a14f39342897cfcb7ecb9c0270f30247f4.zip binutils-4e46c5a14f39342897cfcb7ecb9c0270f30247f4.tar.gz binutils-4e46c5a14f39342897cfcb7ecb9c0270f30247f4.tar.bz2 |
ld: Issue an error if group nested too deeply
If a linker script has a group nested too deeply by mistake, issue an
error instead of hanging forever without outputting any error message.
PR ld/33265
* ldlang.c (MAX_NESTED_GROUP_DEPTH): New.
(open_input_bfds): Add a pointer argument for the nested group
count. Increment the count before the while loop and decrement
it after the loop. Issue an error if the nested group count >=
MAX_NESTED_GROUP_DEPTH when processing input statement.
(lang_process): Update open_input_bfds calls.
(cmdline_emit_object_only_section): Likewise.
* testsuite/ld-scripts/libpr33265-1.a: New file.
* testsuite/ld-scripts/libpr33265-2.a: Likewise.
* testsuite/ld-scripts/libpr33265-3a.a: Likewise.
* testsuite/ld-scripts/libpr33265-3b.a: Likewise.
* testsuite/ld-scripts/libpr33265-3c.a: Likewise.
* testsuite/ld-scripts/pr33265-1.d: Likewise.
* testsuite/ld-scripts/pr33265-2.d: Likewise.
* testsuite/ld-scripts/pr33265-3.d: Likewise.
* testsuite/ld-scripts/script.exp: Run PR ld/33265 tests.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'zlib')
0 files changed, 0 insertions, 0 deletions