This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
LD bug with .def files when producing .exe
- From: Mark Blackburn <marklist at fangorn dot ca>
- To: binutils at sources dot redhat dot com
- Date: Mon, 17 Mar 2003 21:53:52 -0500
- Subject: LD bug with .def files when producing .exe
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