Support R_X86_64_TLSGD relocation on FreeBSD
The FreeBSD C <ctype.h> header supports per-thread locales by exporting a
static inline function that references the _ThreadRuneLocale
thread-local
variable. This means that object files that use e.g. isdigit(3) end up with
TLSGD(19) relocations, and would not load into ghci or the language server.
Here we add support for this type of relocation, for now just on FreeBSD, and only for external references to thread-specifics defined in already loaded dynamic modules (primarily libc.so). This is sufficient to resolve the FreeBSD <ctype.h> issue.
Runtime linking of ".o" files which define new thread-specific variables would be noticeably more difficult, as this would likely require new rtld APIs.
Resolves: #19086
Edited by vdukhovni