delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/05/01:31:48

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199911050530.XAA03616@mercury.xraylith.wisc.edu>
To: "Jon Leichter" <jon AT symas DOT com>
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Specifying a base address
In-Reply-To: Your message of "Thu, 04 Nov 1999 20:54:02 PST."
<000001bf2749$c7e9afe0$a0418218 AT bass DOT we DOT mediaone DOT net>
Date: Thu, 04 Nov 1999 23:30:11 -0600
From: Mumit Khan <khan AT thor DOT xraylith DOT wisc DOT edu>

"Jon Leichter" <jon AT symas DOT com> writes:
> Forgive me if this has been asked before. I searched the archives but didn't
> come up with an answer.
> 
> With the Cygwin set of compiler utilities, how does one go about setting the
> base image address for a DLL?

Pass the --image-base=<BASE_ADDR> to the linker. If you're using GCC to
create the DLL, use -Wl,--image-base=<BASE_ADDR>
  
  $ gcc -Wl,--image-base=0x66000000 [... rest ...]

> Is there a particular tool that I can use to change the base image address
> after the DLL is built? For instance, MSVC provides a tool called EDITBIN tha
> t
> does just that. (By the way, I tried to use EDITBIN on a DLL that I built wit
> h
> gcc, and EDITBIN failed).

EDITBIN has always worked for me, so perhaps something is wrong with the
DLL (eg,. due to a bug in the linker)? There's also REBASE, but I've never
used it.

> If there is no tool, is there a way to specify the base address at link time?
> Do I need to provide a .def file for this?

You can use a .DEF file, but I prefer either (1) using dllwrap, which
takes an --image-base parameter, and if not supplied, creates an image
base by hashing the output filename, or (2) supply -Wl,--image-base to
GCC or --image-base to the linker. See the documentation on the linker
(ld) for more info.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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