8

Is this question possibly on-topic for the Unix & Linux Stack Exchange? https://stackoverflow.com/questions/55270381/what-does-segment-starttext-segment-0x400000-represent

It's not exactly a programming question per se, I suppose it's slightly Linux-related because it may have to do with how the OS places executables in memory. It hasn't gotten any comments or answers over at Stack Overflow.

Update: This question was ultimately answered over at Stack Overflow.

12

I think it's probably on topic here, let me explain — you actually seem to be asking several things, and really ought to focus on one thing per question.

  1. You state a goal of reducing executable size by refactoring. That's really a Stack Overflow thing. That is outside our scope here.

  2. You ask to confirm your understanding of linker scripts. This doesn't really seem related to the above (where it seems you only should care about the size of the text segment, not the location). But anyway, expertise about this is mostly on Stack Overflow, too.

  3. You ask a third question: “if I were to run two instances of my compiled a.out executable in parallel, they couldn't both simultaneously occupy the space at 0x400000, right?”. This you could ask here — except I think you'll find it already has been. You probably are having a hard time finding it though, because you seem unaware that userspace programs hardly ever use physical addresses. Each program can have a 0x4000000 because they use virtual addresses (that link is to a search of this site).

I suggest you spend some time reading about virtual memory, then you'll be able to ask much more focused questions — and I think those will be more likely to get good, useful answers on any site.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .