Date: Wed, 14 Mar 2001 13:14:15 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp AT delorie DOT com Subject: Re: Linking to binary format In-Reply-To: <984559248.3aaf2e90465a3@webmail.cotse.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.)