GNU gclib

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

GNU gclib

Post by kenneth_phough »

Would it be a huge burden to port gnu gclib to my OS? The reason I'm asking is because I'm having trouble with my home-made printf() function (called sysprint()) and I've read things about printf() that it uses other functions in the c library which make it hard to port so it's better to write your own, but I thought I might just port the whole thing.

Cheers,
Kenneth
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Post by Legend »

If you want your OS to feel like yet another *nix ... go ahead, that is a huge step in that direction.

I think it will be depedant on some device files and syscalls that are typical for *nix systems.
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

Post by joke »

http://www.cs.utah.edu/dept/old/texinfo ... .html#SEC3
here is the portability chapter.
On the same site go table of contents and you'll find anything you need :wink:

Best Regards
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

It might be worthwhile to check out other open source libc implementations before you make your decision.

For example, uClibc (http://uclibc.org/) and pdLibc (which, for the life of me, I can't currently find a link for... hopefully someone can add this in!). These implementations might be smaller/easier to port (ldLibc is not currently finished, however).

--Jeff
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

Thank you very much for the resources.

Thanks,
Kenneth
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

trouble with compiling...

Post by kenneth_phough »

I'm trying to configure the glibc with i386-force_CPU386-none and it asks for the release number of my OS. So I enter what I think is the release number and says that it doesn't recognize it so it asks for the version number next, so I enter the version then it says that it has configured it. So I type make and wait for my computer to make the glibc files but its stops because of an error in start.s. I can't seem to figure out why this is happening, maybe because I entered the wrong release number. Would anyone know what might be the problem?

Thanks,
Kenneth
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

It would help to show us what error happens ;)
The source of my problems is in the source.
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

your right...sorry about that, wasn't thinking. :oops:

the following are the errors I got:
as sysdeps/standalone/i386/start.s -o start.o
sysdeps/standalone/i386/start.s: Assembler messages:
sysdeps/standalone/i386/start.s:106: Warning: using `%cx' instead of `%ecx' due to `w' suffix
sysdeps/standalone/i386/start.s:144: Warning: using `%cx' instead of `%ecx' due to `w' suffix
sysdeps/standalone/i386/start.s:268: Error: junk at end of line, first unrecognized character is `¥'
sysdeps/standalone/i386/start.s:269: Error: bad or irreducible absolute expression
sysdeps/standalone/i386/start.s:269: Error: junk at end of line, first unrecognized character is `¥'
sysdeps/standalone/i386/start.s:270: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:273: Error: junk at end of line, first unrecognized character is `¥'
sysdeps/standalone/i386/start.s:274: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:284: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:285: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:287: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:288: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:298: Error: junk at end of line, first unrecognized character is `¥'
sysdeps/standalone/i386/start.s:299: Error: junk at end of line, first unrecognized character is `¥'
sysdeps/standalone/i386/start.s:300: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:301: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:302: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:304: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:305: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:307: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:308: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:309: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:310: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:312: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:313: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:321: Error: invalid character '_' in mnemonic
sysdeps/standalone/i386/start.s:322: Error: invalid character '_' in mnemonic
make: *** [start.o] Error 1

Thanks,
Kenneth

P.S. I was able to compile uClibc but I haven't tried it out with my OS yet so I'm not sure if it will work.

[EDIT] I failed to link uClibc to my OS :oops:
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

You're not just trying to compile libc and link it into an app as stock, are you?

In any event, those assembler messages make me think your source file is corrupted... definitly doesn't seem right to have a yen symbol in the middle of your asm.

Is the file intact? What do the offending lines in the asm look like?

--Jeff
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Post by bubach »

Here's something that might help:
http://my.execpc.com/~geezer/osd/libc/printf.c
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

I don't see any ¥ sign in the source code start.s! Now, that's wierd.
I wonder if this is the source of the problem:
Because I haven't had the time to find an atheros wireless driver for my SuSE linux on my Toshiba I use my iBook to download soures, etc. and use my memory stick to move it over to my linux. Could this be the reason?
Also, when I checked start.s, I checked it in Xcode on my Mac and also with Kate on Linux.

@bubach
Thanks for the link! There is only one problem with that. When I compile my source code I tell gcc that there is no standard includes and that I have my own include files, so if I put #include <stdio.h> I would get an error saying no such file.

This is how I compile my source code:
for assembly files:
nasm -f aout mem.asm -o mem_a.o

c files:
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o kernel.o kernel.c

and I link them:
ld -T link.ld -o kernel.bin kernel_entry.o kernel.o screen.o message.o mem_a.o mem_c.o init.o gdt.o isr.o idt.o irq_a.o irq_c.o timer.o handler.o

*I don't know how I can link a standard library to my kernel. :oops:

Thanks,
Kenneth
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Post by bubach »

Oh, as it's from an OSdev site I didn't think it would need any includes I didn't check.. :oops:
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

Maybe I should study how printf works in detail and more about C Libraries before I tackle it. 8)
I just really needed a way to print integers! Tried to implement a itoa() functions but failed. :oops:

Thanks for the help everyone!

Cheers,
Kenneth
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

kenneth_phough wrote:I don't see any ¥ sign in the source code start.s! Now, that's wierd.
I wonder if this is the source of the problem:
Because I haven't had the time to find an atheros wireless driver for my SuSE linux on my Toshiba I use my iBook to download soures, etc. and use my memory stick to move it over to my linux. Could this be the reason?
Also, when I checked start.s, I checked it in Xcode on my Mac and also with Kate on Linux.
Sounds like it could be a line-end problem, then. Apple and Linux/Unix use different characters to terminate lines. When copying files to/from these OSs character 10 and 13 should be interchanged.

Linux used to have utils called 'todos' and 'fromdos' which would change the EOL characters when converting to/from DOS (obv.)... there might also be utils 'tomac' and 'frommac' (or similar). If not... easy enough to write... or just use a search and replace from an editor.

What format filesystem is on the stick? Does Apple support auto-conversion of text files when copying from filesystem to filesystem? Linux does...

--Jeff
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

carbonBased wrote:What format filesystem is on the stick?
FAT16
carbonBased wrote:Does Apple support auto-conversion of text files when copying from filesystem to filesystem? Linux does...
I'm not sure, not something I heard of. :? Let me check...

Cheers,
Kenneth
Post Reply