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

mark at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Sat Dec 11 19:57:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770

--- Comment #24 from Mark Mitchell <mark at codesourcery dot com> 2010-12-11 19:56:43 UTC ---
On 12/11/2010 11:53 AM, hjl.tools at gmail dot com wrote:

>> You have to be more specific about what you meant by "interleaving".

Constructor priorities are a GNU C extension:

  __attribute__((constructor(<priority>)))

> I have said "If you have constructor priorities in .o files and .c
> files, you may get different behaviors if .o files are compiled with
> a different compiler, different versions of GCC or not GCC at all."

Well, it sounds to me, then, that we would be introducing a binary
compatibility problem to make this change.  If we're going to do it, I
think that means adding linker smarts that detect that there are both
.ctor.* and .init_array.* sections and issuing an error -- not a warning
-- together with a hint as to how to recompile so as to get either the
new or old behavior.  (Some people will have binary libraries they can't
recompile, so we need to explain how to compile new code so that it
still uses .ctor.*.)



More information about the Gcc-bugs mailing list