<div dir="ltr"><div>When I build a simple hello world sample on i386 and x64 on Linux with Clang 3.3, the x64 version has .init_array / .fini_array and the i386 binary has .ctors / .dtors.</div><div><br></div><div>i386:</div>
<div><div> [18] .ctors PROGBITS</div><div> [19] .dtors PROGBITS</div></div><div><br></div><div>x64:<br></div><div><div> [18] .init_array INIT_ARRAY</div><div> [19] .fini_array FINI_ARRAY</div>
</div><div><br></div><div>There is code in ObjectFileELF.cpp which specifically looks for sections named ".ctors" and ".dtors" and sets the symbol type to eSymbolTypeCode if it not already set. There is no check for init_array there. That means the x64 version lists these symbols as Invalid currently.</div>
<div><br></div><div>(lldb) target modules dump symtab hello_world<br></div><div><br></div><div>i386:<br></div><div><div>[ 17] Code __init_array_end</div><div>[ 18] Code __init_array_start</div>
</div><div><br></div><div>x64:</div><div><div>[ 17] Invalid __init_array_end</div><div>[ 18] Invalid __init_array_start</div></div><div><br></div><div>I believe the fix is to add a check for init_array + fini_array and mark those sections as code. If anyone has any knowledge / comments on this, please fire away, otherwise I'll post a patch in the next couple days.</div>
<div><br></div><div>There are also some sections in both i386 and x64 that are being marked as undefined. I assume this is ok?</div><div><br></div><div><div>[ 24] 55 Undefined 0x0000000000000000 0x0000000000000000 0x00000020 __gmon_start__</div>
<div>[ 25] 56 Undefined 0x0000000000000000 0x0000000000000000 0x00000020 _Jv_RegisterClasses</div></div><div>[ 28] 59 X Undefined 0x0000000000000000 0x0000000000000000 0x00000012 __libc_start_main@@GLIBC_2.0<br>
</div><div><br></div><div>Thanks.</div><div> -Mike</div></div>