linker problem ? help needed !!!
Dear all , first of all thanks a lot for providing such a wonderful tools 'gcc' and 'ld'. i am trying to link some object files but i am getting error "System cant execute this program" i cant understand the reason because there is no appropriate descriptive error message. Pls suggest me . also tell me how to enable warnings etc. with the linker. thanks, navi ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
Re: linker problem ? help needed !!!
Hi Nick, Thank you very much. Your solution is wonderful. I got desired results. I made my development scripts simpler. Can you give me one more suggestion. I want to compile multiple files C and C++ and link with gcc. Is there any way. Thanks, Navi - Original Message - From: Nick Clifton <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: bug-binutils@gnu.org Sent: Tue, 22 Jul 2008 13:02:51 +0530 (IST) Subject: Re: linker problem ? help needed !!! Hi Navi, > Thanks for your prompt reply. You're welcome. Please keep the CC line though as other people may be interested in this problem and its solution. > I have figured out the reason for the error. > Because the length of following command : > ld -v -T ../SRC\link.ld -o kernel.sys kernel.o ckernel.o Interrupts.o > common.o idt.o isr.o stdio.o timer.o keyboad.o Kernelheap.o paging.o > [...] > But this is a temporary solution , what will i do when i have to link > a lot of object files(30 to 40 , for exmaple) , as the project > grows in future. Assuming that you are using a relatively recent version of the linker you can use the @ feature to put all of the object filenames into a single text file called . eg: echo kernel.o ckernel.o Interrupts.o common.o idt.o isr.o stdio.o timer.o keyboad.o Kernelheap.o paging.o > object_files ld -v -T ../SRC/link.ld -o kernel.sys @object_files Cheers Nick ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
Re: linker problem ? help needed !!!
Hi Nick, I am little confused by your suggestion, how will I specify the file extension .o for each object file. my present script is as follows : C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\KERNEL.asm-o C:\STOIC\DEVELOPMENT\OUTPUT\KERNEL.o C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\IntDefs.asm -o C:\STOIC\DEVELOPMENT\OUTPUT\IntDefs.o gcc -c ckernel.c -o ../../OUTPUT\CKernel.o -I.\include gcc -c common.c -o ../../OUTPUT\Common.o-I.\include gcc -c IDT.c -o ../../OUTPUT\IDT.o -I.\include gcc -c isr.c -o ../../OUTPUT\isr.o -I.\include gcc -c stdio.c-o ../../OUTPUT\std.o -I.\include gcc -c GUI.c -o ../../OUTPUT\GUI.o -I.\include gcc -c Graphics.c -o ../../OUTPUT\Graphics.o -I.\include gcc -c Timer.c-o ../../OUTPUT\Timer.o-I.\include gcc -c keyboard.c -o ../../OUTPUT\keyboard.o -I.\include gcc -c KrnlHeap.c -o ../../OUTPUT\KrnlHeap.o -I.\include gcc -c Paging.c -o ../../OUTPUT\Paging.o-I.\include pause Can u suggest the enhancements now. Thanks a lot for your prompt responses. Regards, navi - Original Message - From: Nick Clifton <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: bug-binutils@gnu.org Sent: Tue, 22 Jul 2008 17:03:43 +0530 (IST) Subject: Re: linker problem ? help needed !!! Hi Navi, > I want to compile multiple files C and C++ and link with gcc. > Is there any way. Presumably you mean using the @ linker command line option to avoid having problems with excessively long command lines ? Then the answer is yes. Like this: gcc -c foo.c bar.cc echo foo.o bar.o > files.list gcc -Wl,@files.list -o myprog I just picked "foo.c" and "bar.cc" as random source file names, but I hope that this makes the idea clear. Cheers Nick ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
Re: linker problem ? help needed !!!
Hi nick, thanks for ur idea i looks gr8 i have one question can we do something like gcc - c @list_of_C_source_file ../../[EMAIL PROTECTED] is there any way to do such thing. Also , i think i can compile .asm files programmed for NASM , with gcc !!! thanks & regards, navi - Original Message - From: Nick Clifton <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: bug-binutils@gnu.org Sent: Wed, 23 Jul 2008 17:13:50 +0530 (IST) Subject: Re: linker problem ? help needed !!! Hi Navi, > I am little confused by your suggestion, > how will I specify the file extension .o for each object file. > > my present script is as follows : > > C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\KERNEL.asm-o > C:\STOIC\DEVELOPMENT\OUTPUT\KERNEL.o > C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\IntDefs.asm -o > C:\STOIC\DEVELOPMENT\OUTPUT\IntDefs.o > > gcc -c ckernel.c -o ../../OUTPUT\CKernel.o -I.\include > gcc -c common.c -o ../../OUTPUT\Common.o-I.\include > gcc -c IDT.c -o ../../OUTPUT\IDT.o -I.\include > gcc -c isr.c -o ../../OUTPUT\isr.o -I.\include > gcc -c stdio.c-o ../../OUTPUT\std.o -I.\include > gcc -c GUI.c -o ../../OUTPUT\GUI.o -I.\include > gcc -c Graphics.c -o ../../OUTPUT\Graphics.o -I.\include > gcc -c Timer.c-o ../../OUTPUT\Timer.o-I.\include > gcc -c keyboard.c -o ../../OUTPUT\keyboard.o -I.\include > gcc -c KrnlHeap.c -o ../../OUTPUT\KrnlHeap.o -I.\include > gcc -c Paging.c -o ../../OUTPUT\Paging.o-I.\include > pause > Can u suggest the enhancements now. How about: C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\KERNEL.asm-o C:\STOIC\DEVELOPMENT\OUTPUT\KERNEL.o C:\STOIC\DEVELOPMENT\BIN\nasm -f aout .\asm\IntDefs.asm -o C:\STOIC\DEVELOPMENT\OUTPUT\IntDefs.o gcc -c ckernel.c -o ../../OUTPUT\CKernel.o -I.\include gcc -c common.c -o ../../OUTPUT\Common.o-I.\include gcc -c IDT.c -o ../../OUTPUT\IDT.o -I.\include gcc -c isr.c -o ../../OUTPUT\isr.o -I.\include gcc -c stdio.c-o ../../OUTPUT\std.o -I.\include gcc -c GUI.c -o ../../OUTPUT\GUI.o -I.\include gcc -c Graphics.c -o ../../OUTPUT\Graphics.o -I.\include gcc -c Timer.c-o ../../OUTPUT\Timer.o -I.\include gcc -c keyboard.c -o ../../OUTPUT\keyboard.o -I.\include gcc -c KrnlHeap.c -o ../../OUTPUT\KrnlHeap.o -I.\include gcc -c Paging.c -o ../../OUTPUT\Paging.o-I.\include echo ../../OUTPUT\*.o > files gcc -Wl,@files -o stoic.exe pause Cheers Nick ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils