<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 - clang-9 -fsanitize-coverage=trace-pc leaves temporary symbols"
   href="https://bugs.llvm.org/show_bug.cgi?id=43123">43123</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-9 -fsanitize-coverage=trace-pc leaves temporary symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>arnd@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The combination of the -fsanitize-coverage=trace-pc and asm-goto sometimes
leaves undefined references:

<a href="https://godbolt.org/z/f-c4C3">https://godbolt.org/z/f-c4C3</a>

$ cat test.c
enum { false, true } arch_static_branch() {
  _Bool branch = 0;
  int *key = 0;
  asm goto("1:\n\tnop\n\t.pushsection __jump_table,  \"aw\"\n\t.word b, "
           "%l[l_yes], %c0\n\t.popsection\n\t"
           :
           : "i"(&key[branch])
           :
           : l_yes);
  return false;
l_yes:
  return true;
}
void __raw_writel(volatile int *addr) {
  int val = 0;
  asm("str %1, %0" : : "Qo"(*addr), "r"(val));
}
void *imx_pmx_set_one_pin_mmio_ipctl_2;
void *imx_pmx_set_one_pin_mmio_ipctl_1;
void imx_pmx_set_one_pin_mmio() {
  if (imx_pmx_set_one_pin_mmio_ipctl_2) {
      __asm__("mcr p15, 0, %0, c7, c10, 4" : : "r"(0) : "memory");
      __raw_writel(imx_pmx_set_one_pin_mmio_ipctl_2);
    }
  else {
    __asm__("mcr p15, 0, %0, c7, c10, 4" : : "r"(0) : "memory");
    __raw_writel(imx_pmx_set_one_pin_mmio_ipctl_1);
  }
  { arch_static_branch(); }
}

$ clang-9 --target=arm-linux-gnueabi -fsanitize-coverage=trace-pc -O2
-march=armv6k -Wall -c test.c

error: Undefined temporary symbol

$ clang-9 --version
clang version 9.0.0-svn369744-1~exp1~20190823103928.28 (branches/release_90)

The symbol comes from this part of the assembler output:

  bl __sanitizer_cov_trace_pc
  @APP
  @NO_APP
  @APP
  nop
  @NO_APP
  b .LBB2_1
  pop {r4, r5, r6, r10, r11, pc}

.LBB2_1 is referenced here but never defined.</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>