[llvm-bugs] [Bug 43116] New: PPC32: executables linked with LLD gives segfault at _start on FreeBSD

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 26 07:07:05 PDT 2019


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

            Bug ID: 43116
           Summary: PPC32: executables linked with LLD gives segfault at
                    _start on FreeBSD
           Product: lld
           Version: unspecified
          Hardware: Other
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: alfredo.junior at eldorado.org.br
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

On FreeBSD13/powerpc64, I'm trying to compile and run powerpc32 binaries, but
they fail with segmentation fault at section "_start".

The test program is pretty simple: 

int main() { 
    return 0; 
}

The FreeBSD 32 bit compatibility libraries where linked using BFD and
applications compiled with CLANG9+BFD run fine on this system. The problem
appears when CLANG9+LLD9 is used.

Output on gdb:


Program received signal SIGSEGV, Segmentation fault.
0x39600000 in ?? ()
(gdb) bt
#0  0x39600000 in ?? ()
#1  0x100100b4 in _start (argc=1, argv=<optimized out>, env=<optimized out>,
obj=<optimized out>, cleanup=0x5003d254 <gethints+584>, 
    ps_strings=0x0) at /root/freebsd/lib/csu/powerpc/crt1.c:87


Following instruction by instruction execution on GDB, the crash occurs when
executing <_start+176>, with the following message:

Program received signal SIGSEGV, Segmentation fault.
0x39600000 in ?? ()
Cannot access memory at address 0x39600000

...
...
0x10010074 <_start+116> beq     0x10010084 <_start+132>
0x10010078 <_start+120> cmplwi  r6,0
0x1001007c <_start+124> bne     0x10010068 <_start+104>
0x10010080 <_start+128> b       0x1001008c <_start+140>
0x10010084 <_start+132> stw     r4,0(r3)
0x10010088 <_start+136> b       0x10010068 <_start+104>
0x1001008c <_start+140> cmplwi  r8,0
0x10010090 <_start+144> beq     0x1001009c <_start+156>
0x10010094 <_start+148> lis     r3,4099
0x10010098 <_start+152> stw     r8,24(r3)
0x1001009c <_start+156> lis     r3,4098
0x100100a0 <_start+160> addi    r3,r3,20
0x100100a4 <_start+164> cmplwi  r3,0
0x100100a8 <_start+168> beq     0x100100b8 <_start+184>
0x100100ac <_start+172> mr      r3,r7
0x100100b0 <_start+176> bl      0x100103a8 <00000000.plt_call32.atexit>
...
...

-- 
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/20190826/13e80b94/attachment.html>


More information about the llvm-bugs mailing list