bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/21703] The first symbol definition is overwritten by second defi


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/21703] The first symbol definition is overwritten by second definition when --allow-multiple-definition is provieded
Date: Tue, 24 Oct 2017 12:02:36 +0000

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

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

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

commit 93f4de3929aeb3e21d57950bfa96539599a92f2a
Author: Renlin Li <address@hidden>
Date:   Tue Oct 24 12:42:30 2017 +0100

    [BFD][PR21703]Override the new defined symbol with the old normal symbol
when --allow-multiple-definition is provided.

    The behavior of _bfd_elf_merge_symbol and _bfd_generic_link_add_one_symbol
is
    inconsistent.

    In multiple definition case, _bfd_elf_merge_symbol decided to override the
old
    symbol definition with the new defintion, (size, type, target data)
    In _bfd_generic_link_add_one_symbol, it simply return without doing
anything
    because of allow-multiple-definition is provided.
    This leaves the symbol in a wrong state.

    Here, following the documentation, I made this patch to force the old
definition
    override the new definition if the old symbol is not dynamic or weak.
    Because, in those two cases, it's expected to do some merge. I have checked
    that, those two cases are properly handled.

    bfd/
        PR ld/21703
        * elflink.c (_bfd_elf_merge_symbol): Handle multiple definition case.

    ld/

        PR ld/21703
        * testsuite/ld-elf/elf.exp: Run new tests.
        * testsuite/ld-elf/pr21703-1.s: New.
        * testsuite/ld-elf/pr21703-2.s: New.
        * testsuite/ld-elf/pr21703-3.s: New.
        * testsuite/ld-elf/pr21703-4.s: New.
        * testsuite/ld-elf/pr21703-r.sd: New.
        * testsuite/ld-elf/pr21703-shared.sd: New.
        * testsuite/ld-elf/pr21703.sd: New.
        * testsuite/ld-elf/pr21703.ver: New.

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