title: How to put c-style strings (function arguments) in the specific section?
body: <p>I want to put some functions in a specific section named ".xip.text",
  but the read only data cannot put in that section.</p>
  
  <p>The following is my test code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void foo(void) __attribute__((section (".xip.text")));
  
  void foo(void)
  {
      printf("hello world\n");
  }
  </code></pre>
  
  <p>In the linker script file:</p>
  
  <pre><code>MEMORY
  {
    RAM (rwx)  : ORIGIN = 0x00010000, LENGTH = 448K
    FLASH (rx) : ORIGIN = 0x10000000, LENGTH = 1024K
  }
  
  SECTIONS
  {
      .xip :
      {
          *(.xip.text .xip.text.*)
          *(.xip.rodata .xip.rodata.*)
      } &gt; FLASH
  
      .text :
      {
          *(.text*)
      } &gt; RAM
  }
  </code></pre>
  
  <p>After linking, the function text is placed in ".xip" section, but the string 
  "hello world\n" is not put in the same section. How to solve it?</p>
  
  <p>I can put the whole file in the ".xip" section to solve this problem. But I
  have many files, and I only want to put some functions to ".xip" section, not
  the whole file.</p>
  
  <p>In the map file, text of foo() is placed in the right section,
  but string "hello world\n" (.rodata.str1.1) is placed in another seciton.</p>
  
  <pre><code> *(.xip.text .xip.text.*)
   .xip.text      0x1002f7b0        0xc ../foo.o
                  0x1002f7b0                foo
   *fill*         0x1002f7bc        0x4 
  
  
   .rodata.str1.1
                  0x00025515        0xc ../foo.o
   *fill*         0x00025521        0x3 
  </code></pre>
  
  <p>After disassemble, </p>
  
  <pre><code>1002f7b0 &lt;foo&gt;:
  
  void foo(void) __attribute__((section (".xip.text")));
  
  void foo(void)
  {
      printf("hello world\n");
  1002f7b0:   4801        ldr r0, [pc, #4]    ; (1002f7b8 &lt;foo+0x8&gt;)
  1002f7b2:   f000 b95d   b.w 1002fa70 &lt;__puts_veneer&gt;
  1002f7b6:   bf00        nop
  1002f7b8:   00025515    .word   0x00025515
  1002f7bc:   00000000    .word   0x00000000
  </code></pre>
  
  <p>gcc version: gcc-arm-none-eabi-7-2017-q4-major, gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)</p>