diff --git a/tests/mtouch/MTouchTool.cs b/tests/mtouch/MTouchTool.cs index f946a6af9004..a0120cd8acd8 100644 --- a/tests/mtouch/MTouchTool.cs +++ b/tests/mtouch/MTouchTool.cs @@ -803,10 +803,10 @@ public IEnumerable NativeSymbolsInExecutable { } } - public static IEnumerable GetNativeSymbolsInExecutable (string executable) + public static IEnumerable GetNativeSymbolsInExecutable (string executable, string arch = null) { - IEnumerable rv = ExecutionHelper.Execute ("nm", $"-gUj {StringUtils.Quote (executable)}", hide_output: true).Split ('\n'); - + IEnumerable rv = ExecutionHelper.Execute ("nm", $"{(arch == null ? string.Empty : $"-arch {arch} ")}-gUj {StringUtils.Quote (executable)}", hide_output: true).Split ('\n'); + rv = rv.Where ((v) => { if (string.IsNullOrEmpty (v)) return false; diff --git a/tests/mtouch/MiscTests.cs b/tests/mtouch/MiscTests.cs index 4514ac0f9532..cdd4f450082e 100644 --- a/tests/mtouch/MiscTests.cs +++ b/tests/mtouch/MiscTests.cs @@ -98,6 +98,8 @@ public void PublicSymbols (Profile profile) "_OBJC_CLASS_$_Xamarin", "_OBJC_IVAR_$_Xamarin", "__ZN13XamarinObject", + ".objc_class_name_Xamarin", // 32-bit macOS naming scheme + ".objc_category_name_NSObject_NonXamarinObject", // 32-bit macOS naming scheme "_main", // I think these are inline functions from a header "__Z7isasciii", @@ -140,7 +142,7 @@ public void PublicSymbols (Profile profile) foreach (var path in paths) { - var symbols = MTouchTool.GetNativeSymbolsInExecutable (path); + var symbols = MTouchTool.GetNativeSymbolsInExecutable (path, arch: "all"); // Remove known public symbols symbols = symbols.Where ((v) => { @@ -157,6 +159,10 @@ public void PublicSymbols (Profile profile) case "_ReadZStream": case "_WriteZStream": return false; + // Helper objc_msgSend functions for arm64 + case "_objc_msgSend_stret": + case "_objc_msgSendSuper_stret": + return false; } // Be a bit more lenient with symbols from the static registrar @@ -167,6 +173,12 @@ public void PublicSymbols (Profile profile) return false; if (v.StartsWith ("_OBJC_METACLASS_$", StringComparison.Ordinal)) return false; + + // 32-bit macOS naming scheme: + if (v.StartsWith (".objc_class_name_", StringComparison.Ordinal)) + return false; + if (v.StartsWith (".objc_category_name_", StringComparison.Ordinal)) + return false; } return true;