Просмотр исходного кода

add LLVM/clang-3.5+ support

main
chyyuu 10 лет назад
Родитель
Сommit
52d573e68a
9 измененных файлов: 148 добавлений и 68 удалений
  1. +7
    -0
      README
  2. +15
    -5
      labcodes/lab1/Makefile
  3. +17
    -8
      labcodes/lab2/Makefile
  4. +18
    -9
      labcodes/lab3/Makefile
  5. +18
    -9
      labcodes/lab4/Makefile
  6. +18
    -9
      labcodes/lab5/Makefile
  7. +18
    -9
      labcodes/lab6/Makefile
  8. +18
    -9
      labcodes/lab7/Makefile
  9. +19
    -10
      labcodes/lab8/Makefile

+ 7
- 0
README Просмотреть файл

@ -86,6 +86,13 @@ OR
6 handin your code
$make handin
OPTION
==============
Now, ucore suuport LLVM/Clang-3.5 +
in step4:
$ USELLVM=1 make
then you will use clang to compile ucore
GRADE/RANK
==========
Superman: Finish all OS labs in one month by yourself

+ 15
- 5
labcodes/lab1/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
then echo 'qemu'; exit; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,13 +44,20 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 17
- 8
labcodes/lab2/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 18
- 9
labcodes/lab3/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 18
- 9
labcodes/lab4/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 18
- 9
labcodes/lab5/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 18
- 9
labcodes/lab6/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 18
- 9
labcodes/lab7/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

+ 19
- 10
labcodes/lab8/Makefile Просмотреть файл

@ -4,7 +4,8 @@ SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
#need llvm/cang-3.5+
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
@ -23,10 +24,12 @@ endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
elif which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
@ -41,15 +44,21 @@ endif
.DELETE_ON_ERROR:
# define compiler and flags
ifndef USELLVM
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2 -D_FILE_OFFSET_BITS=64
GDB := $(GCCPREFIX)gdb
CC ?= $(GCCPREFIX)gcc
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
else
HOSTCC := clang
HOSTCFLAGS := -g -Wall -O2
CC := $(GCCPREFIX)clang
CFLAGS := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
endif
GDB := $(GCCPREFIX)gdb
CTYPE := c S
LD := $(GCCPREFIX)ld

Загрузка…
Отмена
Сохранить