<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [ELF] - Incompatible emulation should not lead to error"
href="https://llvm.org/bugs/show_bug.cgi?id=31678">31678</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ELF] - Incompatible emulation should not lead to error
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>grimar@accesssoftek.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17853" name="attach_17853" title="reproduce">attachment 17853</a> <a href="attachment.cgi?id=17853&action=edit" title="reproduce">[details]</a></span>
reproduce
I found that when tried to link "arch/x86/realmode/rm" component of linux
kernel,
LLD reports:
ld: arch/x86/realmode/rm/header.o is incompatible with elf_x86_64
ld: error: arch/x86/realmode/rm/header.o is incompatible with elf_x86_64
ld: arch/x86/realmode/rm/trampoline_64.o is incompatible with elf_x86_64
All objects are i386, but invocation contains -m elf_x86_64 and we report a
error.
That does not seem to be correct. I found some description here:
<a href="http://stackoverflow.com/questions/38951492/linkers-emulation-vs-output-format">http://stackoverflow.com/questions/38951492/linkers-emulation-vs-output-format</a>
And performed a test. Linked reproduce using bfd with -m elf_x86_64 and -m
i386.
Both runs successfully output a "Intel 80386" binary. Segments have different
offset/alignment though:
-m elf_x86_64:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x200000 0x00000000 0x00000000 0x05258 0x05258 RWE 0x200000
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x10
-m i386:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x00000000 0x00000000 0x05258 0x05258 RWE 0x1000
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x10
So -m affects on some constants and should not emit error in this case.
I am going to investigate it more and fix. Comments are welcome.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>