https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82501

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As discussed on IRC, with current libasan __asan_register_globals, we have 2
options:
1) add an object that we link early with -fsanitize=address that contains zero
sized variables with following redzone registered with __asan_register_globals
in .rodata, .data and .bss sections (similarly to how libasan_preinit.o is
added to non- -shared links, this would be something added to every link)
2) in each TU emit such zero sized variable with following redzone and register
it before the first variable in .data, .rodata and/or .bss if any vars are
emitted there

1) has the advantage that it wastes less memory in red zones (especially with
many TUs), but will work well only if not mixing TUs with -fsanitize=address
and without
2) wastes more memory and is more costly also because registering more globals,
but will work better when mixing TUs with -fsanitize=address and without

Reply via email to