<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 - Linker script OVERLAYs not supported"
   href="https://bugs.llvm.org/show_bug.cgi?id=36768">36768</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linker script OVERLAYs not supported
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>dmitry.mikulin@sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I used the following manual, section 4.6.9, and GNU linker v. 2.29.1 on Ubuntu
as a reference.
<a href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html">https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html</a>

According to the manual, "the OVERLAY command is just syntactic sugar, since
everything it does can be done using the more basic commands". 

There is no support for the OVERLAY syntax in ELF lld.
Also, laying out 2 segments with overlapping virtual addresses using basic
commands results in the following error with lld:
ld.lld: error: section .text.zzz virtual address range overlaps with .text.xxx
<span class="quote">>>> .text.zzz range is [0x1000, 0x100C]
>>> .text.xxx range is [0x1000, 0x100C]</span >

This is the script used:
PHDRS {
  zzz_text        PT_LOAD;
  xxx_text        PT_LOAD;
}
SECTIONS {
  .text.zzz 0x1000 : AT (0x4000) { zzz.o (.text*) } : zzz_text
  .text.xxx 0x1000 : AT (0x4000 + SIZEOF (.text.zzz)) { xxx.o (.text*) } :
xxx_text
}</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>