为什么我的 LD 会抱怨无效的 __stack_chk_local_fail_?

问题描述 投票:0回答:0

我正在尝试在 Monjaro (x86-64) 上用 Microsoft VS 代码编译一个操作系统项目,并反复获得以下输出:

gcc -m32 -nostdlib -nodefaultlibs -lgcc start.o libc/string/memcmp.o libc/string/memset.o libc/string/strcat.o libc/string/strchr.o libc/string/strcmp.o libc/string/strcpy.o libc/string/strlen.o libc/string/strncmp.o libc/string/strstr.o libc/string/strutil.o libc/string/ctos.o kernel/tty.o kernel/io.o kernel.o -T linker.ld -o myos
/usr/bin/ld: warning: myos has a LOAD segment with RWX permissions
/usr/bin/ld: kernel/tty.o: in function `putchar':
tty.c:(.text+0x3db): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: kernel/tty.o: in function `printf':
tty.c:(.text+0x573): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: myos: hidden symbol `__stack_chk_fail_local' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:28: myos] Error 1

我可以对我的'''Tty.c'''文件提出任何建议,以免导致 LD 不适吗? 提前致谢!

c makefile ld manjaro
© www.soinside.com 2019 - 2024. All rights reserved.