Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to use ASAN to optimize the UNITY project CPP code

Discussion in 'Windows' started by Max-_-Well, Jul 29, 2020.

  1. Max-_-Well

    Max-_-Well

    Joined:
    Apr 2, 2020
    Posts:
    13
    I compile the CPP code which is transformed by IL2CPP.exe with Clang. When i try to use ASAN to scan the CPP code, it shows that:

    Code (CSharp):
    1. assembly-CSharp-7f11e8.o : error LNK2019:Unresolved external symbols Create_OnGUI_m5DC49A83F5C9767A5DACD323299CEEFC5A6D4DB0_MetadataUsageId,function Create_OnGUI_m5DC49A83F5C9767A5DACD323299CEEFC5A6D4DB0 referenced in This symbol
    2. assembly-CSharp-7f11e8.o : error LNK2019: Unresolved external symbols  "void __cdecl il2cpp_codegen_initialize_method(unsigned int)" (?il2cpp_codegen_initialize_method@@YAXI@Z)
    3. ....
    My cmd is :
    clang assembly-CSharp.cpp -o test.exe -g -fsanitize=address -Xlinker /LIBPATH:"C:\Program Files\LLVM\lib\clang\10.0.0\lib\windows" -Xlinker clang_rt.asan-x86_64.lib -I "C:\Program Files\Unity\Hub\Editor\2019.4.4f1\Editor\Data\il2cpp\libil2cpp" -Xlinker /subsystem:windows
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    We don't support separate compilation of code generated by IL2CPP, so I don't think this will be possible.
     
  3. spatial_io

    spatial_io

    Joined:
    Jul 3, 2017
    Posts:
    21
    Is there any way we can enable ASAN or something like it?