<div dir="ltr">Hi,<div><br></div><div>I was trying to debug a PPC64 crash from a X86_64 machine. I got crash (7.2.8) to work with a "make target=PPC64", but when I tried to load an extension I got this error:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">crash> extend /root/misc/builds/mpykdump-v3.2.1-g4308a70/Extension/mpykdump.so</font></div><div><font face="monospace">extend: /root/misc/builds/mpykdump-v3.2.1-g4308a70/Extension/mpykdump.so: not an ELF format object file</font></div></blockquote><div><br></div><div>I tried other sample extensions (like dminfo) with the same result.</div><div><br></div><div>A little debugging shows that "is_shared_object()" is returning FALSE leading to this. Just commenting the call makes the extension work as expected.</div><div><br></div><div>gdb of is_shared_object():</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">3852            } else if ((elf64->e_ident[EI_CLASS] == ELFCLASS64) &&</font></div><div><font face="monospace">(gdb) </font></div><div><font face="monospace">3854                    switch (swap16(elf64->e_machine, swap))</font></div><div><font face="monospace">(gdb) p elf64</font></div><div><font face="monospace">$6 = (Elf64_Ehdr *) 0x7fffffffca40</font></div><div><font face="monospace">(gdb) p *elf64</font></div><div><font face="monospace">$7 = {e_ident = "\177ELF\002\001\001\000\000\000\000\000\000\000\000", e_type = 3, e_machine = 62, </font></div><div><font face="monospace">  e_version = 1, e_entry = 511360, e_phoff = 64, e_shoff = 20379704, e_flags = 0, e_ehsize = 64, </font></div><div><font face="monospace">  e_phentsize = 56, e_phnum = 7, e_shentsize = 64, e_shnum = 31, e_shstrndx = 28}</font></div><div><font face="monospace">(gdb) p/x *elf64</font></div><div><font face="monospace">$8 = {e_ident = {0x7f, 0x45, 0x4c, 0x46, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, </font></div><div><font face="monospace">  e_type = 0x3, e_machine = 0x3e, e_version = 0x1, e_entry = 0x7cd80, e_phoff = 0x40, e_shoff = 0x136f838, </font></div><div><font face="monospace">  e_flags = 0x0, e_ehsize = 0x40, e_phentsize = 0x38, e_phnum = 0x7, e_shentsize = 0x40, e_shnum = 0x1f, </font></div><div><font face="monospace">  e_shstrndx = 0x1c}</font></div><div><font face="monospace">(gdb) n</font></div><div><font face="monospace">3867                            if (machine_type("X86_64") || machine_type("ARM64")) </font></div><div><font face="monospace">(gdb) </font></div><div><font face="monospace">3877                            if (machine_type("ARM64"))</font></div><div><font face="monospace">(gdb) </font></div><div><font face="monospace">3887                    if (CRASHDEBUG(1))</font></div><div><font face="monospace">(gdb) p swap</font></div><div><font face="monospace">$9 = 0</font></div><div>(gdb) p machine_type("X86_64")<br>$10 = 0<br>(gdb) p machine_type("PPC64")<br>$11 = 1<br></div><div><font face="monospace">(gdb) n</font></div><div><font face="monospace">3793                    return FALSE;</font></div></blockquote><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">It appears like the fix should be something like this (which does fix the issue), but I'd leave it to experts how to fix this correctly:</font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div> <font face="monospace"># diff -up <a href="http://symbols.c.org">symbols.c.org</a> symbols.c<br>--- <a href="http://symbols.c.org">symbols.c.org</a>       2020-09-02 11:28:33.855265712 -0700<br>+++ symbols.c   2020-09-02 11:28:36.964274966 -0700<br>@@ -3864,7 +3864,8 @@ is_shared_object(char *file)<br>                        break;<br> <br>                case EM_X86_64:<br>-                       if (machine_type("X86_64") || machine_type("ARM64")) <br>+                       if (machine_type("X86_64") || machine_type("ARM64") ||<br>+                                       machine_type("PPC64"))<br>                                return TRUE;<br>                        break;</font><br></div></blockquote><div><font face="arial, sans-serif">Regards,</font></div><div>-Arun</div></div>