[llvm-bugs] [Bug 47240] New: Static PIE executables segfault on initialization

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 19 14:05:24 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47240

            Bug ID: 47240
           Summary: Static PIE executables segfault on initialization
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: victor at westerhu.is
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

When building a static PIE executable using LLD, the executable segfaults
before invoking main(). Using a debugger, I've traced the error back to the
glibc function apply_irel() in csu/libc_start.c. The same executable built
using ld.bfd works fine. A difference I've noticed between the two executables,
is that ld.bfd places ifunc relocations in a .rela.plt section, while ld.lld
places them in in the .rela.dyn section.

Even an empty program (int main(int argc, char** argv){}) gives these results,
so it seems to have nothing to do with the particulars of the software I was
compiling. The same results happen when using ld.lld as the linker for GCC.

I've tested it on Debian testing and Ubuntu 20.04 (tried LLD 10.0.1, 11.0.0,
and 12.0.0 on both) and Arch Linux (LLD 10.0.1). I've only tried x86_64,
because I don't have access to other hardware.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200819/1facd107/attachment.html>


More information about the llvm-bugs mailing list