<div dir="ltr">Hi Chris.<div><br></div><div style>I have Implement a basic support for ARM now.</div><div style>The following types are implemented now:</div><div style><br></div><div style><font color="#000000">ARM REL TYPE:</font></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_JUMP24 </font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_ABS32 </font></span></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_CALL </font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_MOVW_ABS_NC </font></span></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_MOVT_ABS</font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_V4BX </font></span></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000"><br></font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">THUMB32 REL TYPE: </font></span></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_THM_CALL </font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_ABS32 </font></span></div>
<div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_THM_MOVW_ABS_NC </font></span></div><div style="text-indent:0px">
<span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_THM_MOVT_ABS </font></span></div><div style="text-indent:0px"><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000">R_ARM_THM_JUMP24</font></span><br>
</div><div style="text-indent:0px"><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px">R_ARM_THM_JUMP19</span><span style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:19px"><font color="#000000"><br>
</font></span></div><div style="text-indent:0px"><br></div><div style="text-indent:0px">The loader patch is place here:<a href="https://gist.github.com/MrVan/5517361">https://gist.github.com/MrVan/5517361</a></div><div style="text-indent:0px">
I also noted something when implement the types:</div><div style="text-indent:0px"><a href="https://docs.google.com/document/d/1vdG3UtU-Vun6_WL9hHv8oV3ZlktCGKYCIBVbtm08y08/edit?usp=sharing">https://docs.google.com/document/d/1vdG3UtU-Vun6_WL9hHv8oV3ZlktCGKYCIBVbtm08y08/edit?usp=sharing</a></div>
<div style="text-indent:0px">I have not successfully make my tiny6410 board run in thumb mode.</div><div style="text-indent:0px">Thus I manually caculated the relocation for Thumb32, mainly THM_CALL , and the result is right. </div>
<div style="text-indent:0px">I think each reloc type after implemented should be tested, but because of the hardware reason, I only tested part.</div><div style="text-indent:0px">If anytime, thanks for your reviewing and comments. </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/26 Peng Fan <span dir="ltr"><<a href="mailto:van.freenix@gmail.com" target="_blank">van.freenix@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div><br></div><div>1. </div><div>I modified the ABS32 TYPE of arm, as listed below:</div><div><div>diff --git a/rtl-mdreloc-arm.c b/rtl-mdreloc-arm.c</div><div>index f31d1ef..f3f2680 100644</div>
<div>--- a/rtl-mdreloc-arm.c</div><div>+++ b/rtl-mdreloc-arm.c</div><div>@@ -144,10 +144,10 @@ rtems_rtl_elf_relocate_rel (const rtems_rtl_obj_t* obj,</div><div> #endif</div><div> #endif</div><div> </div><div>-<span style="white-space:pre-wrap"> </span>case R_TYPE(ABS32):<span style="white-space:pre-wrap"> </span>/* word32 B + S + A */</div>
<div>-<span style="white-space:pre-wrap"> </span>case R_TYPE(GLOB_DAT):<span style="white-space:pre-wrap"> </span>/* word32 B + S */</div><div>+<span style="white-space:pre-wrap"> </span>case R_TYPE(ABS32):<span style="white-space:pre-wrap"> </span>/* word32 (S + A) | T */</div>
<div>+<span style="white-space:pre-wrap"> </span>case R_TYPE(GLOB_DAT):<span style="white-space:pre-wrap"> </span>/* word32 (S + A) | T */</div><div> <span style="white-space:pre-wrap"> </span>if (__predict_true(RELOC_ALIGNED_P(where))) {</div>
<div>-<span style="white-space:pre-wrap"> </span>tmp = *where + (Elf_Addr)sect->base + symvalue;</div><div>+<span style="white-space:pre-wrap"> </span>tmp = *where + symvalue; /* S + A*/</div><div> <span style="white-space:pre-wrap"> </span>/* Set the Thumb bit, if needed. */</div>
<div> <span style="white-space:pre-wrap"> </span>if (ELF_ST_TYPE(syminfo) == STT_ARM_TFUNC)</div><div>Now, x.rap can work all ok.</div><div><br></div><div>2. questions about dumplicated symbols</div>
<div>#rap ld ./x.rap</div><div>./x.rap loaded</div><div>#cp x.rap b.rap</div><div>#rap ld ./b.rap</div><div>#./b.rap loaded</div><div><div>[/] # rap ls</div><div> App DL Handle Name</div>
<div> 0x50582fb8 0x505904a0 ./x.rap</div><div> 0x50596ce0 0x505904a0 ./b.rap</div></div><div><br></div><div>Is it ok for this?b.rap and x.rap have the same symbols.</div><div>It seems b.rap and x.rap both have their local "global_symbols" and share the rtems kernel image symbols. I am not sure about this.</div>
<div><br></div><div>rtems_rtl_match_name is used to match whether this rap is loaded or not, but I think there maybe something wrong with it.</div><div><div>bool rtems_rtl_match_name (rtems_rtl_obj_t* obj, const char* name)</div>
<div>{</div><div> const char* n1 = obj->oname;</div><div> while ((*n1 != '\0') && (*n1 != '\n') && (*n1 != '/') &&</div><div> (*name != '\0') && (*name != '/') && (*n1 == *name))</div>
<div> {</div><div> ++n1;</div><div> ++name;</div><div> }</div><div> if (((*n1 == '\0') || (*n1 == '\n') || (*n1 == '/')) &&</div><div> ((*name == '\0') || (*name == '/')))</div>
<div> return true; <b>//It always return true if "rap ld ./x.rap or rap ld ./y.rap"</b></div><div> return false;</div><div>}</div><div><br></div><div>I have an idea. each loaded rap file symbol table is chained in a list, and the rap file</div>
<div>which will be loaded should first search the list to decide which symbol is needed to reloaced and which was already relocated in the list. And also the match name method should be corrected.</div><div><br>
</div><div>Thanks in advance for your comments.</div><div><br></div></div><div><br></div><div>3. </div><div>I am reading the linker code now, and have a few questions about the host side.</div><div>
About "extend the RTEMS linker to support a new option that instructs it to place object files from ELF archives into a RAP format archive file"</div><div><br></div><div>I think there maybe some same points with label '2' to avoid dumplicated symbols.But I am not sure.</div>
<div><br></div><div>a single elf relocated object file is converted to a rap format file. At last all the rap format files is archived in to an archive file. The runtime loader should be capable to handle the rap archive file. And the purpose of introducing rap archive file is to avoid dumplicated symbols. Is this right? </div>
<div><br></div><div>4. About the new tool</div><div>I was trying to figure out how the linker works.And now have a basic knowledge of it.</div><div>But I do not know the significance of the new tool. Is the new tool is used to convert one elf file to one rap format file?Hope you can give me some advice about this point.</div>
<div><br></div><div>Thanks.</div><div><br></div><div>Regards,</div><div>Peng.</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/23 Chris Johns <span dir="ltr"><<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Peng Fan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have tested x.rap on Tiny6410 board. It works now.<br>
The patch is listed in <a href="https://gist.github.com/MrVan/5440197" target="_blank">https://gist.github.com/MrVan/<u></u>5440197</a><br>
</blockquote>
<br></div>
Thanks for this. It is excellent work. I have reviewed the patch and I will take off line what I need from you to get the changes merged.<span><font color="#888888"><br>
<br>
Chris<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>