OSDev.org https://forum.osdev.org/ |
|
Binary and ELF in cygwin https://forum.osdev.org/viewtopic.php?f=1&t=7755 |
Page 1 of 2 |
Author: | srg [ Fri Jan 31, 2003 8:45 am ] |
Post subject: | Binary and ELF in cygwin |
Hi How do I create binary files and ELF executables in cygwin? Thanks |
Author: | DarylD [ Fri Jan 31, 2003 8:51 am ] |
Post subject: | Re:Binary and ELF in cygwin |
The way I did it is this: Download the latest binutils/gcc. Extract binutils (note: you will need bunzip2) ./configure --target=i386-elf make make install Then do similar for gcc-core/gcc. Then you use the i386-elf prefix on the executables. I.e. to run elf gcc use i386-elf-gcc. Works an absolute dream. |
Author: | df [ Fri Jan 31, 2003 12:30 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
i built it with targets all, and just replaced ld.exe with the new one, same for the objcopy/objdump/as/ld etc that get built by binutils. then i just do ld --oformat = elf_i386 |
Author: | srg [ Fri Jan 31, 2003 1:32 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
I get this error when building it: make[1]: *** No rule to make target `../libiberty/libiberty.a', needed by `size. exe'. Stop. make[1]: Leaving directory `/binutils-2.9/binutils' make: *** [install-binutils] Error 2 I have put the binutils folder in my cygwin folder, what have I done wrong? |
Author: | df [ Fri Jan 31, 2003 3:02 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
i unzipped it into my home dir export BISON="/bin/bison.exe" export YACC="/bin/bison.exe -y" (not sure if i did an export for flex as lex or something? mmm i dont rmemeber....) ./configure --enable-targets=all --with-gnu-as --with-gnu-ld --with-stabs |
Author: | srg [ Fri Jan 31, 2003 4:16 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
done that what next |
Author: | df [ Fri Jan 31, 2003 4:41 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
'make' then make install |
Author: | srg [ Sat Feb 01, 2003 12:05 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
done that (it took a long time) copied the files to my bin dir replacing the old ones. When I try this: gcc main.c -o sgoskrnl.exe I get this: /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/bin/ld: cannot fi nd -luser32 collect2: ld returned 1 exit status If I try this: gcc -c main.c ld main.o -o sgoskrnl.exe -m elf_i386 I get this: ld: warning: cannot find entry symbol _start; defaulting to 08048080 main.o(.text+0x23):main.c: undefined reference to `__alloca' main.o(.text+0x28):main.c: undefined reference to `___main' main.o(.text+0x34):main.c: undefined reference to `_printf' What am I doing wrong? |
Author: | Whatever5k [ Sat Feb 01, 2003 12:29 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
The last ouput means that the linker cannot find the functions... Did you include the appropriate headers? |
Author: | df [ Sat Feb 01, 2003 12:48 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
you need to make install not just copy them into the bin directory!! make install puts them in the correct place anyway. if you just copy them you miss the important BFD files ld needs... |
Author: | srg [ Sat Feb 01, 2003 4:35 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
make install doesn't make the slightest bit of difference I'm going to reinstall cygwin |
Author: | srg [ Sat Feb 01, 2003 6:31 pm ] |
Post subject: | Re:Binary and ELF in cygwin |
right, I now have ld running ok my trouble is that my gcc only supports pe I have downloaded gcc 3.2.1 but how would ou recommend that I install it? Thanks |
Author: | df [ Sun Feb 02, 2003 3:06 am ] |
Post subject: | Re:Binary and ELF in cygwin |
well rebuild and make install your binutils again. then when you link, to get elf you can do ld --oformat=elf_i386 -mi386bsd blah.o -o blah.elf |
Author: | srg [ Sun Feb 02, 2003 4:18 am ] |
Post subject: | Re:Binary and ELF in cygwin |
The problem is not with binutils, it's with cygwin's gcc, it only supports pe |
Author: | srg [ Sun Feb 02, 2003 5:54 am ] |
Post subject: | Re:Binary and ELF in cygwin |
I'm having troubles building a new version of gcc with all targets enabled. What lines should I use? |
Page 1 of 2 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |