Re: What is wrong in this code?

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

 



On Fri, Nov 9, 2012 at 7:25 PM, Michael Witten <mfwitten@xxxxxxxxx> wrote:
>
> However, Ian, you're missing the most interesting bit from Angelo's email,
> namely that a GCC toolchain doesn't always have a problem with multiple
> instantiations:

...

> How does that make sense? Is a different linker being used with the
> GCC toolchain? If so, which one? GNU ld doesn't support Mach-O, and
> even if it did, GNU ld doesn't appear to mind the error on at least
> a few other systems.

GCC does not come with a linker.  There are two different linkers in
use on GNU/Linux: GNU ld and gold.  Other systems, such as MacOS, have
other linkers.  Different linkers can have different behaviours.

Probably more important here, though, is how GCC marks the
instantiated template.  If it marks it as weak in the sense used on
ELF or as COMDAT in the sense used on Windows, then multiple
instantiations will be permitted--the linker will discard later ones.
I haven't looked into the details here to see what GCC is actually
doing.  Since a correct program can only have a single explicit
instantiation, it doesn't matter too much.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux