Skip to content

Commit

Permalink
[ASAN] Enable detect_odr_violation=2
Browse files Browse the repository at this point in the history
The ASAN flag for detecting ODR violations has been set to its **++default++** value (2).
commit_hash:7475c1eb748fa0704d3db551189591c87ce5357d
  • Loading branch information
nechda committed Feb 2, 2025
1 parent b376b6f commit 4078b4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
11 changes: 11 additions & 0 deletions build/scripts/fix_py2_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ def gen_renames_1(d):

def gen_renames_2(p, d):
for s in gen_renames_1(d):
"""
Since clang-17, the option -fsanitize-address-globals-dead-stripping
has been enabled by default. Due to this, we have broken optimization
that merges calls to the `asan.module_ctor` function, as we are renaming
symbols with a prefix of 'py2_'. When this flag is enabled, and
the functions are not merged, false-positive ODR (One Definition Rule)
violations occur on objects such as `typeinfo std::exception`, because
the runtime is trying to handle global objects that have already been handled.
"""
if 'asan_globals' in s:
continue
yield s + ' ' + p + s


Expand Down
2 changes: 1 addition & 1 deletion contrib/libs/clang18-rt/lib/asan/asan_flags.inc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ ASAN_FLAG(bool, detect_container_overflow, true,
"If true, honor the container overflow annotations. See "
"https://github.com/google/sanitizers/wiki/"
"AddressSanitizerContainerOverflow")
ASAN_FLAG(int, detect_odr_violation, 1,
ASAN_FLAG(int, detect_odr_violation, 2,
"If >=2, detect violation of One-Definition-Rule (ODR); "
"If ==1, detect ODR-violation only if the two variables "
"have different sizes")
Expand Down
11 changes: 0 additions & 11 deletions contrib/libs/clang18-rt/patches/disable-odr-violation.patch

This file was deleted.

0 comments on commit 4078b4f

Please sign in to comment.