Skip to content

[lld] Incorrectly Internalizing a symbol defined through explicit template instantiation when using '-flto -fuse-ld=lld' #111341

Closed
@pranav-159

Description

When creating a shared library of which there are two files with implicit and explicit template instantiations of a particular class template respectively. If the file with the implicit instantiation comes first at linking, then the member functions get internalized by lld. (If the order is reverse i.e, explicit instantiation file comes first then the member functions won't get internalized.)
Note: When using llvm-gold plugin this issue is not seen.
In the reproducer. We created a shared library as mentioned above and linked it with an executable with extern template which causes an undefined symbol error as the required functions are internalized by lld when creating the shared library, which is not expected of the linker

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions