This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]