[llvm] [ASAN] Adjust asan instrumented GlobalVariable size to not include redzone (PR #66666)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 04:16:56 PDT 2023


skc7 wrote:

> Yeah, `clang/test/CodeGen/memtag-globals-asm.cpp` is for MTE Globals, not ASan - and the sizes of the GVs should be multiple-of-16 bytes: https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#compilation
> 
> What problem are you trying to solve here?

ASAN pass identifies the global variables that needs to be instrumented and replaces them with new globals with size equal to actual size + redzone size. To identify such instrumented global variables, added SanitizerMetadata to the new global, which will have NoAddress set to false(which implies asan instrumented global). At asm printer stage, such gloabal would be identified and actual value without redzone size would be emitted. 

This change was done under assumption that any target would only want the actual size of global in the elf and not the padded size. AMDGPU needs this change. Please let me know if it causes issue with other targets? 

https://github.com/llvm/llvm-project/pull/66666


More information about the llvm-commits mailing list