From: Apple Date: Wed, 22 Jun 2016 20:52:23 +0000 (+0000) Subject: Libinfo-503.tar.gz X-Git-Tag: macos-1012^0 X-Git-Url: https://git.saurik.com/apple/libinfo.git/commitdiff_plain/db6e2fe0f76597d7257abd0c8efa2739b8cf3b94 Libinfo-503.tar.gz --- diff --git a/gen.subproj/getifaddrs.c b/gen.subproj/getifaddrs.c index 4de879e..be5d0ac 100644 --- a/gen.subproj/getifaddrs.c +++ b/gen.subproj/getifaddrs.c @@ -402,24 +402,25 @@ getifaddrs(struct ifaddrs **pif) if (--ift >= ifa) { ift->ifa_next = NULL; *pif = ifa; - } else { - *pif = NULL; - free(ifa); - } - - for (ift = ifa; ift != NULL; ift = ift->ifa_next) - { - if (ift->ifa_addr->sa_family == AF_INET6) + + for (ift = ifa; ift != NULL; ift = ift->ifa_next) { - sin6 = (struct sockaddr_in6 *)ift->ifa_addr; - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) + if (ift->ifa_addr->sa_family == AF_INET6) { - esid = ntohs(sin6->sin6_addr.__u6_addr.__u6_addr16[1]); - sin6->sin6_addr.__u6_addr.__u6_addr16[1] = 0; - if (sin6->sin6_scope_id == 0) sin6->sin6_scope_id = esid; + sin6 = (struct sockaddr_in6 *)ift->ifa_addr; + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) + { + esid = ntohs(sin6->sin6_addr.__u6_addr.__u6_addr16[1]); + sin6->sin6_addr.__u6_addr.__u6_addr16[1] = 0; + if (sin6->sin6_scope_id == 0) sin6->sin6_scope_id = esid; + } } } } + else { + *pif = NULL; + free(ifa); + } return (0); } diff --git a/gen.subproj/if_nameindex.c b/gen.subproj/if_nameindex.c index eb91584..a9cf005 100644 --- a/gen.subproj/if_nameindex.c +++ b/gen.subproj/if_nameindex.c @@ -78,7 +78,7 @@ if_nameindex(void) { struct ifaddrs *ifaddrs, *ifa; unsigned int ni; - int nbytes; + size_t nbytes; struct if_nameindex *ifni, *ifni2; char *cp; diff --git a/lookup.subproj/ds_module.c b/lookup.subproj/ds_module.c index 35a7f70..e433ac4 100644 --- a/lookup.subproj/ds_module.c +++ b/lookup.subproj/ds_module.c @@ -322,7 +322,7 @@ static si_list_t * _ds_list(si_mod_t *si, int cat, const char *procname, const void *extra, od_extract_t extract) { __block si_list_t *list; - uint64_t va, vb; + uint64_t va = 0, vb = 0; xpc_object_t reply, result; if (procname == NULL) return NULL; @@ -353,7 +353,7 @@ static si_item_t * _ds_item(si_mod_t *si, int cat, const char *procname, const void *extra, od_extract_t extract, xpc_object_t payload) { xpc_object_t result; - uint64_t va, vb; + uint64_t va = 0, vb = 0; si_item_t *item = NULL; if (procname == NULL) return NULL; diff --git a/lookup.subproj/getaddrinfo.3 b/lookup.subproj/getaddrinfo.3 index f8b341f..333fb40 100644 --- a/lookup.subproj/getaddrinfo.3 +++ b/lookup.subproj/getaddrinfo.3 @@ -393,6 +393,38 @@ and .Fa ai_flags set to .Dv AI_DEFAULT. +.Pp +Note that NAT64 address synthesis is always disabled for IPv4 addresses +in the following ranges: +0.0.0.0/8, +127.0.0.0/8, +169.254.0.0/16, +192.0.0.0/29, +192.88.99.0/24, +224.0.0.0/4, and +255.255.255.255/32. +Additionally, NAT64 address synthesis is disabled when the network uses +the well-known prefix (64:ff9b::/96) +for IPv4 addresses in the following ranges: +10.0.0.0/8, +100.64.0.0/10, +172.16.0.0/12, and +192.168.0.0/16. +.Pp +Historically, passing a host's own hostname to +.Fn getaddrinfo +has been a popular +technique for determining that host's IP address(es), but this is fragile, +and doesn't work reliably in all cases. The appropriate way for software to +discover the IP address(es) of the host it is running on is to use +.Xr getifaddrs 3 . +.Pp +The +.Fn getaddrinfo +implementations on all versions of OS X and iOS are now, and always have been, +thread-safe. Previous versions of this man page incorrectly reported that +.Fn getaddrinfo +was not thread-safe. .Sh RETURN VALUES .Fn getaddrinfo returns zero on success or one of the error codes listed in diff --git a/lookup.subproj/ils.c b/lookup.subproj/ils.c index 1900867..7a37fef 100644 --- a/lookup.subproj/ils.c +++ b/lookup.subproj/ils.c @@ -41,7 +41,7 @@ /* GLOBAL */ -#if __ARM_ARCH_7K__ && __BIGGEST_ALIGNMENT__ > 4 +#if __ARM_ARCH_7K__ || __ARM64_ARCH_8_32__ static const uint32_t align_32[] = { 0, 1, 2, 0, 4, 0, 0, 0, 8 }; #else static const uint32_t align_32[] = { 0, 1, 2, 0, 4, 0, 0, 0, 4 }; diff --git a/lookup.subproj/libinfo.c b/lookup.subproj/libinfo.c index 8dd06af..6b5a50d 100644 --- a/lookup.subproj/libinfo.c +++ b/lookup.subproj/libinfo.c @@ -659,7 +659,7 @@ getgrouplist_internal(const char *name, int basegid, gid_t *groups, uint32_t *ng groups[0] = basegid; *ngroups = 1; - item = si_grouplist(si_search(), name, max); + item = si_grouplist(si_search(), name, max+1); LI_set_thread_item(CATEGORY_GROUPLIST, item); if (item == NULL) return 0; diff --git a/lookup.subproj/mdns_module.c b/lookup.subproj/mdns_module.c index 5c4c120..6b618d7 100644 --- a/lookup.subproj/mdns_module.c +++ b/lookup.subproj/mdns_module.c @@ -372,6 +372,7 @@ _mdns_hostent_append_addr(mdns_hostent_t *h, const uint8_t *addr, uint32_t len) if (h->host.h_addr_list == NULL) { h->addr_count = 0; + free(buf); return -1; } @@ -1459,6 +1460,7 @@ _mdns_query_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t ifInde if (rdlen < sizeof(mdns_rr_srv_t)) { malformed = 1; + free(srv); break; } @@ -1470,6 +1472,7 @@ _mdns_query_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t ifInde if (srv->srv.target == NULL) { malformed = 1; + free(srv); break; } diff --git a/lookup.subproj/search_module.c b/lookup.subproj/search_module.c index f45e0af..b9710f8 100644 --- a/lookup.subproj/search_module.c +++ b/lookup.subproj/search_module.c @@ -62,7 +62,7 @@ extern char **_fsi_tokenize(char *data, const char *sep, int trailing_empty, int extern char *_fsi_get_line(FILE *fp); static void si_module_config_parse_line(search_si_private_t *pp, char *line); -static void si_module_config_modules_for_category(search_si_private_t *pp, int cat, int ntokens, const char * const *tokens); +static int si_module_config_modules_for_category(search_si_private_t *pp, int cat, int ntokens, const char * const *tokens); static si_mod_t * search_get_module(search_si_private_t *pp, int cat, int *n) @@ -864,6 +864,8 @@ search_is_valid(si_mod_t *si, si_item_t *item) si_mod_t * si_module_static_search(void) { + static bool result = false; + static const struct si_mod_vtable_s search_vtable = { .sim_close = &search_close, @@ -963,7 +965,16 @@ si_module_static_search(void) }; int count = sizeof(modules) / sizeof(char *); - si_module_config_modules_for_category(pp, CATEGORY_DEFAULT, count, modules); + if (si_module_config_modules_for_category(pp, CATEGORY_DEFAULT, count, modules) != 0) + { + free(si.name); + si.name = NULL; + free(pp); + si.private = NULL; + result = true; + return; + } + pp->cache = pp->search_list[CATEGORY_DEFAULT].module[0]; char *check = getenv("SYSINFO_CONF_ENABLE"); @@ -987,7 +998,7 @@ si_module_static_search(void) } }); - return &si; + return (!result) ? &si : NULL; } static void @@ -1026,14 +1037,14 @@ si_module_config_parse_line(search_si_private_t *pp, char *line) free(tokens); } -static void +static int si_module_config_modules_for_category(search_si_private_t *pp, int cat, int ntokens, const char * const *tokens) { int count = ntokens - 1; pp->search_list[cat].count = count; if (count == 0) { - return; + return -1; } pp->search_list[cat].module = (si_mod_t **)calloc(pp->search_list[cat].count, sizeof(si_mod_t *)); @@ -1042,7 +1053,7 @@ si_module_config_modules_for_category(search_si_private_t *pp, int cat, int ntok { free(pp->search_list[cat].module); free(pp->search_list[cat].module_flags); - return; + return -1; } int i, j; @@ -1060,4 +1071,5 @@ si_module_config_modules_for_category(search_si_private_t *pp, int cat, int ntok } } } + return 0; } diff --git a/lookup.subproj/si_data.c b/lookup.subproj/si_data.c index be9b541..5278077 100644 --- a/lookup.subproj/si_data.c +++ b/lookup.subproj/si_data.c @@ -95,6 +95,7 @@ si_list_concat(si_list_t *l, si_list_t *x) else { l->count = 0; + free(l); l = NULL; } } diff --git a/lookup.subproj/si_getaddrinfo.c b/lookup.subproj/si_getaddrinfo.c index 49a14c6..c0176b5 100644 --- a/lookup.subproj/si_getaddrinfo.c +++ b/lookup.subproj/si_getaddrinfo.c @@ -355,6 +355,7 @@ si_nameinfo(si_mod_t *si, const struct sockaddr *sa, int flags, const char *inte { /* ENXIO */ if (err != NULL) *err = SI_STATUS_EAI_FAIL; + free(serv); return NULL; } } @@ -871,6 +872,11 @@ _gai_simple(si_mod_t *si, const void *nodeptr, const void *servptr, uint32_t fam if ((flags & AI_NUMERICSERV) != 0) { + if (servptr == NULL) + { + if (err) *err = SI_STATUS_H_ERRNO_NO_RECOVERY; + return NULL; + } port = *(uint16_t*)servptr; } else @@ -1024,7 +1030,7 @@ _gai_srv(si_mod_t *si, const char *node, const char *serv, uint32_t family, uint } static si_list_t * -_gai_nat64_synthesis(si_mod_t *si, const char *node, const char *serv, int numericserv, +_gai_nat64_synthesis(si_mod_t *si, const char *node, const void *servptr, int numericserv, uint32_t family, uint32_t socktype, uint32_t proto, uint32_t flags, const char *interface) { if (NULL == node) @@ -1051,6 +1057,13 @@ _gai_nat64_synthesis(si_mod_t *si, const char *node, const char *serv, int numer return NULL; } + /* validate that IPv4 address is eligible for NAT64 synthesis */ +#if defined(NW_NAT64_API_VERSION) && NW_NAT64_API_VERSION >= 2 + if (!nw_nat64_can_v4_address_be_synthesized(&a4)) { + return NULL; + } +#endif // NW_NAT64_API_VERSION + /* validate that there is at least an IPv6 address configured */ uint32_t num_inet6 = 0; if ((si_inet_config(NULL, &num_inet6) < 0) || (0 == num_inet6)) @@ -1073,7 +1086,7 @@ _gai_nat64_synthesis(si_mod_t *si, const char *node, const char *serv, int numer uint16_t port = 0; if (0 == numericserv) { - if (_gai_serv_to_port(serv, proto, &port) != 0) + if (_gai_serv_to_port((const char *)servptr, proto, &port) != 0) { return NULL; } @@ -1082,6 +1095,10 @@ _gai_nat64_synthesis(si_mod_t *si, const char *node, const char *serv, int numer flags |= AI_NUMERICSERV; } } + else if (NULL != servptr) + { + port = *((const uint16_t *)servptr); + } /* query NAT64 prefixes */ nw_nat64_prefix_t *prefixes = NULL; @@ -1276,7 +1293,7 @@ si_addrinfo(si_mod_t *si, const char *node, const char *serv, uint32_t family, u } /* NAT64 IPv6 address synthesis support */ - si_list_t *nat64_list = _gai_nat64_synthesis(si, node, serv, numericserv, family, socktype, proto, flags, interface); + si_list_t *nat64_list = _gai_nat64_synthesis(si, node, servptr, numericserv, family, socktype, proto, flags, interface); if (NULL != nat64_list) { return nat64_list; diff --git a/membership.subproj/mbr_check_membership.3 b/membership.subproj/mbr_check_membership.3 index 7467ad8..b8ce818 100644 --- a/membership.subproj/mbr_check_membership.3 +++ b/membership.subproj/mbr_check_membership.3 @@ -89,7 +89,7 @@ codes on failure: .Bl -tag -width Er .It Bq Er EIO Communication with -.Xr openditectoryd 8 +.Xr opendirectoryd 8 failed. .It Bq Er ENOENT .Fa user diff --git a/membership.subproj/mbr_uid_to_uuid.3 b/membership.subproj/mbr_uid_to_uuid.3 index 9ca8ec9..7529d7e 100644 --- a/membership.subproj/mbr_uid_to_uuid.3 +++ b/membership.subproj/mbr_uid_to_uuid.3 @@ -60,7 +60,7 @@ Additionally, if the user or group is hosted on a PDC or Active Directory server, it will have a 128 bit or larger sid. .Pp These routines communicate with -.Xr openditectoryd 8 . +.Xr opendirectoryd 8 . .Pp .Fn mbr_uid_to_uuid takes a uid and looks up the associated user account. @@ -82,7 +82,7 @@ is set to ID_TYPE_UID or ID_TYPE_GID to indicate which type was found. Note that .Fn mbr_uuid_to_id always returns an id even if the uuid is not found. -This returned id is not persistant, +This returned id is not persistent, but can be used to map back to the uuid during runtime. To determine if the uuid exists, the returned id can be used in a call to .Xr getpwuid 3 @@ -112,13 +112,13 @@ These functions return 0 on success or one of the following error codes on failu .Bl -tag -width Er .It Bq Er EIO Communication with -.Xr openditectoryd 8 +.Xr opendirectoryd 8 failed. .It Bq Er ENOENT The mapping can not be performed. .It Bq Er EAUTH Communication with -.Xr openditectoryd 8 +.Xr opendirectoryd 8 failed due to an authentication error. .It Bq Er EINVAL Invalid arguments were provided. @@ -134,4 +134,4 @@ return 0 (success), even if the user/group does not exist. .Xr getpwuid 3 , .Xr getgrgid 3 , .Xr mbr_check_membership 3 , -.Xr openditectoryd 8 +.Xr opendirectoryd 8 diff --git a/membership.subproj/membership.h b/membership.subproj/membership.h index 193f8dd..aeafd83 100644 --- a/membership.subproj/membership.h +++ b/membership.subproj/membership.h @@ -177,7 +177,7 @@ int mbr_identifier_to_uuid(int id_type, const void *identifier, size_t identifie the type of ID (ID_TYPE_UID or ID_TYPE_GID). Synthesized UUID values will be directly translated to corresponding ID. A UID will always be returned even if the UUID is not found. - The returned ID is not persistant, but can be used to map back + The returned ID is not persistent, but can be used to map back to the UUID during runtime. @param uu is the UUID to be resolved @param uid_or_gid is the UID or GID found for the UUID diff --git a/nis.subproj/getnetgrent.c b/nis.subproj/getnetgrent.c index 04b0acc..6977c85 100644 --- a/nis.subproj/getnetgrent.c +++ b/nis.subproj/getnetgrent.c @@ -46,7 +46,7 @@ static struct grouplist { /* also used by pwlib */ char *gl_name; char *gl_domain; struct grouplist *gl_nxt; -} *grouplist, *grlist; +} *grouplist; struct list { /* list of names to check for loops */ @@ -59,65 +59,8 @@ static char *fill(); static char *match(); static char *domain; -static char *oldgrp; char *NETGROUP = "netgroup"; - -void _old_endnetgrent(void); -void _old_setnetgrent(char *); - -void _old_setnetgrent(grp) - char *grp; -{ - - if (oldgrp == NULL) - oldgrp = (char *)calloc(1,256); - if (oldgrp == NULL) return; - if (strcmp(oldgrp, grp) == 0) - grlist = grouplist; - else { - if (grouplist != NULL) - _old_endnetgrent(); - doit(grp, (struct list *) NULL); - grlist = grouplist; - (void) strcpy(oldgrp, grp); - } -} - -void _old_endnetgrent() -{ - register struct grouplist *gl; - - for (gl = grouplist; gl != NULL; gl = gl->gl_nxt) { - if (gl->gl_name) - free(gl->gl_name); - if (gl->gl_domain) - free(gl->gl_domain); - if (gl->gl_machine) - free(gl->gl_machine); - free((char *) gl); - } - grouplist = NULL; - grlist = NULL; - if (oldgrp) { - free(oldgrp); - oldgrp = 0; - } -} - -int _old_getnetgrent(machinep, namep, domainp) - char **machinep, **namep, **domainp; -{ - - if (grlist == 0) - return (0); - *machinep = grlist->gl_machine; - *namep = grlist->gl_name; - *domainp = grlist->gl_domain; - grlist = grlist->gl_nxt; - return (1); -} - /* * recursive function to find the members of netgroup "group". "list" is * the path followed through the netgroups so far, to check for cycles. @@ -175,7 +118,7 @@ doit(group,list) grouplist = gpls; } else { q = strpbrk(p, " \t\n#"); - if (q && *q == '#') + if (q == NULL || *q == '#') break; *q = 0; doit(p,list); @@ -186,6 +129,7 @@ doit(group,list) return; syntax_error: + free(gpls); (void) fprintf(stderr,"syntax error in /etc/netgroup\n"); (void) fprintf(stderr,"--- %s\n",val); return; diff --git a/nis.subproj/yp_all.c b/nis.subproj/yp_all.c index e08a981..645df97 100644 --- a/nis.subproj/yp_all.c +++ b/nis.subproj/yp_all.c @@ -120,8 +120,11 @@ u_long *objp; } xdr_free((xdrproc_t)xdr_ypresp_all, (char *)&out); - if (key == NULL || val == NULL) + if (key == NULL || val == NULL) { + free(key); + free(val); return FALSE; + } r = (*ypresp_allfn)(status, key, out.ypresp_all_u.val.key.keydat_len, val, diff --git a/rpc.subproj/auth_unix.c b/rpc.subproj/auth_unix.c index e8ae5fd..85318d5 100644 --- a/rpc.subproj/auth_unix.c +++ b/rpc.subproj/auth_unix.c @@ -151,6 +151,7 @@ authunix_create(machname, uid, gid, len, aup_gids) au = (struct audata *)mem_alloc(sizeof(*au)); #ifndef KERNEL if (au == NULL) { + mem_free(auth, sizeof(*auth)); (void)fprintf(stderr, "authunix_create: out of memory\n"); return (NULL); } @@ -183,6 +184,8 @@ authunix_create(machname, uid, gid, len, aup_gids) au->au_origcred.oa_base = mem_alloc((u_int) len); #else if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) { + mem_free(auth, sizeof(*auth)); + mem_free(au, sizeof(*au)); (void)fprintf(stderr, "authunix_create: out of memory\n"); return (NULL); } diff --git a/rpc.subproj/clnt_tcp.c b/rpc.subproj/clnt_tcp.c index fa3c20d..89aae16 100644 --- a/rpc.subproj/clnt_tcp.c +++ b/rpc.subproj/clnt_tcp.c @@ -317,8 +317,8 @@ clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) } shipnow = - (xdr_results == (xdrproc_t)0 && timeout.tv_sec == 0 - && timeout.tv_usec == 0) ? FALSE : TRUE; + (xdr_results == (xdrproc_t)NULLPROC || (timeout.tv_sec == 0 + && timeout.tv_usec == 0)) ? FALSE : TRUE; call_again: xdrs->x_op = XDR_ENCODE; diff --git a/rpc.subproj/pmap_prot2.c b/rpc.subproj/pmap_prot2.c index 6c286c7..99be504 100644 --- a/rpc.subproj/pmap_prot2.c +++ b/rpc.subproj/pmap_prot2.c @@ -121,7 +121,7 @@ xdr_pmaplist(xdrs, rp) register struct pmaplist **next = NULL; while (TRUE) { - more_elements = (bool_t)(*rp != NULL); + more_elements = (bool_t)(!(rp == NULL || *rp == NULL)); if (! xdr_bool(xdrs, &more_elements)) return (FALSE); if (! more_elements) @@ -132,7 +132,7 @@ xdr_pmaplist(xdrs, rp) * before we free the current object ... */ if (freeing) - next = &((*rp)->pml_next); + next = &((*rp)->pml_next); if (! xdr_reference(xdrs, (caddr_t *)rp, (u_int)sizeof(struct pmaplist), (xdrproc_t)xdr_pmap)) return (FALSE); rp = (freeing) ? next : &((*rp)->pml_next); diff --git a/rpc.subproj/svc_tcp.c b/rpc.subproj/svc_tcp.c index adeb66d..2aee389 100644 --- a/rpc.subproj/svc_tcp.c +++ b/rpc.subproj/svc_tcp.c @@ -193,6 +193,7 @@ svctcp_create(sock, sendsize, recvsize) r->recvsize = recvsize; xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); if (xprt == NULL) { + mem_free(r, sizeof(*r)); (void) fprintf(stderr, "svctcp_create: out of memory\n"); return (NULL); } diff --git a/rpc.subproj/svc_udp.c b/rpc.subproj/svc_udp.c index edccf6a..ac83afc 100644 --- a/rpc.subproj/svc_udp.c +++ b/rpc.subproj/svc_udp.c @@ -162,11 +162,14 @@ svcudp_bufcreate(sock, sendsz, recvsz) } su = (struct svcudp_data *)mem_alloc(sizeof(*su)); if (su == NULL) { + mem_free(xprt, sizeof(SVCXPRT)); (void)fprintf(stderr, "svcudp_create: out of memory\n"); return (NULL); } su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4; if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL) { + mem_free(xprt, sizeof(SVCXPRT)); + mem_free(su, sizeof(*su)); (void)fprintf(stderr, "svcudp_create: out of memory\n"); return (NULL); } @@ -429,12 +432,15 @@ svcudp_enablecache(transp, size) uc->uc_nextvictim = 0; uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS); if (uc->uc_entries == NULL) { + mem_free(uc, sizeof(*uc)); CACHE_PERROR("enablecache: could not allocate cache data"); return(0); } BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS); uc->uc_fifo = ALLOC(cache_ptr, size); if (uc->uc_fifo == NULL) { + mem_free(uc->uc_entries, sizeof(struct udp_cache)*size * SPARSENESS); + mem_free(uc, sizeof(struct udp_cache)); CACHE_PERROR("enablecache: could not allocate cache fifo"); return(0); } @@ -488,6 +494,7 @@ cache_set(xprt, replylen) } newbuf = mem_alloc(su->su_iosz); if (newbuf == NULL) { + mem_free(victim, sizeof(*victim)); CACHE_PERROR("cache_set: could not allocate new rpc_buffer"); return; } diff --git a/xcodescripts/Libinfo.xcconfig b/xcodescripts/Libinfo.xcconfig index 9105e0d..bb447ff 100644 --- a/xcodescripts/Libinfo.xcconfig +++ b/xcodescripts/Libinfo.xcconfig @@ -16,16 +16,14 @@ ORDER_FILE[sdk=iphoneos*] = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libsyste LINK_WITH_STANDARD_LIBRARIES = NO +SIM_SUFFIX[sdk=*simulator*] = _sim + LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt LIBMALLOC_LDFLAGS = -lsystem_malloc -LIBPLATFORM_LDFLAGS = -lsystem_platform -LIBPLATFORM_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_platform -LIBPTHREAD_LDFLAGS = -lsystem_pthread -LIBPTHREAD_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_pthread -LIBSYSCALL_LDFLAGS = -lsystem_kernel -LIBSYSCALL_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_kernel +LIBPLATFORM_LDFLAGS = -lsystem$(SIM_SUFFIX)_platform +LIBPTHREAD_LDFLAGS = -lsystem$(SIM_SUFFIX)_pthread +LIBSYSCALL_LDFLAGS = -lsystem$(SIM_SUFFIX)_kernel LIBM_LDFLAGS = -lsystem_m -LIBM_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_m LIBDYLD_LDFLAGS = -ldyld LIBC_LDFLAGS = -lsystem_c LIBDISPATCH_LDFLAGS = -ldispatch @@ -35,6 +33,6 @@ LIBBLOCKS_LDFLAGS = -lsystem_blocks LIBDNSD_LDFLAGS = -lsystem_dnssd LIBNOTIFY_LDFLAGS = -lsystem_notify LIBXPC_LDFLAGS = -lxpc -LIBNETWORK_LDFLAGS = -Wl,-upward-lsystem_network +LIBNETWORK_LDFLAGS = -lsystem_network OTHER_LDFLAGS = -all_load -umbrella System -L/usr/lib/system $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(LIBC_LDFLAGS) $(LIBDISPATCH_LDFLAGS) $(LIBLAUNCH_LDFLAGS) $(LIBASL_LDFLAGS) $(LIBBLOCKS_LDFLAGS) $(LIBDNSD_LDFLAGS) $(LIBNOTIFY_LDFLAGS) $(LIBXPC_LDFLAGS) $(LIBNETWORK_LDFLAGS)