Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jul 2014 21:02:25 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        sbruno@freebsd.org
Cc:        freebsd-arch <freebsd-arch@freebsd.org>
Subject:   Re: Total confusion over toolchain/xdev behavior
Message-ID:  <B9B53E2E-FBAD-461E-86B9-8AD516F94570@FreeBSD.org>
In-Reply-To: <FF6728EE-7BF9-44E1-99EA-661F398F3EEB@FreeBSD.org>
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> <B96EB5EC-A078-4CDE-AB30-CF7FD05D1287@bsdimp.com> <1404842719.1662.15.camel@bruno> <FF6728EE-7BF9-44E1-99EA-661F398F3EEB@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <dim@FreeBSD.org> wrote:
> On 08 Jul 2014, at 20:05, Sean Bruno <sbruno@ignoranthack.me> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B9B53E2E-FBAD-461E-86B9-8AD516F94570>