X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/9d2e0767a8f401be0067937f63a08b1c4f79297d..a645023da60d22e86be13f7b4d97adeff8bc6665:/unit-tests/test-cases/objc-gc-checks/Makefile diff --git a/unit-tests/test-cases/objc-gc-checks/Makefile b/unit-tests/test-cases/objc-gc-checks/Makefile old mode 100755 new mode 100644 index 0abe7d5..b18012a --- a/unit-tests/test-cases/objc-gc-checks/Makefile +++ b/unit-tests/test-cases/objc-gc-checks/Makefile @@ -26,6 +26,16 @@ include ${TESTROOT}/include/common.makefile SHELL = bash # use bash shell so we can redirect just stderr +IMAGE_INFO = "__image_info" + +ifeq ($(ARCH),x86_64) + IMAGE_INFO = "__objc_imageinfo" +endif +ifeq ($(ARCH),armv6) + IMAGE_INFO = "__objc_imageinfo" +endif + + # # Validate that the linker catches illegal combinations of .o files @@ -70,6 +80,11 @@ test: ${FAIL_IF_BAD_MACHO} libfoobar.dylib otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x[26] | ${FAIL_IF_STDIN} + # check GC/RR + RR -> RR + ${CC} ${CCFLAGS} bar-gc.o foo.o runtime.c -dynamiclib -o libfoobar.dylib + ${FAIL_IF_BAD_MACHO} libfoobar.dylib + otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x[26] | ${FAIL_IF_STDIN} + # check GC + GC/RR -> GC ${CC} ${CCFLAGS} foo-gc-only.o bar-gc.o runtime.c -dynamiclib -o libfoobar.dylib ${FAIL_IF_BAD_MACHO} libfoobar.dylib @@ -78,7 +93,42 @@ test: # check RR + GC -> error ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} foo.o bar-gc-only.o runtime.c -dynamiclib -o libfoobar.dylib 2> fail.log + # check cmd line GC/RR, GC/RR + RR -> error + ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} foo-gc.o foo.o runtime.c -dynamiclib -o libfoobar.dylib -Wl,-objc_gc 2> fail.log + + # check GC/RR + compaction + ${CC} ${CCFLAGS} foo-gc.o bar-gc.o runtime.c -dynamiclib -Wl,-objc_gc_compaction -o libfoobar.dylib + otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x12 | ${FAIL_IF_EMPTY} + + # check GC + compaction + ${CC} ${CCFLAGS} foo-gc-only.o bar-gc-only.o runtime.c -dynamiclib -Wl,-objc_gc_compaction -o libfoobar.dylib + otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x16 | ${FAIL_IF_EMPTY} + + # none + GC/RR-dylib -> none + ${CC} ${CCFLAGS} foo-gc.o runtime.c -dynamiclib -o libfoo.dylib + ${CC} ${CCFLAGS} none.c libfoo.dylib -dynamiclib -o libnone.dylib + size -l libnone.dylib | grep ${IMAGE_INFO} | ${FAIL_IF_STDIN} + + # none + GC-dylib -> none + ${CC} ${CCFLAGS} foo-gc-only.o runtime.c -dynamiclib -o libfoo.dylib + ${CC} ${CCFLAGS} none.c libfoo.dylib -dynamiclib -o libnone.dylib + size -l libnone.dylib | grep ${IMAGE_INFO} | ${FAIL_IF_STDIN} + + # none + RR-dylib -> none + ${CC} ${CCFLAGS} foo.o runtime.c -dynamiclib -o libfoo.dylib + ${CC} ${CCFLAGS} none.c libfoo.dylib -dynamiclib -o libnone.dylib + size -l libnone.dylib | grep ${IMAGE_INFO} | ${FAIL_IF_STDIN} + + # check RR + GC-dylib -> error + ${CC} ${CCFLAGS} foo-gc-only.o runtime.c -dynamiclib -o libfoo.dylib + ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} bar.o runtime.c -dynamiclib libfoo.dylib -o libbar.dylib 2> fail.log + + # check GC + RR-dylib -> error + ${CC} ${CCFLAGS} foo.o runtime.c -dynamiclib -o libfoo.dylib + ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} bar-gc-only.o runtime.c -dynamiclib libfoo.dylib -o libbar.dylib 2> fail.log + + ${PASS_IFF} true clean: - rm -rf foo*.o bar*.o libfoobar.dylib fail.log + rm -rf foo*.o bar*.o libfoobar.dylib fail.log libfoo.dylib libnone.dylib