bfd: Fix handling of debugging sections in relocation processing
Correctly processes debugging sections during relocation to ensure debug info integrity.
This commit corrects an issue in bfd_generic_get_relocated_section_contents where debugging sections were incorrectly excluded. Previously, a change intended to generalize section merging incorrectly filtered out SEC_DEBUGGING sections. This led to broken debug information in the resulting binaries, causing warnings with tools like objdump when inspecting debug info. The fix ensures these sections are handled appropriately, resolving testsuite fallout and preserving debug information.
In Details
This commit addresses an issue in bfd_generic_get_relocated_section_contents where SEC_DEBUGGING sections were unilaterally excluded due to a misunderstanding in commit 810b19952d5d. The problematic exclusion is removed, and special handling is added for calls originating from bfd_simple_get_relocated_section_contents, similar to other special cases within the function. This restores correct processing of debug sections, which was causing testsuite fallout and visible issues with tools like objdump in binutils 2.47.
- bfd
- Binary File Descriptor library. A library used by GNU Binutils to provide a common interface for accessing various binary file formats, including ELF and a.out.
- relocation
- The process of updating symbolic references in object code to absolute addresses, typically performed by the linker.
- SEC_DEBUGGING
- A flag indicating that a section in an object file contains debugging information.
- debug info
- Information embedded in an executable or object file that allows debuggers to map machine code back to source code, enabling features like breakpoints, variable inspection, and stack traces.
- objdump
- A utility that displays information from object files, including disassembly of code and display of symbols and sections.