Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2013 11:00:40 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Michael Gmelin <freebsd@grem.de>
Cc:        David Chisnall <theraven@freebsd.org>, "freebsd-ports@freebsd.org Ports" <freebsd-ports@freebsd.org>, Matthias Andree <mandree@FreeBSD.org>
Subject:   Re: Are ports supposed to build and run on 10-CURRENT?
Message-ID:  <51CAADB8.7090603@FreeBSD.org>
In-Reply-To: <20130626015508.426ab5b9@bsd64.grem.de>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2013-06-26 01:55, Michael Gmelin wrote:
...
> The problem is that static initialization happens in the expected
> order (same translation unit), but termination does *not* happen in the
> reverse order of initialization, which - according to the C++ standard
> section 3.6.3 should be guaranteed:
>
> "If the completion of the constructor or dynamic initialization of an
> object with static storage duration is sequenced before that of
> another, the completion of the destructor of the second is sequenced
> before the initiation of the destructor of the first."
>
> The following conditions have to be met in order to show the problem:
>
> 1. Two static objects defined in the translation unit containing main
> 2. Definition of one of the underlying objects is in a separate
>     source which is used to build a shared library
> 3. Both, the translation unit containing main an the one forming the
>     shared library are compiled using -fPIC (or -fpic).

Strange, if you compile the main program without -fPIC, the testcase
works correctly.  Normally, there should never be a need to compile a
normal executable with -fPIC, but it should not break anything either.

I am not sure what causes this, but I will investigate.  For now, the
workaround is to compile only shared objects with -fPIC.

-Dimitry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51CAADB8.7090603>