From owner-freebsd-arch@FreeBSD.ORG Tue Jul 8 19:02:48 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CA776D8; Tue, 8 Jul 2014 19:02:48 +0000 (UTC) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "tensor.andric.com", Issuer "CAcert Class 3 Root" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D07302532; Tue, 8 Jul 2014 19:02:47 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::1133:f181:93e3:e668] (unknown [IPv6:2001:7b8:3a7:0:1133:f181:93e3:e668]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 75A255C44; Tue, 8 Jul 2014 21:02:44 +0200 (CEST) Content-Type: multipart/signed; boundary="Apple-Mail=_AA1F36B9-C83B-439A-9C45-69678C31634B"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Total confusion over toolchain/xdev behavior From: Dimitry Andric In-Reply-To: Date: Tue, 8 Jul 2014 21:02:25 +0200 Message-Id: References: <1404688077.1059.115.camel@bruno> <1404766292.65432.43.camel@revolution.hippie.lan> <20B72004-1499-4F99-A7C7-13173C50C7C6@bsdimp.com> <1404831829.1662.7.camel@bruno> <1404835471.1662.13.camel@bruno> <1404842719.1662.15.camel@bruno> To: sbruno@freebsd.org X-Mailer: Apple Mail (2.1878.6) Cc: freebsd-arch X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2014 19:02:48 -0000 --Apple-Mail=_AA1F36B9-C83B-439A-9C45-69678C31634B Content-Type: multipart/mixed; boundary="Apple-Mail=_DDDFE94F-1E3D-46CD-A6C8-60223B9C4CC6" --Apple-Mail=_DDDFE94F-1E3D-46CD-A6C8-60223B9C4CC6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 08 Jul 2014, at 20:27, Dimitry Andric wrote: > On 08 Jul 2014, at 20:05, Sean Bruno wrote: > ... >> =3D=3D=3D> lib/libproc (all) >> building static proc library >> ranlib -D libproc.a >> make[5]: /var/tmp/home/sbruno/fbsd_head/lib/libproc/.depend, 322: >> ignoring stale .depend for /var/tmp/mips_cc/usr/lib/libstdc++.a >> building shared library libproc.so.2 >> /var/tmp/mips_cc/usr/bin/ld: cannot find -lsupc++ >> *** Error code 1 >>=20 >> Stop. >> make[5]: stopped in /home/sbruno/fbsd_head/lib/libproc >> *** Error code 1 >=20 > Yes, libproc and it dependencies should be disabled when MK_CXX=3Dno. = Alternatively, libproc's demangling support could be conditionally = compiled out in that case. Now with a suggested patch. -Dimitry --Apple-Mail=_DDDFE94F-1E3D-46CD-A6C8-60223B9C4CC6 Content-Disposition: attachment; filename=libproc-no-cxx-1.diff Content-Type: application/octet-stream; name="libproc-no-cxx-1.diff" Content-Transfer-Encoding: 7bit Index: lib/libproc/Makefile =================================================================== --- lib/libproc/Makefile (revision 268420) +++ lib/libproc/Makefile (working copy) @@ -15,7 +15,9 @@ INCS= libproc.h CFLAGS+= -I${.CURDIR} -.if ${MK_LIBCPLUSPLUS} != "no" +.if ${MK_CXX} == "no" +CFLAGS+= -DNO_CXA_DEMANGLE +.elif ${MK_LIBCPLUSPLUS} != "no" LDADD+= -lcxxrt DPADD+= ${LIBCXXRT} .else Index: lib/libproc/proc_sym.c =================================================================== --- lib/libproc/proc_sym.c (revision 268420) +++ lib/libproc/proc_sym.c (working copy) @@ -46,7 +46,9 @@ #include "_libproc.h" +#ifndef NO_CXA_DEMANGLE extern char *__cxa_demangle(const char *, char *, size_t *, int *); +#endif /* NO_CXA_DEMANGLE */ static void proc_rdl2prmap(rd_loadobj_t *, prmap_t *); @@ -53,20 +55,25 @@ static void proc_rdl2prmap(rd_loadobj_t *, prmap_t static void demangle(const char *symbol, char *buf, size_t len) { +#ifndef NO_CXA_DEMANGLE char *dembuf; - size_t demlen = len; + size_t demlen; - dembuf = malloc(len); - if (!dembuf) - goto fail; - dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); - if (!dembuf) - goto fail; - strlcpy(buf, dembuf, len); - free(dembuf); + if (symbol[0] == '_' && symbol[1] == 'Z' && symbol[2]) { + dembuf = malloc(len); + if (!dembuf) + goto fail; + demlen = len; + dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); + if (!dembuf) + goto fail; + strlcpy(buf, dembuf, len); + free(dembuf); + } return; fail: +#endif /* NO_CXA_DEMANGLE */ strlcpy(buf, symbol, len); } @@ -297,10 +304,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t add if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, dynsymstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain @@ -335,10 +339,7 @@ symtab: if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, symtabstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain --Apple-Mail=_DDDFE94F-1E3D-46CD-A6C8-60223B9C4CC6 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_DDDFE94F-1E3D-46CD-A6C8-60223B9C4CC6-- --Apple-Mail=_AA1F36B9-C83B-439A-9C45-69678C31634B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iEYEARECAAYFAlO8QFIACgkQsF6jCi4glqPVOQCgmjvieOSAhQ4iipguo7D2/wpK EU4An3/eu3Dkh7aWX8CVekA4d6m2jdOc =0MkF -----END PGP SIGNATURE----- --Apple-Mail=_AA1F36B9-C83B-439A-9C45-69678C31634B--