<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 - LLD produces error when using explicit memory regions"
   href="https://bugs.llvm.org/show_bug.cgi?id=36799">36799</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD produces error when using explicit memory regions
          </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>Windows NT
          </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>konstantin.schwarz@hightec-rt.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following test case cannot be linked with lld:

// test.s
.text
.globl _start
_start:

.section .bar,"a"
  .quad 0
.section .foo,"a"
  .quad 1


// linker.script

MEMORY
{
  ram (rwx): org = 0x0, len = 96K
}

ENTRY(_start)

SECTIONS
{
  .bar :
  {
    *(.bar)
    . += 0x4;
  } > ram 

  .foo : ALIGN(8) 
  {
    *(.foo)
  } > ram
}

$ llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o test.o
$ ld.lld -T linker.script --Map=test.map test.o
produces the following error:
ld.lld: error: section .foo file range overlaps with .comment
<span class="quote">>>> .foo range is [0x1010, 0x1017]
>>> .comment range is [0x1014, 0x1089]</span >

Linking with ld.bfd gives the following map file:

Memory Configuration

Name             Origin             Length             Attributes
ram              0x0000000000000000 0x0000000000018000 xrw
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map


.text           0x0000000000000000        0x0
 .text          0x0000000000000000        0x0 test.o

.bar            0x0000000000000000        0xc
 *(.bar)
 .bar           0x0000000000000000        0x8 test.o
                0x000000000000000c                . = (. + 0x4)
 *fill*         0x0000000000000008        0x4 

.foo            0x0000000000000010        0x8
 *(.foo)
 .foo           0x0000000000000010        0x8 test.o</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>