bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/23244] RISC-V 64 relocation truncated to fit in case of undefine


From: address@hidden
Subject: [Bug ld/23244] RISC-V 64 relocation truncated to fit in case of undefined weak references
Date: Wed, 30 May 2018 05:17:22 +0000

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

--- Comment #2 from Sebastian Huber <address@hidden> ---
Thanks for your analysis.

Calling a weakly undefined function is undefined behaviour. Would it be
possible to replace the call to zero with a call to the current PC (infinite
loop) or a nop?

On the ARM architecture it looks like a nop is created:

        .type   _start, %function
_start:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        push    {r3, lr}
        movw    r3, #:lower16:f
        movt    r3, #:upper16:f
        cbz     r3, .L1
        bl      f
        bl      f
.L1:
        pop     {r3, pc}
        .size   _start, .-_start
        .weak   f

Final executable code (Thumb-2):

Disassembly of section .text:

90000000 <_start>:
90000000:       b508            push    {r3, lr}
90000002:       f240 0300       movw    r3, #0
90000006:       f2c0 0300       movt    r3, #0
9000000a:       b11b            cbz     r3, 90000014 <_start+0x14>
9000000c:       f3af 8000       nop.w
90000010:       f3af 8000       nop.w
90000014:       bd08            pop     {r3, pc}
90000016:       bf00            nop

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