Kernel compilation error on UbuntuLinux _ stack_chk_fail

Source: Internet
Author: User
Kernel compilation error on UbuntuLinux _ stack_chk_fail -- Linux general technology-Linux programming and kernel information. The following is a detailed description. Init/built-in.o: In function 'try _ name ':
Do_mounts.c.text + 0x5e3): Reference to '_ stack_chk_fail' undefined
Init/built-in.o: In function 'name _ to_dev_t ':
(. Text + 0x8cb): Undefined reference to '_ stack_chk_fail'
Init/built-in.o: In function 'change _ floppy ':
(. Init. text + 0xa11): Undefined reference to '_ stack_chk_fail'
Init/built-in.o: In function 'mount _ block_root ':
(. Init. text + 0xca7): an undefined reference to '_ stack_chk_fail'
Init/built-in.o: In function 'do _ header ':
Initramfs. c. init. text + 0x4343): Undefined reference to '_ stack_chk_fail'
Arch/i386/kernel/built-in.o.text + 0x54c6): more undefined references to '_ stack_chk_fail' follow
Make [1]: *** [. tmp_vmlinux1] Error 1
Make [1]: Leaving directory '/usr/src/linux-2.6.17.10'
Make: *** [debian/stamp-build-kernel] Error 2

Find the CFLAGS In The Makefile on the top layer and add the-fno-stack-protector flag!

In fact, this is a compilation option passed to GCC.

-The fno-stack-protector parameter is used to disable Stack-smashing protection.

In Ubuntu 6.10, gcc uses the-fstack-protector parameter by default for compilation, which is unfriendly.

It is not convenient to debug the program, because coredump is not generated when the program is down, and only the following

Program received signal SIGABRT, Aborted.
0xffffe410 in _ kernel_vsyscall ()

Try not to use GCC 4.2 to compile old programs, and there will be strict C-standard verification after 4.2, which is very troublesome.

GCC 4.2 has the following problems:

Use the default compilation option in 4.2

Int main ()
{
Char * t = "Testing! ";
Fprintf (stdout, "% s", t );
Return 0;
}

Warning: deprecated conversion from string constant to 'Char *'

If you change char * to static const char *, this Warning will not appear. It is estimated that the next generation of GCC is afraid that programmers may encounter cross-border operation errors if they do not pay attention when using char * in the code, so a small warning is provided.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.