Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created January 4, 2021 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torarnv/aa478d3198d2324e924df7e9af203945 to your computer and use it in GitHub Desktop.
Save torarnv/aa478d3198d2324e924df7e9af203945 to your computer and use it in GitHub Desktop.
diff --git i/mkspecs/features/data/mac/objc_namespace.sh w/mkspecs/features/data/mac/objc_namespace.sh
index ceff2df324c..2d6585c8b7d 100755
--- i/mkspecs/features/data/mac/objc_namespace.sh
+++ w/mkspecs/features/data/mac/objc_namespace.sh
@@ -129,6 +129,11 @@ inspect_binary() {
classnames_section="__objc_classname"
classnames=$(otool -v -s __TEXT $classnames_section "$target" | tail -n +3)
+ if [ -z "$classnames" ]; then
+ echo "no Objective-C classes in binary."
+ exit 0
+ fi
+ echo
while read -a classname; do
address=$(sanitize_address ${classname[0]})
name=${classname[1]}
@@ -146,7 +151,12 @@ inspect_binary() {
echo "found namespaced class names, updating class entries..."
fi
- classes=$(otool -o -v "$target" | grep class_ro_t)
+ classes=$(otool -o -v "$target" | grep -E "(class_ro_t|__OBJC_CLASS_RO)")
+ if [ -z "$classes" ]; then
+ echo " 💥 failed to read class details"
+ exit 1
+ fi
+
while read -a class; do
address="$(sanitize_address ${class[1]})"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment