This is the mail archive of the
mailing list for the GCC project.
Re: Static linkage and anonymous namespace
>>>>> Martin von Loewis <email@example.com> writes:
>> I can't think of any examples offhand that the compiler currently supports,
>> but passing the address of a variable in the unnamed namespace to an
>> exported template would break. I'd like not to have to change this back
>> when we implement export.
> I thought you'd bring up export, and I can't really defend myself here
> because I have no clue how to implement exported templates.
My plan is to encode the necessary information in another ELF section and
have the prelinker extract it and feed it to the compiler at link time.
This is the only way to support separate compilation properly; otherwise,
people can't put exported templates into libraries.
> It is currently easy to produce duplicate symbols if you know the
> algorithm for the anonymous namespace name. Is this a problem?
> If so, should we merge the current time into the name?
I think so, yes.