[llvm-bugs] [Bug 38370] New: -fsanitize-coverage=trace-pc-guard errors when a c file defines more than one function w/ extern linkage

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 30 08:32:28 PDT 2018


            Bug ID: 38370
           Summary: -fsanitize-coverage=trace-pc-guard errors when a c
                    file defines more than one function w/ extern linkage
           Product: new-bugs
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: scott.determan at gmail.com
                CC: llvm-bugs at lists.llvm.org

If a c file defines more than one function with external linkage, and
`-fsanitize-coverage=trace-pc-guard` is set then the compiled program will
either crash (if the lld linker is used) or fail to compile (if it is not

The link error is:
Link error is:

[1/2] Linking CXX executable two_c_funs FAILED: two_c_funs : &&
/home/swd/apps/clang-6.0/bin/clang++ -fsanitize=fuzzer
-fsanitize-coverage=trace-pc-guard -rdynamic
CMakeFiles/two_c_funs.dir/test.cpp.o CMakeFiles/two_c_funs.dir/two_c_funs.c.o
-o two_c_funs && : .text.sancov.module_ctor.6' referenced in
section.init_array.2[sancov.module_ctor.6]' of
CMakeFiles/two_c_funs.dir/two_c_funs.c.o: defined in discarded section
`.text.sancov.module_ctor.6[sancov.module_ctor]' of
CMakeFiles/two_c_funs.dir/two_c_funs.c.o clang-6.0: error: linker command
failed with exit code 1 (use -v to see invocation) [2/2] Linking CXX executable
one_c_fun ninja: build stopped: subcommand failed.

I created a minimal test in this repository:

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/20180730/d9cb9120/attachment.html>

More information about the llvm-bugs mailing list