[LLVMbugs] [Bug 502] [llvm-g++] Link failure linking 'const' global with a dynamic initializer

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Feb 12 11:35:49 PST 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=502

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
            Summary|[llvm-g++] llvm-g++ unsafely|[llvm-g++] Link failure
                   |marks 'const' global        |linking 'const' global with
                   |variable prototypes as      |a dynamic initializer
                   |readonly                    |



------- Additional Comments From sabre at nondot.org  2005-02-12 13:35 -------
This bug took some thinking and pondering to get right, and required revisiting
some of the decisions made when we fixed Bug 450.  The problem with the
resolution for Bug 450 is that *any* const global in C++ can have a dynamic
initializer, not just those of class type with ctors (e.g. "const int X = foo();").

The solution to this problem is to generalize what LLVM allows for constants, as
documented in this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024041.html

To match these semantics, the linker was modified to permit this flexibility:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024040.html

And some tests were added to check that this behavior continues to work:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024038.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024039.html

Finally, the C++ front-end is now free to mark const global declarations as
constant even if the global variables have constructors.  This will perhaps lead
to better optimization of C++ programs.  Patch here:

http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050207/024037.html

This should fix the problem that prevented QT 4.0 from linking.

-Chris



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




More information about the llvm-bugs mailing list