[llvm-bugs] [Bug 43123] New: clang-9 -fsanitize-coverage=trace-pc leaves temporary symbols

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 27 08:16:17 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43123

            Bug ID: 43123
           Summary: clang-9 -fsanitize-coverage=trace-pc leaves temporary
                    symbols
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arnd at linaro.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

The combination of the -fsanitize-coverage=trace-pc and asm-goto sometimes
leaves undefined references:

https://godbolt.org/z/f-c4C3

$ 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190827/4ea364af/attachment.html>


More information about the llvm-bugs mailing list