kernel: make clang-buildable
This commit is contained in:
parent
08c8ee9f52
commit
daa14edc0d
|
@ -21,22 +21,27 @@ CFLAGS += -D__kernel__
|
||||||
.if ${COMPILER_TYPE} == "ack"
|
.if ${COMPILER_TYPE} == "ack"
|
||||||
LDFLAGS+= -.o
|
LDFLAGS+= -.o
|
||||||
.elif ${COMPILER_TYPE} == "gnu"
|
.elif ${COMPILER_TYPE} == "gnu"
|
||||||
CPPFLAGS+= -ffreestanding -fno-stack-protector
|
|
||||||
.if ${OBJECT_FMT} == "ELF"
|
|
||||||
LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel_elf.lds
|
|
||||||
.else
|
|
||||||
LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel.lds
|
|
||||||
.endif
|
|
||||||
LDFLAGS+= -nostdlib -L${LIBDIR}
|
|
||||||
CFLAGS+=-march=i386
|
CFLAGS+=-march=i386
|
||||||
|
CPPFLAGS+= -ffreestanding -fno-stack-protector
|
||||||
|
LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel.lds
|
||||||
|
LDFLAGS+= -nostdlib -L${LIBDIR}
|
||||||
|
.endif
|
||||||
|
|
||||||
.if (${NBSD_LIBC} != "no")
|
.if (${NBSD_LIBC} != "no")
|
||||||
LDADD+= -lminlib
|
LDADD+= -lminlib
|
||||||
DPADD+= ${LIBMINLIB}
|
DPADD+= ${LIBMINLIB}
|
||||||
CPPFLAGS+= -D_NETBSD_SOURCE
|
CPPFLAGS+= -D_NETBSD_SOURCE
|
||||||
.else
|
.else
|
||||||
|
|
||||||
|
.if ${CC} == "gcc"
|
||||||
DPADD+= ${LIBC}
|
DPADD+= ${LIBC}
|
||||||
LDADD+= -lgcc -lc -lgcc
|
LDADD+= -lgcc -lc -lgcc
|
||||||
|
.elif ${CC} == "clang"
|
||||||
|
DPADD+= ${LIBC}
|
||||||
|
LDADD+= -L/usr/pkg/lib
|
||||||
|
LDADD+= -lCompilerRT-Generic -lc -lCompilerRT-Generic
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
||||||
|
|
|
@ -2,12 +2,7 @@ OUTPUT_ARCH("i386")
|
||||||
ENTRY(MINIX)
|
ENTRY(MINIX)
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0x0;
|
. = 0x200000 + SIZEOF_HEADERS;
|
||||||
_text = .;
|
|
||||||
begtext = .;
|
|
||||||
.text.head . : AT (0x0) {
|
|
||||||
*(.text.head)
|
|
||||||
}
|
|
||||||
.text . : AT (ADDR(.text) - 0x0000) {
|
.text . : AT (ADDR(.text) - 0x0000) {
|
||||||
*(.text)
|
*(.text)
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
@ -16,8 +11,6 @@ SECTIONS
|
||||||
_etext = .;
|
_etext = .;
|
||||||
etext = .;
|
etext = .;
|
||||||
|
|
||||||
_data = .;
|
|
||||||
begdata = .;
|
|
||||||
.data . : AT (ADDR(.data) - 0x0000) {
|
.data . : AT (ADDR(.data) - 0x0000) {
|
||||||
_rodata = .;
|
_rodata = .;
|
||||||
/* kernel data starts with this magic number */
|
/* kernel data starts with this magic number */
|
||||||
|
@ -27,17 +20,15 @@ SECTIONS
|
||||||
_erodata = .;
|
_erodata = .;
|
||||||
*(.data)
|
*(.data)
|
||||||
*(.data.*)
|
*(.data.*)
|
||||||
|
. = ALIGN(4096);
|
||||||
}
|
}
|
||||||
_edata = .;
|
_edata = .;
|
||||||
_bss = .;
|
|
||||||
begbss = .;
|
|
||||||
.bss . : AT (ADDR(.bss) - 0x0000) {
|
.bss . : AT (ADDR(.bss) - 0x0000) {
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss.*)
|
*(.bss.*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
}
|
}
|
||||||
_ebss = .;
|
|
||||||
endbss = .;
|
|
||||||
_end = .;
|
_end = .;
|
||||||
end = .;
|
end = .;
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
OUTPUT_ARCH("i386")
|
|
||||||
ENTRY(MINIX)
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
. = 0x200000 + SIZEOF_HEADERS;
|
|
||||||
.text . : AT (ADDR(.text) - 0x0000) {
|
|
||||||
*(.text)
|
|
||||||
*(.text.*)
|
|
||||||
. = ALIGN(4096);
|
|
||||||
}
|
|
||||||
_etext = .;
|
|
||||||
etext = .;
|
|
||||||
|
|
||||||
.data . : AT (ADDR(.data) - 0x0000) {
|
|
||||||
_rodata = .;
|
|
||||||
/* kernel data starts with this magic number */
|
|
||||||
SHORT(0x526f);
|
|
||||||
*(.rodata)
|
|
||||||
*(.rodata.*)
|
|
||||||
_erodata = .;
|
|
||||||
*(.data)
|
|
||||||
*(.data.*)
|
|
||||||
. = ALIGN(4096);
|
|
||||||
}
|
|
||||||
_edata = .;
|
|
||||||
|
|
||||||
.bss . : AT (ADDR(.bss) - 0x0000) {
|
|
||||||
*(.bss)
|
|
||||||
*(.bss.*)
|
|
||||||
*(COMMON)
|
|
||||||
}
|
|
||||||
_end = .;
|
|
||||||
end = .;
|
|
||||||
|
|
||||||
/DISCARD/ :
|
|
||||||
{
|
|
||||||
*(.eh_frame)
|
|
||||||
*(.comment)
|
|
||||||
*(.comment.*)
|
|
||||||
*(.note)
|
|
||||||
*(.note.*)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue