Re: FYI: SIGBUS with world built by clang

看板FB_current作者時間13年前 (2012/07/05 05:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/7 (看更多)
--udoRqEMdU50CdIRN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 05, 2012 at 12:32:01AM +0900, Taku YAMAMOTO wrote: > On Wed, 04 Jul 2012 17:08:30 +0200 > Dimitry Andric <dim@FreeBSD.org> wrote: >=20 > > On 2012-07-04 16:33, Taku YAMAMOTO wrote: > > > For people having SIGBUS with clang-build world + gcc-build binaries, > > >=20 > > >=20 > > > In short words, for any libraries (and never forget about rtld-elf!) > > > which are potentially called from arbitrary binaries, > > > compile them with either -mstackrealign or -mstack-alignment=3D8! > > >=20 > > > The detail is as follows. > > >=20 > > > I've observed that clang carelessly expects the stack being aligned at > > > 16 byte boundary. > >=20 > > Eh, this is a requirement of the amd64 ABI. Any compiler that *doesn't* > > align the stack on 16-byte boundaries is basically broken. Or are you > > experiencing this on i386? Even there, 16-byte alignment would be much > > better in combination with SSE instructions (which arent' enabled by > > default, btw). >=20 > Oops, I had to be clear about that! > Yes, the experiment was took on i386 (actually -march=3Dpentium4). >=20 > > Note that you would get the same issue with newer versions of gcc, which > > will also assume this alignment. >=20 > Interesting, but the base gcc we currently have won't on i386, I think. > (I occationally get bitten by similar problem when using -ftree-vectorize) As far as I understand the rules, $esp % 16 must be zero before call instruction is executed. i386 csu explicitely aligns the stack before calling into C land, everything else should be the C compiler own offence :). --udoRqEMdU50CdIRN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/0siUACgkQC3+MBN1Mb4g32QCff5GaW0Rvk4uuUiNlh++/kj6Y oD0An2u8FqC6zVpCdMHi/gwE069pgNGj =Q70s -----END PGP SIGNATURE----- --udoRqEMdU50CdIRN--
文章代碼(AID): #1FzBPIzo (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1FzBPIzo (FB_current)