Page 1 of 1

undefined reference to `__stack_chk_fail' [solved]

Posted: Sat Mar 21, 2009 4:42 am
by Srowen
hello,

i've got a problem while i try to link my kernel. in some functions, i've go the follow error message:

Code: Select all

tmp/stdio.o: In function `printf_i':
stdio.c:(.text+0x1a9): undefined reference to `__stack_chk_fail'
what does it mean?
i'm using gcc on ubuntu...

Re: undefined reference to `__stack_chk_fail'

Posted: Sat Mar 21, 2009 4:49 am
by JamesM
add -fno-stack-protector to your CFLAGS.

Re: undefined reference to `__stack_chk_fail'

Posted: Sat Mar 21, 2009 5:31 am
by Srowen
thanks... now it runs..but... why? any explanation of this error?

Re: undefined reference to `__stack_chk_fail'

Posted: Sat Mar 21, 2009 10:30 am
by Firestryke31
GCC likes to do a bunch of stuff behind the scenes. It's great for application programming because all of the runtime support is already there, unfortunately in OS development you have to make the runtime support yourself. Using that flag tells GCC to not to do some of that stuff behind the scenes, so you don't have to write the stuff until much later where you have an idea as to what you need and how to do it.

Re: undefined reference to `__stack_chk_fail'

Posted: Sat Mar 21, 2009 2:09 pm
by Srowen
thank's a lot.. :mrgreen: :mrgreen: