<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 - Error when using linker scripts with ADDR and section names with '-'"
   href="https://bugs.llvm.org/show_bug.cgi?id=35987">35987</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error when using linker scripts with ADDR and section names with '-'
          </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>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>royger@freebsd.org
          </td>
        </tr>

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

I have the following sample linker script, it's basically an extract of a much
bigger linker file

---
SECTIONS
{
        .note.gnu.build-id : AT(ADDR(.note.gnu.build-id)) {
                *(.note.gnu.build-id)
        } :text
}
---

Which I try to use with lld, giving the following error:

$ ld --build-id=sha1 -T test.lds
ld: error: test.lds:3: ) expected, but got -
ld: error: test.lds:3:  .note.gnu.build-id : AT(ADDR(.note.gnu.build-id)) {
ld: error: test.lds:3:                                              ^
ld: error: target emulation unknown: -m or at least one .o file required

Ignoring the error about the lack of input files or emulation, it seems like
ADDR somehow checks that the parameter of ADDR is not an expression, but fails
to realise that sections can have '-' in their names.

The output with GNU ld is:

$ ld --build-id=sha1 -T test.lds
/usr/local/bin/ld: no input files

And I can confirm using ADDR(.note.gnu.build-id) with GNU ld works fine.

Thanks, Roger.</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>