Mail Archives: djgpp/2001/03/14/08:18:05
On Wed, 14 Mar 2001 wmitty-no-spam AT cotse DOT com wrote:
> then try to link it as a pure binary file (so my bootloader can load it) as
> follows
>
> ld mytest.o -o mytest.bin -oformat binary -Ttext 0x100000 -lc
>
> but this produces the error:
>
> warning: cannot find entry symbol start; defaulting to 00100000
This is self-explaining, no? The linker says that you didn't tell it
the address of the program's entry point. (The "-Ttext 0x100000" defines
the starting address of the .text section, but doesn't say where's the
first instruction to be executed when the program starts.)
> followed by many errors such as:
>
> d:/djgpp/bin/../lib/libc.a(doprnt.o)(.text+0xafd):doprnt.c: undefined
> reference to '___umoddi3'
> d:/djgpp/bin/../lib/libc.a(doprnt.o)(.text+0xb3c):doprnt.c: undefined
> reference to '___udivdi3'
That's because you didn't link against libgcc.a, which defines these
functions. You should use "-lgcc -lc -lgcc" at the end of the link
command, instead of just "-lc".
(You might try linking a normal DJGPP program via "gcc -v", to make the
compiler print the command line it uses to invoke the linker: then you
will see all the magic options it passes to the linker to make it DTRT.)
- Raw text -