From 2887231df7db1dd432b7fd549271cf75f48eaf12 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 11 Jul 2025 18:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E6=B7=B7=E6=B7=86=E5=B8=A6`[?= =?UTF-8?q?BurstCompile]`=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/ConstValues.cs | 6 +++++- .../SymbolObfus/Policies/SystemRenamePolicy.cs | 1 + Editor/ObfuscationMethodWhitelist.cs | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Editor/ConstValues.cs b/Editor/ConstValues.cs index efd1ada..54407e1 100644 --- a/Editor/ConstValues.cs +++ b/Editor/ConstValues.cs @@ -1,4 +1,6 @@ -namespace Obfuz.Editor +using System.Text; + +namespace Obfuz.Editor { public static class ConstValues { @@ -19,5 +21,7 @@ public const string ZluaLuaInvokeAttributeFullName = "Zlua.LuaInvokeAttribute"; public const string ZluaLuaCallbackAttributeFullName = "Zlua.LuaCallbackAttribute"; public const string ZluaLuaMarshalAsAttributeFullName = "Zlua.LuaMarshalAsAttribute"; + + public const string BurstCompileFullName = "Unity.Burst.BurstCompileAttribute"; } } diff --git a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs index ed0f7bf..68d4ea2 100644 --- a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs +++ b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs @@ -23,6 +23,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies ConstValues.ZluaLuaInvokeAttributeFullName, ConstValues.ZluaLuaCallbackAttributeFullName, ConstValues.ZluaLuaMarshalAsAttributeFullName, + ConstValues.BurstCompileFullName, }; diff --git a/Editor/ObfuscationMethodWhitelist.cs b/Editor/ObfuscationMethodWhitelist.cs index 79ef34f..35ba6df 100644 --- a/Editor/ObfuscationMethodWhitelist.cs +++ b/Editor/ObfuscationMethodWhitelist.cs @@ -63,6 +63,10 @@ namespace Obfuz { return true; } + if (method.CustomAttributes.Find(ConstValues.BurstCompileFullName) != null) + { + return true; + } // don't obfuscate cctor when it has RuntimeInitializeOnLoadMethodAttribute with load type AfterAssembliesLoaded if (method.IsStatic && method.Name == ".cctor" && typeDef.Methods.Any(m => DoesMethodContainsRuntimeInitializeOnLoadMethodAttributeAndLoadTypeGreaterEqualAfterAssembliesLoaded(m))) @@ -82,6 +86,10 @@ namespace Obfuz { return true; } + if (type.CustomAttributes.Find(ConstValues.BurstCompileFullName) != null) + { + return true; + } if (_obfuzComputeCache.HasSelfOrDeclaringOrEnclosingOrInheritObfuzIgnoreScope(type, type.DeclaringType, ObfuzScope.TypeName)) { return true;