<div dir="ltr">Yeah, not sure - you mention the linker produces errors, but the errors you showed looked like objdump errors? Were those errors from trying to dump the linked executable, and not errors that were produced by the linker itself?<br><br>But yeah, don't really know what's happening there. Might be you need to debug the linker & see what it's reading/being confused by.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 18, 2020 at 10:05 AM Nagaraju Mekala <<a href="mailto:nagaraju.mekala87@gmail.com">nagaraju.mekala87@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><br>On Saturday, April 18, 2020, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 18, 2020 at 3:02 AM Nagaraju Mekala via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello All,<br>
<br>
I was trying to add Microblaze target to LLVM backend. I was able to<br>
generate object file with relocations. and debug symbols.<br>
<br>
When I try to link this object file with microblaze GCC linker I am<br>
getting below errors and debug symbols are missing in it.<br>
<br>
mb-objdump: DWARF error: found dwarf version '15877', this reader only<br>
handles version 2, 3, 4 and 5 information<br>
mb--objdump: DWARF error: found dwarf version '3328', this reader only<br>
handles version 2, 3, 4 and 5 information<br>
mb--objdump: DWARF error: found dwarf version '1280', this reader only<br>
handles version 2, 3, 4 and 5 information<br>
<br>
Any idea when does the above errors will come?<br>
The llvm generated object file has debug symbols, </blockquote><div><br></div><div>When you say "has debug symbols" what do you mean? What tools have you used to observe these symbols/information?</div></div></div></blockquote><div> </div><div>I have observed the debug sections with mb-objdump
with -xSD flag (binutils based objdump which we use it with mb-gcc compiler). Even with readelf I was able to get the dwarf sections.</div><div>Attached is the dwarf dump generated with readelf --debug-dump helloworld.o command..</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">where as elf doesn't have.<br></blockquote><div><br>I take it you mean the linked executable? (the "ELF" file format is used for both the object files and the linked executable)</div><div><br> </div></div></div></blockquote><div> Sorry for the confusion. You are correct, I meant the linked executable. </div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I tried modifying MCTarget layer a lot but not able to find the root-cause.<br>
Any clue is much appreciated.<br>
<br>
ex:<br>
hello.c<br>
int main()<br>
{<br>
printf("Hello World\n\r");<br>
printf("Successfully ran Hello World application");<br>
return 0;<br>
}<br>
<br>
hello.o objdump:<br>
int main()<br>
{<br>
0: 10a00000 addk r5, r0, r0<br>
4: f8a1002c swi r5, r1, 44<br>
<br>
printf("Hello World\n\r");<br>
8: b0000000 imm 0<br>
8: R_MICROBLAZE_64 .rodata.str1.1<br>
c: a0c00000 ori r6, r0, 0<br>
10: f8a10028 swi r5, r1, 40<br>
14: b0000000 imm 0<br>
14: R_MICROBLAZE_64_PCREL printf<br>
18: b9f40000 brlid r15, 0<br>
1c: 10a60000 addk r5, r6, r0<br>
printf("Successfully ran Hello World application");<br>
20: b0000000 imm 0<br>
20: R_MICROBLAZE_64 .rodata.str1.1+0xe<br>
24: a0a00000 ori r5, r0, 0<br>
28: b0000000 imm 0<br>
28: R_MICROBLAZE_64_PCREL printf<br>
2c: b9f40000 brlid r15, 0<br>
30: f8610024 swi r3, r1, 36<br>
return 0;<br>
34: e8a10028 lwi r5, r1, 40<br>
38: f8610020 swi r3, r1, 32<br>
3c: 10650000 addk r3, r5, r0<br>
40: b60f0008 rtsd r15, 8<br>
44: 80000000 or r0, r0, r0<br>
....<br>
...<br>
<br>
hello.elf objdump<br>
8000021c <main>:<br>
8000021c: 10a00000 addk r5, r0, r0<br>
80000220: f8a1002c swi r5, r1, 44<br>
80000224: b0008000 imm -32768<br>
80000228: a0c0f418 ori r6, r0, -3048<br>
8000022c: f8a10028 swi r5, r1, 40<br>
80000230: b9f400ec brlid r15, 236<br>
80000234: 10a60000 addk r5, r6, r0<br>
80000238: b0008000 imm -32768<br>
8000023c: a0a0f426 ori r5, r0, -3034<br>
80000240: b9f400dc brlid r15, 220<br>
80000244: f8610024 swi r3, r1, 36<br>
80000248: e8a10028 lwi r5, r1, 40<br>
8000024c: f8610020 swi r3, r1, 32<br>
80000250: 10650000 addk r3, r5, r0<br>
80000254: b60f0008 rtsd r15, 8<br>
80000258: 80000000 or r0, r0, r0<br>
<br>
Thanks in Advance,<br>
Nagaraju<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>
</blockquote>
</blockquote></div>