MINIX linker - Minix

This is a discussion on MINIX linker - Minix ; In MINIX, both the 'text' and 'data' sections of an executable file are linked at virtual address zero. When the executable is loaded, the base field of the code and data segment descriptors are set to the physical addresses at ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: MINIX linker

  1. MINIX linker


    In MINIX, both the 'text' and 'data' sections of an executable file
    are linked at virtual address zero. When the executable is loaded, the
    base field of the code and data segment descriptors are set to the
    physical addresses at which these sections are loaded.

    Question:

    Is it possible to change this behavior, i.e allow the code and data
    sections to be linked at non-zero virtual addresses? I am looking
    something similar to the --section-start option of the GNU linker.

    Thanks,
    Waqar.

  2. Re: MINIX linker

    > In MINIX, both the 'text' and 'data' sections of an executable file
    > are linked at virtual address zero. When the executable is loaded, the
    > base field of the code and data segment descriptors are set to the
    > physical addresses at which these sections are loaded.
    >
    > Question:
    >
    > Is it possible to change this behavior, i.e allow the code and data
    > sections to be linked at non-zero virtual addresses? I am looking
    > something similar to the --section-start option of the GNU linker.


    If what you care about is the fact that code and data are in different
    address spaces, you can supply the -com switch. This combines the
    segment into a single writable and executable segment.

    If you really need a specific start address, I do not know a switch to
    do that and I do not think it is possible. Since Minix has no VM (more
    accurately: does not use paging), the space before the start would have
    to be allocated in physical memory, which would be wasteful.

    If your problem is that NULL is a valid pointer in Minix: this can be
    very annoying at times, but one has to live with it. If you really need
    an invalid pointer that causes SIGSEGV when dereferenced, use the
    expression (void *) -1 instead.

    --
    With kind regards,
    Erik van der Kouwe

+ Reply to Thread