Skip to content

Commit

Permalink
[tests] Check all architectures when verifying public symbols. (#5745)
Browse files Browse the repository at this point in the history
This also means updating the whitelisted symbols.
  • Loading branch information
rolfbjarne authored Mar 8, 2019
1 parent 6fb6824 commit c8edf3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/mtouch/MTouchTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,10 @@ public IEnumerable<string> NativeSymbolsInExecutable {
}
}

public static IEnumerable<string> GetNativeSymbolsInExecutable (string executable)
public static IEnumerable<string> GetNativeSymbolsInExecutable (string executable, string arch = null)
{
IEnumerable<string> rv = ExecutionHelper.Execute ("nm", $"-gUj {StringUtils.Quote (executable)}", hide_output: true).Split ('\n');

IEnumerable<string> 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;
Expand Down
14 changes: 13 additions & 1 deletion tests/mtouch/MiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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) => {
Expand All @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit c8edf3a

Please sign in to comment.