Remove duplicate symbol lookups in ELF backends
Eliminates redundant local symbol lookups in the `check_relocs` function across several ELF backends.
This commit addresses a performance and code duplication issue by removing redundant local symbol lookups within the check_relocs function in multiple ELF backends. The affected backends include csky, i386, s390, x86-64, aarch64, kvx, and riscv. This change simplifies the code and avoids repeated lookups.
In Details
Several ELF backends in BFD were performing a local symbol lookup (e.g., via bfd_sym_lookup or similar) within their check_relocs function, even when the result was not used or was redundant. This commit consolidates these lookups by performing the lookup once and reusing the result, or removing the lookup entirely if unnecessary. It also trims an old comment in some files.
- BFD
- Binary File Descriptor library. A low-level library used by GNU Binutils to parse and manipulate various object file formats.
- ELF
- Executable and Linkable Format. A common standard for object file formats on Unix-like systems.
- relocation
- The process of updating symbolic references (like function or variable addresses) in relocatable object files to their final addresses when linked into an executable or shared library.
- backend
- In the context of a compiler or linker, a backend refers to the part of the toolchain that handles a specific target architecture or object file format.
- symbol lookup
- The process of searching for information about a symbol (e.g., a function or variable name) within an object file or executable.