bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMI


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
Date: Thu, 29 Jun 2023 17:36:25 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25617

--- Comment #46 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46675b6b8160e97485583522852ad86507bd9072

commit 46675b6b8160e97485583522852ad86507bd9072
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 4 20:32:35 2020 -0800

    bfd: Improve nm and objdump without section header

    When there is no section header in an executable or shared library, we
    reconstruct dynamic symbol table from the PT_DYNAMIC segment, which
    contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH, DT_STRTAB, DT_SYMTAB,
    DT_STRSZ, and DT_SYMENT entries, to improve nm and objdump.  For DT_HASH,
    the number of dynamic symbol table entries equals the number of chains.
    For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols with non-STB_LOCAL
    indings are in hash table.  Since DT_GNU_HASH/DT_MIPS_XHASH place all
    symbols with STB_LOCAL binding before symbols with other bindings and
    all undefined symbols defined ones in dynamic symbol table, the highest
    symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest dynamic symbol
    table index.  We can also get symbol version from DT_VERSYM, DT_VERDEF
    and DT_VERNEED entries.

    dt_symtab, dt_versym, dt_verdef, dt_verneed, dt_symtab_count,
    dt_verdef_count, dt_verneed_count and dt_strtab are added to
    elf_obj_tdata to store dynamic symbol table information.

            PR ld/25617
            * elf-bfd.h (elf_obj_tdata): Add dt_symtab, dt_verdef, dt_verneed,
            dt_symtab_count, dt_verdef_count, dt_verneed_count and dt_strtab.
            (elf_use_dt_symtab_p): New.
            (_bfd_elf_get_dynamic_symbols): Likewise.
            (_bfd_elf_get_section_from_dynamic_symbol): Likewise.
            * elf.c (bfd_elf_get_elf_syms): Use dynamic symbol table if
            neeeded.
            (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
            (_bfd_elf_slurp_version_tables): Likewise.
            (offset_from_vma): New function.
            (get_hash_table_data): Likewise.
            (_bfd_elf_get_dynamic_symbols): Likewise.
            (_bfd_elf_get_section_from_dynamic_symbol): Likewise.
            (_bfd_elf_get_symbol_version_name): Likewise.
            * elfcode.h (elf_object_p): Call _bfd_elf_get_dynamic_symbols
            to reconstruct dynamic symbol table from PT_DYNAMIC segment if
            there is no section header.
            (elf_slurp_symbol_table): Use dynamic symbol table if neeeded.
            Don't free isymbuf when dynamic symbol table is used.
            * elflink.c (elf_link_is_defined_archive_symbol): Return wrong
            format error when dynamic symbol table is used.
            (elf_link_add_object_symbols): Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]