diff options
author | Alan Modra <amodra@gmail.com> | 2024-02-14 14:34:47 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-02-15 11:24:13 +1030 |
commit | cf95b909e2c29476525da29bfb4f0d2c8211e8b6 (patch) | |
tree | c437c362eb3e94776db9f3dfd40e8d679c5a153b /bfd/elfxx-mips.c | |
parent | 122d82284483577a388541f7fe2739754d4699b6 (diff) | |
download | gdb-cf95b909e2c29476525da29bfb4f0d2c8211e8b6.zip gdb-cf95b909e2c29476525da29bfb4f0d2c8211e8b6.tar.gz gdb-cf95b909e2c29476525da29bfb4f0d2c8211e8b6.tar.bz2 |
elf_backend_finish_dynamic_symbol returning false
Returning false from elf_backend_finish_dynamic_symbol will not result
in an error being printed unless bfd_error is set but will result in
the linker exiting with a non-zero status. If just bfd_error is set
then a generic "final link failed" will result, which doesn't help a
user much. So elf_backend_finish_dynamic_symbol should print its own
error message whenever returning false, or use BFD_ASSERT or abort to
print assertion failures for conditions that shouldn't occur.
This patch does that, and removes unnecessary "htab != NULL" tests in
elf_backend_finish_dynamic_symbol. Such tests aren't needed in a
function only called via elf_backend_data.
Diffstat (limited to 'bfd/elfxx-mips.c')
-rw-r--r-- | bfd/elfxx-mips.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index b888e76..4790306 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -6842,6 +6842,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, indx = 0; else if (sec == NULL || sec->owner == NULL) { + BFD_ASSERT (0); bfd_set_error (bfd_error_bad_value); return false; } @@ -11186,7 +11187,13 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, sign extension at runtime in the stub, resulting in a negative index value. */ if (h->dynindx & ~0x7fffffff) - return false; + { + _bfd_error_handler + (_("%pB: cannot handle more than %d dynamic symbols"), + output_bfd, 0x7fffffff); + bfd_set_error (bfd_error_bad_value); + return false; + } /* Fill the stub. */ if (micromips_p) |