symbol_inject: add step to codesign Mach-O binaries.

The adhoc codesign of Macho-O binaries is broken after symbol
injection. MacOS refuses to run the binaries unless we sign
them again.

Bug: 241493489
Test: build and run simpleperf_ndk64 on MacOS
Change-Id: I25ef5c6413bd97e1bfa0a4ec5d04eaefb6fea54c
This commit is contained in:
Yabin Cui
2022-08-31 16:23:43 -07:00
parent 2701ecd502
commit 7f5f22b226
3 changed files with 20 additions and 4 deletions

View File

@@ -94,4 +94,13 @@ func main() {
os.Remove(*output)
os.Exit(5)
}
if file.IsMachoFile {
err = symbol_inject.CodeSignMachoFile(*output)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Remove(*output)
os.Exit(6)
}
}
}