hctim 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?

Under MTE globals (not asan, but the test you're changing in 
memtag-globals-asm.cpp), there are no redzones - the round-to-16-byte size is 
what we want to be in the ELF.

Copying the sanitizer metadata over seems fine, but reusing `NoAddress` as an 
identifier that this is a sanitizer-instrumented GV is wrong. Other GVs that 
are explicitly not asan-ified (e.g. by using the 
`__attribute__((no_sanitize("address")))` attribute) end up with the same 
attribute.

Also, to the premise, _why_ is ANDGPU unhappy about having the sizeof(GV) == 
global+redzone in the ELF?

https://github.com/llvm/llvm-project/pull/66666
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to