aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-11-02 19:21:33 -0700
committerFangrui Song <i@maskray.me>2022-11-02 19:21:33 -0700
commit1ada819c237bf724e6eaa1c82b2742e3eb57a5d5 (patch)
treeb54b5ae0bd95c03f9b6ab6559cee84c534e37b78 /llvm/lib/Support/CommandLine.cpp
parent01ccb23bd685268db179fd4d11922a39e28d5f30 (diff)
downloadllvm-1ada819c237bf724e6eaa1c82b2742e3eb57a5d5.zip
llvm-1ada819c237bf724e6eaa1c82b2742e3eb57a5d5.tar.gz
llvm-1ada819c237bf724e6eaa1c82b2742e3eb57a5d5.tar.bz2
[asan] Default to -fsanitize-address-use-odr-indicator for non-Windows
This enables odr indicators on all platforms and private aliases on non-Windows. Note that GCC also uses private aliases: this fixes bogus `The following global variable is not properly aligned.` errors for interposed global variables Fix https://github.com/google/sanitizers/issues/398 Fix https://github.com/google/sanitizers/issues/1017 Fix https://github.com/llvm/llvm-project/issues/36893 (we can restore D46665) Global variables of non-hasExactDefinition() linkages (i.e. linkonce/linkonce_odr/weak/weak_odr/common/external_weak) are not instrumented. If an instrumented variable gets interposed to an uninstrumented variable due to symbol interposition (e.g. in issue 36893, _ZTS1A in foo.so is resolved to _ZTS1A in the executable), there may be a bogus error. With private aliases, the register code will not resolve to a definition in another module, and thus prevent the issue. Cons: minor size increase. This is mainly due to extra `__odr_asan_gen_*` symbols. (ELF) In addition, in relocatable files private aliases replace some relocations referencing global symbols with .L symbols and may introduce some STT_SECTION symbols. For lld, with -g0, the size increase is 0.07~0.09% for many configurations I have tested: -O0, -O1, -O2, -O3, -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections. With -g1 or above, the size increase ratio will be even smaller. This patch obsoletes D92078. Don't migrate Windows for now: the static data member of a specialization `std::num_put<char>::id` is a weak symbol, as well as its ODR indicator. Unfortunately, link.exe (and lld without -lldmingw) generally doesn't support duplicate weak definitions (weak symbols in different TUs likely pick different defined external symbols and conflict). Differential Revision: https://reviews.llvm.org/D137227
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions