llvm-project/llvm/test/Instrumentation/SanitizerCoverage
Fangrui Song a400ca3f3d [SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters
Fixes the main issue in PR41693

When both modes are used, two functions are created:
`sancov.module_ctor`, `sancov.module_ctor.$LastUnique`, where
$LastUnique is the current LastUnique counter that may be different in
another module.

`sancov.module_ctor.$LastUnique` belongs to the comdat group of the same
name (due to the non-null third field of the ctor in llvm.global_ctors).

    COMDAT group section [    9] `.group' [sancov.module_ctor] contains 6 sections:
       [Index]    Name
       [   10]   .text.sancov.module_ctor
       [   11]   .rela.text.sancov.module_ctor
       [   12]   .text.sancov.module_ctor.6
       [   13]   .rela.text.sancov.module_ctor.6
       [   23]   .init_array.2
       [   24]   .rela.init_array.2

    # 2 problems:
    # 1) If sancov.module_ctor in this module is discarded, this group
    # has a relocation to a discarded section. ld.bfd and gold will
    # error. (Another issue: it is silently accepted by lld)
    # 2) The comdat group has an unstable name that may be different in
    # another translation unit. Even if the linker allows the dangling relocation
    # (with --noinhibit-exec), there will be many undesired .init_array entries
    COMDAT group section [   25] `.group' [sancov.module_ctor.6] contains 2 sections:
       [Index]    Name
       [   26]   .init_array.2
       [   27]   .rela.init_array.2

By using different module ctor names, the associated comdat group names
will also be different and thus stable across modules.

Reviewed By: morehouse, phosek

Differential Revision: https://reviews.llvm.org/D61510

llvm-svn: 360107
2019-05-07 01:39:37 +00:00
..
abort-in-entry-block.ll
backedge-pruning.ll [sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed into the backedge branch. Instrumenting these CMP instructions is almost always useless (and harmful) for fuzzing 2019-01-31 23:43:00 +00:00
chains.ll
cmp-tracing-api-x86_32.ll Fix invalid target triples in tests. (NFC) 2019-03-04 23:37:41 +00:00
cmp-tracing-api-x86_64.ll
cmp-tracing.ll
coff-comdat.ll [sancov] Put .SCOV* sections into the right comdat groups on COFF 2018-11-08 00:57:33 +00:00
coff-pc-table-inline-8bit-counters.ll [libFuzzer] Port to Windows 2018-08-30 15:54:44 +00:00
coff-used-ctor.ll [SanitizerCoverage][NFC] Use appendToUsed instead of include 2019-01-14 21:02:02 +00:00
const-cmp-tracing.ll
coverage-dbg.ll
coverage.ll
coverage2-dbg.ll
div-tracing.ll [SanitizerCoverage] Create comdat for global arrays. 2018-09-13 21:45:55 +00:00
gep-tracing.ll [SanitizerCoverage] Create comdat for global arrays. 2018-09-13 21:45:55 +00:00
inline-8bit-counters.ll [SanitizerCoverage] Create comdat for global arrays. 2018-09-13 21:45:55 +00:00
interposable-symbol-nocomdat.ll [SanitizerCoverage] Don't create comdat for interposable functions. 2019-01-15 21:21:01 +00:00
no-func.ll
pc-table.ll [SanitizerCoverage] Create comdat for global arrays. 2018-09-13 21:45:55 +00:00
postdominator_check.ll
seh.ll [EH] Rename llvm.x86.seh.recoverfp intrinsic to llvm.eh.recoverfp 2019-01-16 00:37:13 +00:00
stack-depth-variable-declared-by-user.ll [SanitizerCoverage] Clang crashes if user declares `__sancov_lowest_stack` variable 2019-02-04 22:06:30 +00:00
stack-depth.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
switch-tracing.ll
trace-pc-guard-comdat.ll [SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters 2019-05-07 01:39:37 +00:00
trace-pc-guard-inline-8bit-counters.ll [SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters 2019-05-07 01:39:37 +00:00
trace-pc-guard-nocomdat.ll [SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters 2019-05-07 01:39:37 +00:00
tracing-comdat.ll
tracing.ll [sancov] Instrument reachable blocks that end in unreachable 2019-02-28 22:54:30 +00:00
unreachable-critedge.ll [SanitizerCoverage] Avoid splitting critical edges when destination is a basic block containing unreachable 2019-03-12 18:20:25 +00:00
wineh.ll