bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/16794] gold ignores R_386_GOTOFF addend


From: amodra at gmail dot com
Subject: [Bug gold/16794] gold ignores R_386_GOTOFF addend
Date: Thu, 26 Sep 2019 02:21:55 +0000

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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|amodra at gmail dot com            |
           Assignee|ccoutant at gmail dot com          |amodra at gmail dot com
   Target Milestone|---                         |2.33
            Summary|gold doesn't include the    |gold ignores R_386_GOTOFF
                   |"implicit addend" when      |addend
                   |processing REL relocations  |
                   |to mergable sections        |

--- Comment #11 from Alan Modra <amodra at gmail dot com> ---
OK, so my fix wasn't correct since Relocate_functions<32, false>::rel32(view,
value) applies the addend again.  This would have worked:

-       elfcpp::Elf_types<32>::Elf_Addr value;
-       value = (psymval->value(object, 0)
-                - target->got_plt_section()->address());
-       Relocate_functions<32, false>::rel32(view, value);
+       typedef typename elfcpp::Swap<32, false>::Valtype Valtype;
+       Valtype* wv = reinterpret_cast<Valtype*>(view);
+       Valtype addend = elfcpp::Swap<32, false>::readval(wv);
+       Valtype value = (psymval->value(object, addend)
+                        - target->got_plt_section()->address());
+       elfcpp::Swap<32, false>::writeval(wv, value);

However, that looks very much like a pcrel32 using object/psymval, thus

        elfcpp::Elf_types<32>::Elf_Addr reladdr;
        reladdr = target->got_plt_section()->address();
        Relocate_functions<32, false>::pcrel32(view, object, psymval, reladdr);

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