<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 --- - Wrong diagnostic for undefined ELF temporary label"
   href="https://llvm.org/bugs/show_bug.cgi?id=30988">30988</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong diagnostic for undefined ELF temporary label
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.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>[davide@cupiditate bin]$ cat patatino.s
.text
        jmp .Lblah

[davide@cupiditate bin]$ ./llvm-mc patatino.s -filetype=obj -o patatino
<unknown>:0: error: Undefined temporary symbol

The reason why this happens is that we don't have a SM location, as this error
isn't diagnosed until we reach the ELFObjectWriter.
```
    if (Symbol.isTemporary() && Symbol.isUndefined()) {
      Ctx.reportError(SMLoc(), "Undefined temporary symbol");
      continue;
```

Couple of notes:
-> This used to be a fatal error, then it was converted to `reportError`.
->  GNU as doesn't seem to care about undefined labels, and assemble that
snippet just fine. The resulting assembly is:

$ objdump -t ./foo |grep blah
0000000000000000         *UND*  0000000000000000 .Lblah

$ objdump -d ./foo
0000000000000000 <.text>:
   0:   e9 00 00 00 00          jmpq   0x5

Rafael pointed out this is an area that could use some love, and pointed out
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Convert inline asm to MCInsts (nuke the pre-MC AsmPrinter)"
   href="show_bug.cgi?id=23933">https://llvm.org/bugs/show_bug.cgi?id=23933</a></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>