开发者

what's the ELF object file size limitation on 64bit platform?

开发者 https://www.devze.com 2023-01-20 23:51 出处:网络
Assume the x86 64 and linux platform. If you look into the ELF header, the offset are all 64bit. So it\'s easy to create an object file larger than 4G with relocatoin R_X86_64_64. This means a stati

Assume the x86 64 and linux platform.

If you look into the ELF header, the offset are all 64bit.

So it's easy to create an object file larger than 4G with relocatoin R_X86_64_64. This means a static .o file and executable can be as large as 64bit can represent.

However, for shared library, like gcc , we only have R_X86_64_PLT32 relocation. This means that it's impossible to create a shared library large than 4GB, right?

S开发者_运维技巧o if I want to build a huge program, one of the .o file is huge enough (>4GB) , the only choice is static linking?

Any comment is welcome.

Thanks, limi


The x86-64 ABI used by Linux defines a "large model" specifically to avoid such size limitations, which includes 64-bit relocation types for the GOT and PLT. (See the table in section 4.4.2, and the instruction sequences in 3.5.5 which show how they are used.)

0

精彩评论

暂无评论...
验证码 换一张
取 消