Mail Archives: djgpp/1996/11/27/03:39:50
As promised yesterday, here are the results of a few experiments with
objcopy, and a.out format.
I tested all of this on a *very* simple "Hello world" program, namely
#include <stdio.h>
int main(void)
{
printf("Hello world\n");
return 0;
}
I compiled it using
gcc -o hello.o -c hello.c
at this stage I get a COFF format hello.o object
when I link it (gcc -o hello.exe hello.o) everything runs allright
Then I tried using objcopy, to change my hello.o COFF object into an
a.out object (which, the manual says, DJGPP ld also understands).
The command line was
objcopy -O a.out-i386 hello.o hello2.o
I then tried to link
gcc -o hello2.exe hello2.o
so far so good, except that the resulting program crashed on a SIGSEV
fault.
Then, I tried to translate hello2.o back to coff format, saying
objcopy -O coff-go32 hello2.o hello3.o
-> obj copy complained at this point about aoutx.h (a file in the BFD
source)
and then I tried to rebuild hello3.exe, it worked, but the resulting
program also crashed.
To me, this is a problem with the implementation of a.out in BFD... Or
did I do something wrong using objcopy?
Francois
- Raw text -