<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - LMA/VMA issue on ARMv7 bare metal"
   href="https://bugs.llvm.org/show_bug.cgi?id=38776">38776</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LMA/VMA issue on ARMv7 bare metal
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eblot.ml@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

This might be a follow up of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - lld does not seem to honour the linker script load address"
   href="show_bug.cgi?id=34407">https://bugs.llvm.org/show_bug.cgi?id=34407</a>.

Using the same environment, using clang/LLVM 7.0.0-rc2, it seems LLD has
another trouble with LMA.

Using a similar LD script:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
  RAM (rwx) :  ORIGIN = 0x200014b8, LENGTH = 0xeb48
}

ENTRY(Reset_Handler)

SECTIONS
{

    .text :
    {
    }  > FLASH

    /* ... other sections that go to FLASH region */

    __etext = .;

    .data : AT (__etext)
    {
        __data_start__ = .;
        *(.data*)
    } > RAM

    /* ... other sections that go to RAM region */
}

the ld.lld ELF output produces something unexpected:

$ arm-none-eabi-nm powernode/powernode.elf | egrep -e '__etext|__data_start'
200014b8 D __data_start__
00069f8c R __etext

$ arm-none-eabi-objdump -h powernode/powernode.elf | egrep -e '\.data|Idx'
Idx Name          Size      VMA       LMA       File off  Algn
 21 .data         0000082c  200014b8  200014b8  00112550  2**3

I would have expected .data LMA to be 00069f8c, *not* 200014b8



A weird thing is that with another version of the same project, using the same
compilation suite (7.0.0-rc2) and the same linker script, the output is as
expected:

$ arm-none-eabi-nm powernode/powernode.elf | egrep -e '__etext|__data_start'
20002400 D __data_start__
00060c08 R __etext

$ arm-none-eabi-objdump -h powernode/powernode.elf | egrep -e '\.data|Idx'
Idx Name          Size      VMA       LMA       File off  Algn
  8 .data         00000820  20002400  00060c08  0003f400  2**3


I can provide a repro tar file, but I'd like it not to be publicly available if
possible. Any way to do this?</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>