3

When the ELF file loading process, .text section is mapped to a memory segment. I would like to know:

  1. What is the maximum value of a segment size ?
  2. What is the maximum value of .text section size ?

1 Answer 1

4

Elf32 or Elf64?

According to ELF specification, for Elf32 the section size is stored in 32 bits (Elf32_Word). So, the maximum size would be 4294967295 bytes (4 GiB).

4
  • I assume you meant 4294967295 bytes
    – Hackndo
    Aug 10, 2015 at 14:45
  • @Hackndo maybe it's stored in a signed integer (which would make no sense, but it's still possible)
    – rev
    Aug 11, 2015 at 13:01
  • Then it would be 2 GB, not 4 GB. I'm just noticing that 2147483647 bytes (4 Gb) is incoherent
    – Hackndo
    Aug 11, 2015 at 13:32
  • 2
    You're right, but I didn't write "2147483647 bytes (4 Gb)", I only wrote 4GB, my post was edited. Why are the posts edited so roughly? The definition I found for Elf32_Word is "unsigned long int", so I would vote for 4294967295 bytes - 4GB. Aug 12, 2015 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.