MaskRay added a comment.

In D137227#3909056 <https://reviews.llvm.org/D137227#3909056>, @sbc100 wrote:

>> The asan instrumentation just prepends `__odr_asan_gen_` to the symbol name 
>> to form a new symbol name. For ELF every byte except `\0` can be used in a 
>> symbol name, and this is totally fine.
>>
>> I am unfamiliar with WebAssembly. Does the aforementioned parsing tool 
>> somehow skip printing `_stdcmd<1068>::init` symbols?
>
> The parser was confused by the presence of a colon in the symbol names and 
> generating an error.  I created a patch that makes it a little more robust: 
> https://github.com/emscripten-core/emscripten/pull/18152
>
> So we have a fix for the proximate issue, but I just wanted to check if that 
> new prepended symbol name was supposed to be the demanded C++ name (which it 
> seem to be) rather than the mangled name?

I think so. The instrumentation is done at LLVM layer, not Clang layer. The 
LLVM layer code generally shouldn't know the different mangling schemes used by 
different language frontends.
For C++, we can get a mangled variable name with something like

  template <typename T>
  inline int var = 3;
  
  int *x = &var<int>;

`_Z3varIiE`

My understanding is that all such symbols are in a COMDAT and have a 
linkonce_odr/weak_odr linkage: these symbols are skipped by 
`ModuleAddressSanitizer::shouldInstrumentGlobal`, so one will not see 
`__odr_asan_gen__Z3varIiE`.
I do not know what the WebAssembly world does but if you can provide detail 
instructions for reproduce I am happy to take a look if needed.

> This is the first time we've had these characters appearing in symbol names 
> so I just wanted to flag that as relatively unprecedented (at least in terms 
> of all the codebases that emscripten has been exposed to so far).
>
>> `ModuleAddressSanitizer::shouldInstrumentGlobal` encodes the candidate 
>> global variables.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137227/new/

https://reviews.llvm.org/D137227

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to