[RFC] Fail early on unimplementable append linkage uses

Append linkage is magical. It doesn't correspond to anything available
in real object files (ELF/COFF/MachO). In those files sections are
appended, but symbols are just resolved.

That means that appending linkage can only be used with llvm special
symbols that never hit a real .o.

Long term I think we should delete it an replace with explicit use of section.

But for now I would like to just error early if we try to actually put
one in an object file. That is what http://reviews.llvm.org/D20179
does. Is everyone OK with that with a langref update?

Cheers,
Rafael

So they should have been resolved by emission time, or it's a back-end error.

Do you have an idea of what could be affected if we start emitting an
error, here? Test-Suite, other programs?

cheers,
--renato

That means that appending linkage can only be used with llvm special
symbols that never hit a real .o.

So they should have been resolved by emission time, or it's a back-end error.

Not resolved, translated. For example, llvm.ctors gets expanded to
whatever form the object file uses for processing static constructors.

Do you have an idea of what could be affected if we start emitting an
error, here? Test-Suite, other programs?

No. Clang only produces the well known ones. Anything producing a
appending linkage global that actually got written to the output would
hit a link error if it tried combining any two of those files (and can
get the same behaviour with an external linkage).

Cheers,
Rafale

I wonder what was the motivation to add that piece of code, then. It
sounds to me that it was wrong to do that in the first place.

--renato

I agree. The revisions in question seem to be r41048 and before that
r8417. From reading them I think it was just a mistake about how
object files work.

Cheers,
Rafael

I think appending linkage was intended to abstract over the
platform-specific details of arranging a custom section with start and
end symbols. Nobody ever implemented it though, so until they are
implemented, rejecting them early sounds good. :slight_smile:

I think appending linkage was intended to abstract over the
platform-specific details of arranging a custom section with start and
end symbols. Nobody ever implemented it though, so until they are
implemented, rejecting them early sounds good. :slight_smile:

+1 from me