RTS: use __attribute__((dllimport)) for external symbol declarations

This is important for the implementation of dynamic linking on windows #27162. RTS symbols are currently not explicitly imported with __attribute__((dllimport)). This is fine on ELF which does not require explicit import, but is required for dynamic linking on windows.

See commit message:

This is needed to be hygenic about DLL symbol imports and exports. The attribute is ignored on platforms other than Windows.

Use of the attribute however means that external data symbols do not have a compile-time constant address (they are loaded using an indirection). This means we have to adjust the rtsSyms initial linker table so that it is a local constant in a function, rather than a global constant. We now define it within a function that pre-populates the symbol table with the RTS symbols.

Merge request reports

Loading