Revision: 976 http://trac.macosforge.org/projects/darwinbuild/changeset/976 Author: kvv@apple.com Date: 2011-11-10 15:45:26 -0800 (Thu, 10 Nov 2011) Log Message: ----------- - darwintrace: build failure on 10.6, undefined symbol __posix_spawn - darwintrace: crash in darwintrace_make_environ Modified Paths: -------------- trunk/CHANGES trunk/darwintrace/darwintrace.c Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/PR-10363375:959-960 /branches/PR-10397485:967 /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 + /branches/PR-10363375:959-960 /branches/PR-10397485:967 /branches/PR-10412052:973-975 /branches/PR-10412066:974-975 /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2011-11-10 21:15:16 UTC (rev 975) +++ trunk/CHANGES 2011-11-10 23:45:26 UTC (rev 976) @@ -1,5 +1,9 @@ Darwin Build Scripts Change History ----------------------------------- +Release 26.2 [9-Nov-2011] + - darwintrace: build failure on 10.6, undefined symbol __posix_spawn + - darwintrace: crash in darwintrace_make_environ + Release 26.1 [7-Nov-2011] - darwintrace: compiler warning build fix Modified: trunk/darwintrace/darwintrace.c =================================================================== --- trunk/darwintrace/darwintrace.c 2011-11-10 21:15:16 UTC (rev 975) +++ trunk/darwintrace/darwintrace.c 2011-11-10 23:45:26 UTC (rev 976) @@ -405,20 +405,22 @@ result[i] = strdup(DARWINTRACE_PLACEHOLDER); } ++i; - + if (darwintrace_dylib_path) { - int add_dylib = (strstr(libs, darwintrace_dylib_path) == NULL); - asprintf(&result[i], - "%s%s%s%s", - DYLD_INSERT_LIBRARIES, - add_dylib ? darwintrace_dylib_path : "", - (add_dylib && libs) ? ":" : "", - libs ? libs : ""); + if (libs && strstr(libs, darwintrace_dylib_path)) { + /* inserted libraries already contain dylib */ + result[i] = strdup(DARWINTRACE_PLACEHOLDER); + } else { + /* otherwise set or insert the dylib path */ + asprintf(&result[i], "%s%s%s%s", + DYLD_INSERT_LIBRARIES, darwintrace_dylib_path, + libs ? ":" : "", libs ? libs : ""); + } } else { result[i] = strdup(DARWINTRACE_PLACEHOLDER); } ++i; - + memcpy(&result[i], envp, count * sizeof(char *)); while (result[i] != NULL) { @@ -573,7 +575,11 @@ } DARWINTRACE_INTERPOSE(darwintrace_execve, execve) -extern int __posix_spawn(pid_t * __restrict, const char * __restrict, +#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 +/* weak import __posix_spawn which only exists on 10.7 or later */ +extern __attribute__((weak_import)) +int __posix_spawn(pid_t * __restrict, const char * __restrict, void *, char *const argv[ __restrict], char *const envp[ __restrict]); @@ -592,6 +598,7 @@ return result; } DARWINTRACE_INTERPOSE(darwintrace_posix_spawn, __posix_spawn) +#endif /* if darwintrace has been initialized, trap
participants (1)
-
source_changes@macosforge.org