This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Reserving a large address region using the MEMORY directive


Hi,

As part of experiments into making Wine work correctly with exec-shield
and prelink, I'm trying to reserve a 256mb region of address space so the
dynamic linker will not load any DSOs into that area. We need to be able
to mmap files into this area (starting at 0x00400000).

The first attempt at a workaround was to use a 256mb static array in the
BSS and then unmap it, however this caused people with <= 256mb virtual
memory to segfault.

Reading the ld manual, it seems the best way to do this is to use the
MEMORY directive, however I simply get segfaults when a minimal test app
int main() { return 0; } is run. This is the linker script I'm starting
with:

MEMORY {
	before (rwxai) : ORIGIN = 0x000000, LENGTH = 0x400000 
	loadarea       : ORIGIN = 0x400000, LENGTH = 256M
}

I'm sure this doesn't look right, but am I vaguely on the right track?
Does anybody know what the script I need would look like?

thanks -mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]