This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

L251: Segments allocation

Hi,

For illustrating my problem let say that I have 3 address spaces, separated by some gaps, which are used to allocate EDATA and NCONST segments. According to the order, EDATA are allocated firstly and then NCONST ones.
Say that EDATA fill first and half of the second address spaces. Now I have a fairly large NCONST segment (file which collects a lot of const variables) which doesn't fit into 2nd address space and also is a bit too big for last one; which results in address space overflow error.
Why linker doesn't split this segment to put one part into second address space and second part into 3rd space. Does it have to occupy continuous memory block?

Parents
  • Likely the linker can't fix things the code generator put in the object file. If the Sections/Segments in the object file get coalesced then they won't separate. In other architectures this tends to get resolved by breaking functions to files, or telling the code generator to create a unique section/segment for each function, or putting multiple objects in a library. The linker then has the role of dead code elimination.

Reply
  • Likely the linker can't fix things the code generator put in the object file. If the Sections/Segments in the object file get coalesced then they won't separate. In other architectures this tends to get resolved by breaking functions to files, or telling the code generator to create a unique section/segment for each function, or putting multiple objects in a library. The linker then has the role of dead code elimination.

Children
No data