${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib
${FAIL_IF_BAD_MACHO} libbar.dylib
- ${CC} ${CCFLAGS} -mmacosx-version-min=10.4 main.c -o main libfoo.dylib libbar.dylib
+ ${CC} ${CCFLAGS} ${VERSION_OLD_LINKEDIT} main.c -o main libfoo.dylib libbar.dylib
# libfoo.dylib should be weakly loaded because all symbols are weakly imported
otool -lv main | grep -B2 libfoo.dylib | grep LC_LOAD_WEAK_DYLIB | ${FAIL_IF_EMPTY}
- # libbar.dylib should not be weakly loaded because _bar4 is not weakly imported
+ # libbar.dylib should not be weakly loaded because _bar1 is not weakly imported
otool -lv main | grep -B2 libbar.dylib | grep LC_LOAD_DYLIB | ${FAIL_IF_EMPTY}
- ${PASS_IFF_GOOD_MACHO} main
+ ${FAIL_IF_BAD_MACHO} main
+
+ ${CC} ${CCFLAGS} ${VERSION_NEW_LINKEDIT} main.c -o main2 libfoo.dylib libbar.dylib
+ # libfoo.dylib should be weakly loaded because all symbols are weakly imported
+ otool -lv main2 | grep -B2 libfoo.dylib | grep LC_LOAD_WEAK_DYLIB | ${FAIL_IF_EMPTY}
+ # libbar.dylib should not be weakly loaded because _bar1 is not weakly imported
+ otool -lv main2 | grep -B2 libbar.dylib | grep LC_LOAD_DYLIB | ${FAIL_IF_EMPTY}
+ ${PASS_IFF_GOOD_MACHO} main2
+
+ ${CC} ${CCFLAGS} ${VERSION_NEW_LINKEDIT} data.c -o data libfoo.dylib libbar.dylib
+ # libfoo.dylib should be weakly loaded because all symbols are weakly imported
+ otool -lv data | grep -B2 libfoo.dylib | grep LC_LOAD_WEAK_DYLIB | ${FAIL_IF_EMPTY}
+ # libbar.dylib should not be weakly loaded because _bar1 is not weakly imported
+ otool -lv data | grep -B2 libbar.dylib | grep LC_LOAD_DYLIB | ${FAIL_IF_EMPTY}
+ ${FAIL_IF_BAD_MACHO} data
+ ${CC} ${CCFLAGS} ${VERSION_NEW_LINKEDIT} data.c -o data2 libfoo.dylib libbar.dylib
+ # libfoo.dylib should be weakly loaded because all symbols are weakly imported
+ otool -lv data2 | grep -B2 libfoo.dylib | grep LC_LOAD_WEAK_DYLIB | ${FAIL_IF_EMPTY}
+ # libbar.dylib should not be weakly loaded because _bar1 is not weakly imported
+ otool -lv data2 | grep -B2 libbar.dylib | grep LC_LOAD_DYLIB | ${FAIL_IF_EMPTY}
+ ${PASS_IFF_GOOD_MACHO} data2
clean:
- rm -rf libfoo.dylib libbar.dylib main
+ rm -rf libfoo.dylib libbar.dylib main main2 data data2