1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Instrumentation/MemorySanitizer
Fangrui Song b632d8aff2 [IR][sanitizer] Set nounwind on module ctor/dtor, additionally set uwtable if -fasynchronous-unwind-tables
On ELF targets, if a function has uwtable or personality, or does not have
nounwind (`needsUnwindTableEntry`), it marks that `.eh_frame` is needed in the module.

Then, a function gets `.eh_frame` if `needsUnwindTableEntry` or `-g[123]` is specified.
(i.e. If -g[123], every function gets `.eh_frame`.
This behavior is strange but that is the status quo on GCC and Clang.)

Let's take asan as an example. Other sanitizers are similar.
`asan.module_[cd]tor` has no attribute. `needsUnwindTableEntry` returns true,
so every function gets `.eh_frame` if `-g[123]` is specified.
This is the root cause that
`-fno-exceptions -fno-asynchronous-unwind-tables -g` produces .debug_frame
while
`-fno-exceptions -fno-asynchronous-unwind-tables -g -fsanitize=address` produces .eh_frame.

This patch

* sets the nounwind attribute on sanitizer module ctor/dtor.
* let Clang emit a module flag metadata "uwtable" for -fasynchronous-unwind-tables. If "uwtable" is set, sanitizer module ctor/dtor additionally get the uwtable attribute.

The "uwtable" mechanism is generic: synthesized functions not cloned/specialized
from existing ones should consider `Function::createWithDefaultAttr` instead of
`Function::create` if they want to get some default attributes which
have more of module semantics.

Other candidates: "frame-pointer" (https://github.com/ClangBuiltLinux/linux/issues/955
https://github.com/ClangBuiltLinux/linux/issues/1238), dso_local, etc.

Differential Revision: https://reviews.llvm.org/D100251
2021-04-21 15:58:20 -07:00
..
AArch64
Mips
PowerPC
SystemZ
X86
abs-vector.ll
alloca.ll
array_types.ll
atomics.ll [msan] Set cmpxchg shadow precisely 2021-02-19 20:23:23 +00:00
attributes.ll
bmi.ll
byval-alignment.ll
check_access_address.ll
check-array.ll
check-constant-shadow.ll
check-struct.ll
clmul.ll
csr.ll
freeze.ll
instrumentation-with-call-threshold.ll
libatomic.ll
manual-shadow.ll
masked-store-load.ll
missing_origin.ll
msan_asm_conservative.ll
msan_basic.ll [IR][sanitizer] Set nounwind on module ctor/dtor, additionally set uwtable if -fasynchronous-unwind-tables 2021-04-21 15:58:20 -07:00
msan_eager.ll
msan_kernel_basic.ll
msan_llvm_is_constant.ll
msan_llvm_launder_invariant.ll
msan_llvm_strip_invariant.ll
msan_x86_bts_asm.ll
msan_x86intrinsics.ll
mul_by_constant.ll
no-check-rt-unaligned.ll
nosanitize.ll
origin-alignment.ll
origin-array.ll
pr32842.ll
reduce.ll
return_from_main.ll
store-long-origin.ll
store-origin.ll
str-nobuiltin.ll
unreachable.ll
unsized_type.ll
vector_arith.ll
vector_cmp.ll
vector_cvt.ll
vector_pack.ll
vector_shift.ll
with-call-type-size.ll