The small memory model will not do since I want to put data at other
distinct addresses above 4G. I also want to place the heap at yet another
address interval. This way it becomes easy to separate out code, data and
heap references, and making sure that pointers are valid. The primary reason
for not using below 2G or the last 2G, is because such numbers are formed
naturally when doing 32-bit arithmetics, and thus could be executed by
chance from corrupt data.
If I understand it correctly, the PIE option is very similar to the PIC
option, and will not make it possible to use any address for both code and
data.
Additionally, when I tried the small memory model with a start address of
text above 4G, the linker complains about 32-bit fixups overflowing.
Leif Ekblad
----- Original Message -----
From: "H.J. Lu" <hjl.to...@gmail.com>
To: "Leif Ekblad" <l...@rdos.net>
Cc: "GCC Patches" <gcc-patc...@gcc.gnu.org>; "GCC Mailing List"
<gcc@gcc.gnu.org>
Sent: Wednesday, December 12, 2012 9:59 PM
Subject: Re: x86-64 medium memory model
On Wed, Dec 12, 2012 at 12:56 PM, Leif Ekblad <l...@rdos.net> wrote:
I'm working on OS-adaptations for an OS that would use x86-64
applications
that are located above 4G, but not in the upper area. Binutils provide a
function to be able to set the start of text to above 4G, but there are
problems with GCC when using this memory model.
Have you tried PIE with small model? You can place your
binaries above 4G with better performance.
--
H.J.