I have had to restart my kernel which included rebuilding my development system. I have built a new cross-compiler from binutils 2.25 and gcc 5.1.0. I was able to salvage an earlier version of my printf() function which I knew to have worked properly in a 386 kernel. My cross compiler is built for i686-elf.
I have been looking at the resulting binaries and object files and have noticed that when the printf() function is called, the compiler strips the terminating '\n' character from the string, in particular with the following code:
Code: Select all
printf("Hello, world!\n");
If I change the code to use my own puts() function, the '\n' character remains and is printed properly. If I rename my printf() function to kprintf(), then the '\n' character remains and is printed properly. No other changes are made to have this character remain in the resulting object.
This is the command I am using to compile the source to .o: i686-elf-gcc -c -O2 -g -ffreestanding -fbuiltin -Wall -Wextra -I/home/adam/src/century/isodir/usr/local/include -o obj/kernel.o kernel.c
I can also confirm that the problem exists at the object file before the objects are linked. I did try to remove the -O2 option which changed nothing.
This seems to be a compiler problem, but I am looking to see if anyone can confirm. Or am I doing something ridiculous?
Thanks in advance for your input.
Adam