<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 --- - Rematerial address for literal string pool"
   href="https://llvm.org/bugs/show_bug.cgi?id=31228">31228</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Rematerial address for literal string pool
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>weimingz@codeaurora.org
          </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>given test.c:

extern void mylog(const char*);
#define LOG(msg) {  static const char __attribute__((section("logstrings")))
mystring[] = #msg; mylog(mystring); }


void test() {
  LOG("this is log msg 0");
  LOG("this is log msg 11");
  LOG("this is log msg 222");
  LOG("this is log msg 3333");
}

The code puts all string literals in the same section. GCC is able to
rematerial the address:
arm-linux-gnueabi-gcc -mcpu=cortex-m3 -Os

    push    {r4, lr}
    ldr    r4, .L2
    mov    r0, r4
    bl    mylog
    add    r0, r4, #20
    bl    mylog
    add    r0, r4, #40
    bl    mylog
    add    r0, r4, #60
    pop    {r4, lr}
    b    mylog


but LLVM generates larger code:

clang -mcpu=cortex-m3 -target armv7m-linux-gnueabi -c -Os 

    push    {r7, lr}
    .setfp    r7, sp
    mov    r7, sp
    movw    r0, :lower16:test.mystring
    movt    r0, :upper16:test.mystring
    bl    mylog
    movw    r0, :lower16:test.mystring.1
    movt    r0, :upper16:test.mystring.1
    bl    mylog
    movw    r0, :lower16:test.mystring.2
    movt    r0, :upper16:test.mystring.2
    bl    mylog
    movw    r0, :lower16:test.mystring.3
    movt    r0, :upper16:test.mystring.3
    pop.w    {r7, lr}
    b    mylog</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>