Linux x86_64 Elf file has a size limitation for Initialized data segment .rodata
section - 2GB.
If your Total const data is larger than 2GB then Large data can be put to .lrodata
section.
How to ask clang to put Large data to .lrodata?
In gcc we can simply say -mcmodel=medium
during object file creation.
But I think clang ignores this parameter on Linux x86_64 platform.
Also clang does not have -mlarge-data-threshold=threshold
parameter (defaults to 65535 in gcc)
For now I have to explicitly specify .lrodata
section in C code using __attribute__
__attribute__((section(".lrodata")))
extern const long long int B1[131072];
const long long int B1[131072] = {...}
Iām sure clang has a better/simpler way to support large arrays placement to .lrodata
on Linux x86_64 platform.
Related Error:
if object file .rodata
section is large than 2GB then linking to .so
will fail with error relocation truncated to fit: R_X86_64_PC32