Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmd segfaults when given elf lib on os x #19196

Open
dlangBugzillaToGithub opened this issue Sep 25, 2016 · 0 comments
Open

dmd segfaults when given elf lib on os x #19196

dlangBugzillaToGithub opened this issue Sep 25, 2016 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

John Colvin (@John-Colvin) reported this on 2016-09-25T22:42:06Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=16543

Description

Created attachment 1616
the offending elf archive

The attached ELF archive file causes dmd to segfault on OS X if you run this:

dmd -lib liblzf.a

Here's backtrace and disassembly:

* thread #1: tid = 0xbb145, 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
    frame #0: 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5
dmd`Port::readlongLE:
->  0x10014fbcd <+5>:  movzbl 0x3(%rdi), %eax
    0x10014fbd1 <+9>:  shll   $0x8, %eax
    0x10014fbd4 <+12>: movzbl 0x2(%rdi), %ecx
    0x10014fbd8 <+16>: orl    %ecx, %eax

(lldb) bt all
* thread #1: tid = 0xbb145, 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
  * frame #0: 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5
    frame #1: 0x000000010012f6bf dmd`D4ddmd7libmach7LibMach9addObjectMFPxaxAhZv + 1223
    frame #2: 0x00000001000db7ed dmd`D4ddmd4mars7tryMainFmPPxaZi + 14205
    frame #3: 0x00000001000030e3 dmd`_Dmain + 39
    frame #4: 0x000000010023e260 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
    frame #5: 0x000000010023e194 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
    frame #6: 0x000000010023e205 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45
    frame #7: 0x000000010023e194 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
    frame #8: 0x000000010023e0fa dmd`_d_run_main + 498
    frame #9: 0x000000010000317c dmd`main + 16
    frame #10: 0x0000000100001724 dmd`start + 52
(lldb) disas
dmd`Port::readlongLE:
    0x10014fbc8 <+0>:  pushq  %rbp
    0x10014fbc9 <+1>:  movq   %rsp, %rbp
    0x10014fbcc <+4>:  pushq  %rbx
->  0x10014fbcd <+5>:  movzbl 0x3(%rdi), %eax
    0x10014fbd1 <+9>:  shll   $0x8, %eax
    0x10014fbd4 <+12>: movzbl 0x2(%rdi), %ecx
    0x10014fbd8 <+16>: orl    %ecx, %eax
    0x10014fbda <+18>: shll   $0x8, %eax
    0x10014fbdd <+21>: movzbl 0x1(%rdi), %edx
    0x10014fbe1 <+25>: orl    %edx, %eax
    0x10014fbe3 <+27>: shll   $0x8, %eax
    0x10014fbe6 <+30>: movzbl (%rdi), %ebx
    0x10014fbe9 <+33>: orl    %ebx, %eax
    0x10014fbeb <+35>: popq   %rbx
    0x10014fbec <+36>: popq   %rbp
    0x10014fbed <+37>: retq   
    0x10014fbee <+38>: nop    
(lldb)

!!!There are attachements in the bugzilla issue that have not been copied over!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants