Currently, it is not possible to specify all available LLVM linkage types of variables or functions from the C programming language. This patch adds a linkage attribute (__attribute__((linkage("...")))__) that allows to specify the LLVM linkage type https://llvm.org/docs/LangRef.html#linkage-types via an attribute. It is similar to the visible attribute that allows to specify the LLVM visibility styles.
The attribute is dominant and overrides any linkage type specified by other specifiers (e.g. static) or attributes (e.g. __attribute__((weak))).
There was a previous discussion about adding a linkonce_odr_linkage attribute https://reviews.llvm.org/D18095
I use the attribute in my C++-to-C transpiler to generate C code with the same LLVM IR as the original C++ code. Especially, template function use linkonce_odr is relevant for optimization and cannot generated in C right now. Projects like the LLVM C Backend could also profit from it ... https://github.com/JuliaHubOSS/llvm-cbe