Part of what is happening here is that the linker does not force
external linking mode because the net package uses cgo; see ldhostobj
in cmd/ld/lib.c. So that is why we are using the internal linker.
Another part is that the C implementation of getaddrinfo does refer to
errno. At least, it does on a GNU/Linux system, and it would not be
surprising if DragonFly is the same. This reference gets compiled
into an ELF object file that is part of the net package, and gets
passed to the linker. (Normally linking against an ELF file would
cause the external linker to be invoked, but as noted above the net
package is an exception.)
So we do in fact wind up with a TLS symbol in the internal linker, and
it doesn't know how to deal with that.
The simple fix is going to be forcing the use of the external linker
on DragonFly in ldhostobj even for an internal package, which is
similar to what you are doing in forcing the external linker in all
cases.
The more complex fix would be to teach the internal linker how to
handle a TLS symbol. That is feasible but not simple. The linker
would have to expand the TLS section and it would have to implement
TLS optimizations to convert the reloc references for a static link.
Ian