This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 11 Dec 2010 21:07:25 +0000
- Subject: [Bug target/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them
- Auto-submitted: auto-generated
- References: <bug-46770-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
--- Comment #30 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-11 21:06:49 UTC ---
(In reply to comment #27)
> On 12/11/2010 12:17 PM, hjl.tools at gmail dot com wrote:
>
> > I don't think GCC really supports interleaving constructor priority
> > at binary level. Unless GCC can guarantees one can interleave constructor
> > priority in object files
>
> I don't understand this comment at all. GCC honors constructor
> priorities across object files and has for ages.
Say I gave you an object with header
---
class Two {
private:
int i, j, k;
public:
static int count;
Two( int ii, int jj ) { i = ii; j = jj; k = count++; };
Two( void ) { i = 0; j = 0; k = count++; };
int eye( void ) { return i; };
int jay( void ) { return j; };
int kay( void ) { return k; };
};
extern Two foo;
--
1. How do you find out what priority "foo" constructor has?
2. How do you run your constructor before "foo"?