* LD bug with .def files when producing .exe
@ 2003-03-18 2:53 Mark Blackburn
2003-03-18 7:28 ` [PATCH]Re: " Danny Smith
0 siblings, 1 reply; 3+ messages in thread
From: Mark Blackburn @ 2003-03-18 2:53 UTC (permalink / raw)
To: binutils
This is running on the latest version of cygwin (binutils-20030307-1).
$ cat hello.c
#include <stdio.h>
int main() {
printf("Hello World!\n");
}
$ cat hello.def
NAME HELLO
DESCRIPTION 'Hello World test case'
$ gcc hello.c -o hello
$ ./hello.exe
Hello World!
$ gcc hello.c hello.def -o hello
$ ./hello.exe
bash: ./hello.exe: Permission denied
At this point a windows dialog comes up that says something like this:
Can't load at specified address, file is not relocatable
What appears to be happening is that when ld gets a .def file, it sets
the ImageBase entry of the PE header is getting set to 0x0 whereas it
should be 0x400000 when building a .exe file. I'm guessing that all the
function pointers also start from 0x0 instead of 0x400000 as well.
Mark Blackburn
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH]Re: LD bug with .def files when producing .exe
2003-03-18 2:53 LD bug with .def files when producing .exe Mark Blackburn
@ 2003-03-18 7:28 ` Danny Smith
2003-03-18 14:36 ` Christopher Faylor
0 siblings, 1 reply; 3+ messages in thread
From: Danny Smith @ 2003-03-18 7:28 UTC (permalink / raw)
To: Mark Blackburn, binutils
--- Mark Blackburn <marklist@fangorn.ca> wrote: > This is running on the
latest version of cygwin (binutils-20030307-1).
>
> $ cat hello.c
> #include <stdio.h>
>
> int main() {
> printf("Hello World!\n");
> }
>
> $ cat hello.def
> NAME HELLO
> DESCRIPTION 'Hello World test case'
>
> $ gcc hello.c -o hello
>
> $ ./hello.exe
> Hello World!
>
> $ gcc hello.c hello.def -o hello
>
> $ ./hello.exe
> bash: ./hello.exe: Permission denied
>
>
> At this point a windows dialog comes up that says something like this:
>
> Can't load at specified address, file is not relocatable
>
> What appears to be happening is that when ld gets a .def file, it sets
> the ImageBase entry of the PE header is getting set to 0x0 whereas it
> should be 0x400000 when building a .exe file. I'm guessing that all the
> function pointers also start from 0x0 instead of 0x400000 as well.
>
> Mark Blackburn
Hello
This fixes. Setting to -1 (cf. def_empty() and the defaults in pe.em)
correctly produces the default base address for exe (in def_name) or dll (in
def_library).
The .def file setting can still be overridden by a command-line switch
--image-base <address> or --enable-auto-image-base (for dlls)
Danny
ChangeLog
2003-03-17 Danny Smith <dannysmith@users.sourceforge,net>
defilep.y (opt_base): If no number given, set to default
(-1), not 0.
Index: deffilep.y
===================================================================
RCS file: /cvs/src/src/ld/deffilep.y,v
retrieving revision 1.13
diff -c -3 -p -r1.13 deffilep.y
*** deffilep.y 13 Mar 2003 09:39:09 -0000 1.13
--- deffilep.y 18 Mar 2003 05:26:51 -0000
*************** opt_equal_name:
*** 236,242 ****
;
opt_base: BASE '=' NUMBER { $$ = $3;}
! | { $$ = 0;}
;
dot_name: ID { $$ = $1; }
--- 236,242 ----
;
opt_base: BASE '=' NUMBER { $$ = $3;}
! | { $$ = -1;}
;
dot_name: ID { $$ = $1; }
http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]Re: LD bug with .def files when producing .exe
2003-03-18 7:28 ` [PATCH]Re: " Danny Smith
@ 2003-03-18 14:36 ` Christopher Faylor
0 siblings, 0 replies; 3+ messages in thread
From: Christopher Faylor @ 2003-03-18 14:36 UTC (permalink / raw)
To: binutils
On Tue, Mar 18, 2003 at 06:28:20PM +1100, Danny Smith wrote:
>ChangeLog
>
>2003-03-17 Danny Smith <dannysmith@users.sourceforge,net>
>
> defilep.y (opt_base): If no number given, set to default
> (-1), not 0.
Please check in.
cgf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-03-18 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-18 2:53 LD bug with .def files when producing .exe Mark Blackburn
2003-03-18 7:28 ` [PATCH]Re: " Danny Smith
2003-03-18 14:36 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).