the LLVM documentation lists the 'appending' linkage for having the
linker combine two arrays. I'm wondering though if it's then
possible to get the size of the combined array, e.g., for iterating
over its elements? Or how would I otherwise use the combined array?
Any thoughts on this? Am I missing something?
Appending linkage isn't really intended for normal code; the most
common uses are for special globals, like "llvm.used" and
"llvm.global_ctors", which use compiler magic to work properly.
I know there was talk at one point in the past of a certain thing you
could setup that appends a zero to the end of that global array so you
could iterate through it safely, did that ever come about?
I’ve started a number of threads on this exact question, search the email archives if you are interested.
At this point, I have basically given up on using appending linkage for anything. Instead, the solution I’ve adopted is a custom linker pass that stitches globals together in the way that I need them to be. (This would be easier if I could define my own linkage type - as it stands, I have to rely on other clues as to which globals to combine together.)