1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/Instrumentation/SanitizerCoverage
Fangrui Song d9a1aa7aba [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
chains.ll
cmp-tracing-api-x86_32.ll
cmp-tracing-api-x86_64.ll
cmp-tracing.ll
coff-comdat.ll
coff-pc-table-inline-8bit-counters.ll
coff-used-ctor.ll
const-cmp-tracing.ll
coverage2-dbg.ll
coverage-dbg.ll
coverage.ll
div-tracing.ll
gep-tracing.ll
inline-8bit-counters.ll
interposable-symbol-nocomdat.ll
no-func.ll
pc-table.ll
postdominator_check.ll
seh.ll
stack-depth-variable-declared-by-user.ll
stack-depth.ll
switch-tracing.ll
trace-pc-guard-comdat.ll
trace-pc-guard-inline-8bit-counters.ll
trace-pc-guard-nocomdat.ll
tracing-comdat.ll
tracing.ll
unreachable-critedge.ll
wineh.ll