bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/23856] New: Executables linked with gold against musl segfault


From: mail at nh2 dot me
Subject: [Bug gold/23856] New: Executables linked with gold against musl segfault at startup
Date: Sun, 04 Nov 2018 11:53:55 +0000

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

            Bug ID: 23856
           Summary: Executables linked with gold against musl segfault at
                    startup
           Product: binutils
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: mail at nh2 dot me
                CC: ian at airs dot com
  Target Milestone: ---

Hey,

we're trying to link (dynamically) some executables against musl with gold.

When we link with GNU ld, everything works fine, but with gold the executables
segfault at startup.

Version:

   GNU gold (GNU Binutils 2.30) 1.15

We strongly suspect that it is the issue described in here:

    https://www.openwall.com/lists/musl/2015/05/01/5

Quote:

    The problem is that gold does not know how to process relocations for
    undefined weak references correctly. When the code in question is
    PIC/PIE, the weak reference can be kept for resolving at runtime.
    Instead of:

      804846f:     b8 70 83 04 08          mov    $0x8048370,%eax

    where the linker filled in a fixed address (the PLT slot) which the
    code happily sees is non-zero and then calls it, PIC code would read
    the address from the GOT. In non-PIC code, the linker (ld) *MUST*
    resolve undefined weak references to the address zero; they are not
    overridable at runtime because non-PIC doesn't support that.

    This is a bug in gold, but I have no idea how it works at all, even
    with glibc. The same issue should arise in gcc's crt files.

    You can probably work around it for now by building the app as PIE.

Here the musl author suggests that it's a bug in gold, but from what I can
tell, an issue was never filed, so I'm taking on that task now.

What is your take on this issue?

Is this something that you think gold should support, or is this a feature
intentionally left out (or maybe something else is at play)?

Thanks a lot!

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