[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/4538] add --all-init flag to force all static initializers to be

From: ejt at andrew dot cmu dot edu
Subject: [Bug ld/4538] add --all-init flag to force all static initializers to be loaded
Date: 7 Aug 2007 03:37:30 -0000

------- Additional Comments From ejt at andrew dot cmu dot edu  2007-08-07 
03:37 -------
Such a good, persuasive argument!  You've raised many good points that I hadn't 
OK then, lets call it an "enhancement", and I'll reword the summary for you.

The fact that this issue keeps coming up (see referenced threads at the 
beginning of the thread) should 
tell you that this is an ongoing problem for users.  I don't see why you refuse 
to even consider the 
option of fixing it.  For heaven's sake, no one says *you* have to do it, just 
leave the report open as a 
known issue so people can track it and maybe someday someone *else* will be 
inspired to give it a 

And for reference, here's the work around I've personally settled on in the 
mean time: I added a pre-
linking step to my Makefile to scan for symbols named 'autoRegister*', and then 
pass '-u' flags for each 
of those symbols when doing the final link to make sure their initializers get 
pulled in, like so:
        @undef=`nm -g "project.a" | grep "autoRegister" | grep -v " *U" | cut 
-f 3 -d ' ' | sort -u | sed 
's/^/-u /'`; \
        $(CXX) -o $@ $$undef $(OBJS) $(libs)  ;

Of course, it'd sure be nice to have an "official" way to handle this that 
doesn't involve specially-named 
symbols or bash scripts wrapped around the linker... e.g. adding a --all-init 
flag, perhaps?

           What    |Removed                     |Added
           Severity|normal                      |enhancement
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Summary|static initialization       |add --all-init flag to force
                   |ignored in static archive   |all static initializers to
                   |(.a)                        |be loaded


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]