<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processors中的主题 &amp;quot;Text Relocation&amp;quot; issue when calling asm function from c code.</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352540#M49079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi，&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am now trying to write a assembly funciton which is called by c code. The platform is imx6 DL, and OS is based on android 4.4.2_r1 patch. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The sample code is like this.&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;P&gt;The asm code: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .global asm_func&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .align&lt;/P&gt;&lt;P&gt;asm_func:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r1, =_VAR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r0, [r1]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .data&lt;/P&gt;&lt;P&gt;_VAR: .word 10&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;P&gt;The c code:&lt;/P&gt;&lt;P&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int ret;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extern int asm_func();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret = asm_func();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Result of asm_func: %d.\n", ret);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return.&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;--------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The program can be compiled and run. But when executing, there is warning msg "WARNING: linker: ./asm_test_imx has text relocations. This is wasting memory and is a security risk. Please fix."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do you know why the "text relocation" warning?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Simmis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Sep 2014 03:37:21 GMT</pubDate>
    <dc:creator>simmisxu</dc:creator>
    <dc:date>2014-09-10T03:37:21Z</dc:date>
    <item>
      <title>"Text Relocation" issue when calling asm function from c code.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352540#M49079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi，&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am now trying to write a assembly funciton which is called by c code. The platform is imx6 DL, and OS is based on android 4.4.2_r1 patch. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The sample code is like this.&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;P&gt;The asm code: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .global asm_func&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .align&lt;/P&gt;&lt;P&gt;asm_func:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r1, =_VAR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr r0, [r1]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .data&lt;/P&gt;&lt;P&gt;_VAR: .word 10&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;P&gt;The c code:&lt;/P&gt;&lt;P&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int ret;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extern int asm_func();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret = asm_func();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Result of asm_func: %d.\n", ret);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return.&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;--------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The program can be compiled and run. But when executing, there is warning msg "WARNING: linker: ./asm_test_imx has text relocations. This is wasting memory and is a security risk. Please fix."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do you know why the "text relocation" warning?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Simmis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 03:37:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352540#M49079</guid>
      <dc:creator>simmisxu</dc:creator>
      <dc:date>2014-09-10T03:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: "Text Relocation" issue when calling asm function from c code.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352541#M49080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simmis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seems this is well known error and well described on Android forums:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/22577315/warning-linker-app-process-has-text-relocations-this-is-wasting-memory-and-is" title="http://stackoverflow.com/questions/22577315/warning-linker-app-process-has-text-relocations-this-is-wasting-memory-and-is"&gt;android - Warning: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix. …&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;igor&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 07:52:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352541#M49080</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2014-09-10T07:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: "Text Relocation" issue when calling asm function from c code.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352542#M49081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, Igor. I think your link is another Android issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, in my sample code, if I remove the directive ".data", which means _VAR is in the same text section as asm_func. Then the warning disappears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During my test, warning appears when asm lables are used like this:&lt;/P&gt;&lt;P&gt;_VAR: .word 10&lt;/P&gt;&lt;P&gt;_VAR1: word _VAR&lt;/P&gt;&lt;P&gt;No matter they are in seperate data section or in the same text section as asm_func.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Simmis.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 08:06:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352542#M49081</guid>
      <dc:creator>simmisxu</dc:creator>
      <dc:date>2014-09-10T08:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: "Text Relocation" issue when calling asm function from c code.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352543#M49082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simmis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not think that Android has different errors,&lt;/P&gt;&lt;P&gt;output is the same, probably you can check this with Linux.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 09:45:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/quot-Text-Relocation-quot-issue-when-calling-asm-function-from-c/m-p/352543#M49082</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2014-09-10T09:45:43Z</dc:date>
    </item>
  </channel>
</rss>

