What is the default linkage type?

According to https://llvm.org/docs/LangRef.html#linkage-types

external
If none of the above identifiers are used, the global is externally visible, meaning that it participates in linkage and can be used to resolve external symbol references.

But that doesn’t seem to be quite correct.

For a global variable, external linkage type seems to mean the same thing as extern in C: this is /not/ a definition, but a mere declaration of something that must be defined elsewhere.

But when a linkage type is not specified, the system doesn’t seem to behave that way; instead, such a global variable seems to be treated as a definition.

Has the above paragraph in the documentation been superseded, or am I misunderstanding it? What exactly is the default linkage type?

For a global variable, external linkage type seems to mean the same thing as extern in C: this is /not/ a definition, but a mere declaration of something that must be defined elsewhere.

That's what the `external` keyword on a global means, but the thing
being declared if that's used still has external linkage.

But when a linkage type is not specified, the system doesn't seem to behave that way; instead, such a global variable seems to be treated as a definition.

Yes. A definition of a variable with external linkage.

I think the syntax is rather quirky in that area, I expect it dates
from the earliest days of the LLVM project. If I was redesigning it
I'd probably make the `external` mandatory with an optional definition
(and maybe turn `extern_weak` into `weak` too).

The LangRef could almost certainly be improved, I think it conflates
the keywords used in the textual IR with the conceptual linkage that
every global has, because they are the same thing or near enough for
all except "external".

Cheers.

Tim.