Date: Wed, 26 Jun 2013 23:17:41 +0200 From: Michael Gmelin <freebsd@grem.de> To: Dimitry Andric <dim@FreeBSD.org> Cc: Konstantin Belousov <kostikbel@gmail.com>, Brooks Davis <brooks@FreeBSD.org>, David Chisnall <theraven@freebsd.org>, Matthias Andree <mandree@FreeBSD.org>, "freebsd-ports@freebsd.org Ports" <freebsd-ports@freebsd.org> Subject: Re: Global destructor order problems (was: Re: Are ports supposed to build and run on 10-CURRENT?) Message-ID: <20130626231741.497f7a9b@bsd64.grem.de> In-Reply-To: <A60BFADA-E358-4363-8BED-E154AB327C6B@FreeBSD.org> References: <20130613031535.4087d7f9@bsd64.grem.de> <EF830CD7-00F1-4628-8515-76133BBE85E7@FreeBSD.org> <C1CC40FC-4489-4164-96B7-5E1A25DCB37F@FreeBSD.org> <20130626015508.426ab5b9@bsd64.grem.de> <51CAADB8.7090603@FreeBSD.org> <20130626133149.4835f14a@bsd64.grem.de> <7CD9075C-F8D6-41C1-8D21-8B10DF866ECE@FreeBSD.org> <20130626204521.GU91021@kib.kiev.ua> <6900C006-2A57-4EAF-B19A-629A85CBA001@FreeBSD.org> <20130626210534.GY91021@kib.kiev.ua> <A60BFADA-E358-4363-8BED-E154AB327C6B@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 26 Jun 2013 23:11:34 +0200 Dimitry Andric <dim@FreeBSD.org> wrote: > On Jun 26, 2013, at 23:05, Konstantin Belousov <kostikbel@gmail.com> > wrote: > > On Wed, Jun 26, 2013 at 10:59:24PM +0200, Dimitry Andric wrote: > >> On Jun 26, 2013, at 22:45, Konstantin Belousov > >> <kostikbel@gmail.com> wrote: > >>> On Wed, Jun 26, 2013 at 09:26:09PM +0200, Dimitry Andric wrote: > >>>> This revision is not in 9.1-RELEASE, but it is in 9-STABLE, so > >>>> the problem can also be reproduced there. > >>> ... > >>>> This is roughly gcc 4.3.0 and later. For example, gcc 4.8 > >>>> generates: > >>> I just tested the thing with gcc 4.8 on up to date stable/9 and > >>> HEAD. In both cases, major tom did not fail, at least not in the > >>> peculiar way. The gcc-generated code passed the PLT address of > >>> the corresponding destructor. > >> > >> That is strange, did you compile the main program with -fPIC? > >> That is the problem case. If you don't compile the main program > >> with -fPIC, the problem will indeed not occur. > > > > I just used the Makefile provided by the earlier message, and it > > contains the -fPIC flag (which is strange thing to do on its own, > > binaries should use -fPIE). > > > > This is how the registration for the outer dtr looks for me, gcc > > 4.8.1/i386: > > > > 0x08048763 <+42>: call 0x8048520 <_ZN5OuterC1Ev@plt> > > 0x08048768 <+47>: lea 0x28(%ebx),%eax > > 0x0804876e <+53>: mov %eax,0x8(%esp) > > 0x08048772 <+57>: lea 0x34(%ebx),%eax > > 0x08048778 <+63>: mov %eax,0x4(%esp) > > 0x0804877c <+67>: mov -0x4(%ebx),%eax > > 0x08048782 <+73>: mov %eax,(%esp) > > 0x08048785 <+76>: call 0x8048500 <__cxa_atexit@plt> > > > > ebx was set up earlier as the GOT pointer. > > Strange, you must have a different gcc 4.8 than me, in my case it > always uses GOT: > > call _ZN5OuterC1Ev@PLT > leal __dso_handle@GOTOFF(%ebx), %esi > addl $12, %esp > pushl %esi > pushl %edi > pushl _ZN5OuterD1Ev@GOT(%ebx) > call __cxa_atexit@PLT > > This is the lang/gcc48 port, btw. > > -Dimitry > Are you both on the same architecture? -- Michael Gmelin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130626231741.497f7a9b>