Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Check all architectures when verifying public symbols. #5745

Merged
merged 1 commit into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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