Exceptions workaround for older systems that don't USE_COLLECT2

Melissa O'Neill oneill@cs.sfu.ca
Wed Sep 9 05:52:00 GMT 1998

Jeff Law writes:
> I've enabled collect2 for the m68k nextstep port.  I didn't do anything
> with the x86 port because I didn't know if it has the same problems.
> If the x86 next port needs this change too, let me know and I'll fix
> it too.

Yes, the x86 port should need to use collect as well. Ditto for HPPA
and SPARC NEXTSTEP versions, if they are supported by EGCS. It's the
same basic linker and object format, so their behaviour should be
more-or-less identical across processor architectures.

I had claimed:
>> [It would] be cool if g++ could skip the double-link/collect2 business
>> when -fno-exceptions is in effect, but I doubt anyone is going to
>> take the time to implement that.

... and Jeff replied, saying:
> This would not be safe.
> Even if your program does not use exceptions, you may be linking to
> a library that does use exceptions internally.

Interesting. I had thought that linking code that used exceptions
together with code that doesn't use them had unspecified results anyway
(at least in general, if you're allowed to use pointers to functions,
have call-backs, etc.), or am I mistaken?

Someone could probably argue that invoking g++ to link object files and
specifying `-fno-exceptions' could be seen as an assertion that none of
the object files or libraries use exceptions, but the argument is academic
anyway since no one is poised to implement such a feature...


More information about the Gcc mailing list