Tuesday, July 20, 2010

Error: bad register name %sil

while compiling linux kernel 0.0.1 on lucid lynx or debian sid with gcc 4.4.4 i've got this error message
http://portabilityblog.com/blog/archives/11-Bad-register-name-dil-or-sil.html

how i fixed in asm/segment.h ? i have changed the registers used in function from "r" to "q"
so i limit the register usage only for general ones EAX, EBX, ECX and EDX

extern inline void put_fs_byte(char val,char *addr)
{
__asm__ ("movb %0,%%fs:%1"::"q" (val),"m" (*addr));
}

what is the next error ?


ld -s -x -M -Ttext 0 -e startup_32 boot/head.o init/main.o \
kernel/kernel.o mm/mm.o fs/fs.o \
lib/lib.a \
-o tools/system > System.map
kernel/kernel.o: In function `scrup':
console.c:(.text+0x1ea4): undefined reference to `columns'
console.c:(.text+0x1f6c): undefined reference to `columns'
kernel/kernel.o: In function `scrdown':
console.c:(.text+0x1fc5): undefined reference to `columns'

3 comments:

Kuldeep Singh said...

Even i am getting the same under ubuntu gcc 4.4.5

console.c:(.text+0x1ea4): undefined reference to `columns'

Could you find the fix for it ?

Regards
Kuldeep

Popa Adrian Marius said...

Abdel solved somehow the issue it compiles still it doesn't boot yet
the asm generated is different
so i will try to make it work and declare columns to be global

-----------------------------------
Hello

Yes I know about this error.
I have to do something ...
I'm currently in vacation, and I don't have internet (and not even a
computer), so I wil try to do somethign later.
The probem you got came from gcc asm change.
If I remember, the variable columns is declared as static, so you
should remove the static word, so that columns wil be a global
variable.
This is a quick work arround and it should work
----------------------------------
regards
Abdel at gmail

40tude said...

Bonjour,
Thanks a lot for the time spent and the various update.

I tried to play with the files today. Looking for a solution to the "../include/asm/segment.h:27: Error: bad register name `%sil'" error message I found this blog.

However, compiling the linux-0.01-rm-3.5 kernel I aloso get the following warning messages :

../include/string.h:405: warning: conflicting types for built-in function ‘memchr’

I use gcc 4.4.5
Ubuntu Maverick 2.6.35-28-generic 32 bits

Any idea ?
Should I put the -fno-builtin gcc parameter somewhere ?

Best regards, Philippe