-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cannot build xv6 with LLVM #101
Comments
can you give me more detailed information. |
This error appears to be caused by padding in
It's trying to add one byte of padding between A quick-n-dirty workaround is to add an extra \0 to the end of
A more graceful approach would be to figure out why Clang is trying to pad with With that fix in place, I was able to compile xv6-riscv by using the following flags in diff --git a/Makefile b/Makefile
index 328f9c6..a12bb3a 100644
--- a/Makefile
+++ b/Makefile
@@ -50,11 +50,11 @@ endif
QEMU = qemu-system-riscv64
-CC = $(TOOLPREFIX)gcc
-AS = $(TOOLPREFIX)gas
-LD = $(TOOLPREFIX)ld
-OBJCOPY = $(TOOLPREFIX)objcopy
-OBJDUMP = $(TOOLPREFIX)objdump
+CC = clang-12 --target=riscv64
+AS = clang-12 --target=riscv64
+LD = ld.lld-12
+OBJCOPY = llvm-objcopy-12
+OBJDUMP = llvm-objdump-12
CFLAGS = -Wall -Werror -O -fno-omit-frame-pointer -ggdb
CFLAGS += -MD
@@ -63,6 +63,10 @@ CFLAGS += -ffreestanding -fno-common -nostdlib -mno-relax
CFLAGS += -I.
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
+CFLAGS += -Wno-gnu-designator
+
+ASFLAGS = -mno-relax
+
# Disable PIE when possible (for Ubuntu 16.10 toolchain)
ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),)
CFLAGS += -fno-pie -no-pie The
and the |
@jmillikin solution is working |
Hi, I'm using LLVM to build xv6 and when building it, I got this error:
This is my make command
The text was updated successfully, but these errors were encountered: