bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/22626] invalid dynindx used for dynamic relocs against section s


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/22626] invalid dynindx used for dynamic relocs against section syms
Date: Mon, 18 Dec 2017 22:15:48 +0000

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

--- Comment #12 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by Alan Modra <address@hidden>:

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

commit 63f452a8bfd9c89b56dcc087cea84151e7a9ec24
Author: Alan Modra <address@hidden>
Date:   Mon Dec 18 22:27:08 2017 +1030

    PR22626, invalid dynindx used for dynamic relocs against section syms

    _bfd_elf_link_renumber_dynsyms is called twice by the linker.  The
    first call in bfd_elf_size_dynamic_sections is just to answer the
    question as to whether there are there any dynamic symbols.  The
    second call in bfd_elf_size_dynsym_hash_dynstr sets the st_shndx value
    that dynamic symbols will have.  strip_excluded_output_sections is
    called between these two calls.  So sections seen on the first
    _bfd_elf_link_renumber_dynsyms pass might differ from those seen on
    the second pass.  Unfortunately, that can result in a stripped
    section's dynamic symbol being assigned a dynindx on the first pass
    but not corrected to the final value (of zero, ie. not dynamic) on the
    second pass.  PowerPC, x86, mips, and most other targets that emit
    dynamic section symbols, just test that section symbol dynindx is
    non-zero before using a given section symbol in dynamic relocations.

    This patch prevents _bfd_elf_link_renumber_dynsyms from setting any
    section symbol dynindx on the first pass.

        PR 22626
        * elflink.c (_bfd_elf_link_renumber_dynsyms): Don't set section
        dynindx when section_sym_count is NULL.
        (bfd_elf_size_dynamic_sections): Pass NULL section_sym_count to
        preliminary _bfd_elf_link_renumber_dynsyms call.

-- 
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]