delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/05/18/20:57:49

From: Mat Hostetter <iclone!mjhostet AT cs DOT unm DOT edu>
Date: Tue, 18 May 93 17:45:32 -0600
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Relocating text segment doesn't work
Reply-To: iclone!mit.edu!mjhostet AT cs DOT unm DOT edu

I'm cross-compiling to go32 from Unix (NeXT), using gcc, GNU binutils  
and the GNU assembler.  The setup works well.

GNU ld lets you say "-Ttext 400000" to relocate the text segment up  
to 0x400000.  "nm" from the Unix side of things is happy with this,  
and shows all of the symbol addresses adjusted upwards by 4  
megabytes.  [Interestingly, the "ld" shipped with djgpp won't allow  
this relocation, complaining that the address is not a multiple of  
the page size (!), and the djgpp nm doesn't understand the relocated  
a.out generated from the Unix side.]

When I try to go32 the a.out with the relocated text segment under  
go32, the program *immediately* crashes with the PC at the location  
where I placed the text segment (in this case, 0x400000).  Even int  
main(){return 0;} dies.

Perhaps those of you using the Sparc cross-compilation tools (just  
announced on this list) can generate the same problem.

For what it's worth, I need to end up with addresses 0-0x3FFFFF  
read/writable by my program, with the text/data/bss segments  
relocated anywhere above this area.

Any comments would be greatly appreciated.

-Mat

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019