From owner-freebsd-emulation@freebsd.org Thu Mar 24 13:56:07 2016 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF871ADC29B for ; Thu, 24 Mar 2016 13:56:07 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id BADDB1D3A for ; Thu, 24 Mar 2016 13:56:07 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id B3AF2ADC299; Thu, 24 Mar 2016 13:56:07 +0000 (UTC) Delivered-To: emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2ECBADC297; Thu, 24 Mar 2016 13:56:07 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 888541D37; Thu, 24 Mar 2016 13:56:07 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.0.7] (cpc91230-cmbg18-2-0-cust661.5-4.cable.virginm.net [82.1.230.150]) (authenticated bits=0) by theravensnest.org (8.15.2/8.15.2) with ESMTPSA id u2ODu4NK017717 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Mar 2016 13:56:05 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc91230-cmbg18-2-0-cust661.5-4.cable.virginm.net [82.1.230.150] claimed to be [192.168.0.7] Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: FreeBSD MachO File format, your comments on it. From: David Chisnall In-Reply-To: Date: Thu, 24 Mar 2016 13:55:58 +0000 Cc: mokhi , emulation@freebsd.org, current@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <097363D7-DB74-4C48-90A7-BFACB1E0C0E1@FreeBSD.org> References: <7554521E-81AB-43DE-A7FC-A9F334F660B7@FreeBSD.org> To: Damjan Jovanovic X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2016 13:56:07 -0000 On 24 Mar 2016, at 13:42, Damjan Jovanovic wrote: >=20 > ELF itself is a disaster. Symbol lookup in ELF is process scoped, not > library scoped like Windows's PE and Mac's Mach-O, so same named > symbols from different libraries in the same process (loaded through > any number of levels of indirection) can and do clash, resulting in > memory corruption. This is why hacks like symbol versioning, > RTLD_DEEPBIND on GNU's libc and -Bdirect on Solaris were invented. This problem is addressed by some of the work that Sony has done = recently that they are about to upstream to Clang/LLVM. > We suffer from this problem badly on FreeBSD, as Clang's C++ standard > library and GCC's standard library don't have fully compatible ABIs, > so when both are loaded into the same process and the incompatible C++ > features are used -> memory corruption -> crash. Eg. compile Apache > OpenOffice with GCC on a system built with Clang, and you'll see even > the unit tests crash. That shouldn=E2=80=99t happen, as libstd++ and libc++ have different = symbols (libc++ puts its symbols in the __v1 namespace). The problem = can come from mixing libsupc++ and libcxxrt, but that=E2=80=99s only an = issue if you have not built libstdc++ against libcxxrt. David