Controlling address space layout of dynamic loading

Is it possible (in Linux / OSX) to control how shared libraries are mapped in memory after loading? Is it possible to malloc a contiguous region of memory, and pass that to a routine such as "dlopen"? I do not insist on precise placement of the various segments (.text, .bss, etc.) within the malloc'd region, but only that all the segments are placed within the malloc'd region.

Answers


Is it possible (in Linux / OSX) to control how shared libraries are mapped in memory after loading?

I don't know much about OSX, so I'll answer only the Linux part.

Not without modifying the dynamic loader, no.

Is it possible to malloc a contiguous region of memory, and pass that to a routine such as "dlopen"?

malloc will not give you page-alignment required for that. posix_memalign will, but you will likely be better off just doing direct mmap(..., MAP_FIXED, ...). You are asking for implementation of this feature request (nobody's done it yet).


Need Your Help

Include list items in SharePoint workflow notification

email workflow

The sharepoint environment i work has some restricted functionality. What I want to achieve is to send out alerts or notifications whenever a new list item is created to an email. Trouble is we wan...