reserving memory below 16MB

R. Matthew Emerson rme@clozure.com
Tue Oct 6 00:29:00 GMT 2009


On 32-bit x86 systems, I would like to ensure that no dynamically  
allocated block of memory (obtained via malloc or mmap) will start  
below 2^24 (16 MB). See [1] below for why I want to do this.

I wonder if there is some way (assembler directives, linker commands)  
that I could do this.  That is, is there a way to say "make the text  
section 16MB long" or some other way to say "take up the rest of the  
space below 16MB."

If I have to use a custom linker script, then I suppose I must, but  
I'm a little worried that would make it harder to compile the program  
on different Linux distributions with potentially different library  
search paths.

I would be grateful for any suggestions.


[1]  This is for a Common Lisp compiler and runtime.  If I can  
guarantee that lisp objects will never be found below 16MB, then the  
garbage collector will know that any value less than 2^24 is just some  
unboxed value.  This would allow me to store such values in registers  
that are treated as gc roots---this would be helpful on 32-bit x86  
systems, where registers are scarce.



More information about the Binutils mailing list