Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

day5 compilation error #6

Open
zengxinhui opened this issue Jul 29, 2024 · 1 comment
Open

day5 compilation error #6

zengxinhui opened this issue Jul 29, 2024 · 1 comment
Assignees

Comments

@zengxinhui
Copy link

Got this error in archlinux:

gcc -Wall -Wno-format -Wno-unused -std=gnu99 -static -m32 -I ../libc/include -ffunction-sections -nostdlib -nostdinc -fno-builtin -ffreestanding -fno-pie -c ../libc/stdio/stdio.c -o ../libc/stdio/stdio.bin
ld -m elf_i386 --oformat binary -o kernel.sys -T kernel.ld bootpack.bin io.bin pm.bin hankaku.bin ../libc/stdio/stdio.bin
ld: ../libc/stdio/stdio.bin: in function `sprintf':
stdio.c:(.text.sprintf+0x48): undefined reference to `__stack_chk_fail'

Temp workaround is to modify Makefile by adding "-fno-stack-protector" to CFLAGS:
CFLAGS += -ffunction-sections -nostdlib -nostdinc -fno-builtin -ffreestanding -fno-stack-protector

@ghosind ghosind self-assigned this Aug 2, 2024
ghosind added a commit that referenced this issue Aug 5, 2024
Add libssp placeholders to prevent undefined reference error if
stack protector is enabled.

Related to #6.

Signed-off-by: Chen Su <[email protected]>
@ghosind
Copy link
Owner

ghosind commented Aug 9, 2024

Hello, thank you for your issue about this problem.

I've added a stack protector placeholder function, and this issue should be fixed. The -fno-stack-protector option is also a choice to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants