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 ?
perror
  • 19,083
  • 29
  • 87
  • 150
user6903
  • 411
  • 4
  • 11

1 Answers1

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).

  • I assume you meant 4294967295 bytes – Hackndo Aug 10 '15 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 '15 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 '15 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. – Thomas Schmid Aug 12 '15 at 10:57