# Check that -U and -undefined dynamic_lookup work
#
+ALL = all-mac
+
+# -undefined dynamic_lookup is deprecated on iOS
+ifeq ($(ARCH),arm64)
+ ALL = all-ios
+else
+ifeq ($(ARCH),armv7)
+ ALL = all-ios
+endif
+endif
+
+
run: all
-all:
+all: ${ALL}
+
+all-mac:
${CC} ${CCFLAGS} main.c -o main -undefined dynamic_lookup
nm -m main | grep _foo | grep "dynamically looked up" | ${FAIL_IF_EMPTY}
${DYLDINFO} -lazy_bind -bind main | grep _foo | grep "flat-namespace" | ${FAIL_IF_EMPTY}
- ${DYLDINFO} -lazy_bind -bind main | grep _exit | grep "flat-namespace" | ${FAIL_IF_STDIN}
${FAIL_IF_BAD_MACHO} main
${CC} ${CCFLAGS} main.c -o main -Wl,-U,_foo
nm -m main | grep _foo | grep "dynamically looked up" | ${FAIL_IF_EMPTY}
${DYLDINFO} -lazy_bind -bind main | grep _foo | grep "flat-namespace" | ${FAIL_IF_EMPTY}
- ${DYLDINFO} -lazy_bind -bind main | grep _exit | grep "flat-namespace" | ${FAIL_IF_STDIN}
${FAIL_IF_BAD_MACHO} main
${CC} ${CCFLAGS} main.c -o main -flat_namespace -Wl,-U,_foo
nm -m main | grep _foo | grep "dynamically looked up" | ${FAIL_IF_STDIN}
${DYLDINFO} -lazy_bind -bind main | grep _foo | grep "flat-namespace" | ${FAIL_IF_EMPTY}
- ${DYLDINFO} -lazy_bind -bind main | grep _exit | grep "flat-namespace" | ${FAIL_IF_EMPTY}
${FAIL_IF_BAD_MACHO} main
${CC} ${CCFLAGS} main.c -bundle -o main.bundle -nodefaultlibs -undefined dynamic_lookup
nm -m main.bundle | grep _foo | grep "dynamically looked up" | ${FAIL_IF_EMPTY}
${DYLDINFO} -lazy_bind -bind main.bundle | grep _foo | grep "flat-namespace" | ${FAIL_IF_EMPTY}
- ${DYLDINFO} -lazy_bind -bind main.bundle | grep _exit | grep "flat-namespace" | ${FAIL_IF_STDIN}
${PASS_IFF_GOOD_MACHO} main.bundle
-
+all-ios:
+ ${PASS_IFF} true
clean:
rm -f main main.bundle