This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them


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"?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]