]> Zhao Yanbai Git Server - minix.git/commitdiff
kernel: make clang-buildable
authorArun Thomas <arun@minix3.org>
Tue, 28 Jun 2011 13:34:19 +0000 (15:34 +0200)
committerArun Thomas <arun@minix3.org>
Tue, 28 Jun 2011 13:34:19 +0000 (15:34 +0200)
kernel/Makefile
kernel/arch/i386/kernel.lds
kernel/arch/i386/kernel_elf.lds [deleted file]

index f98e15c37c78cf474f7e60ffe85f66f7589915d1..a431e663373b159992e09ac15cca593ef1daadea 100644 (file)
@@ -21,22 +21,27 @@ CFLAGS += -D__kernel__
 .if ${COMPILER_TYPE} == "ack"
 LDFLAGS+= -.o
 .elif ${COMPILER_TYPE} == "gnu"
+CFLAGS+=-march=i386
 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
+.endif
+
 .if (${NBSD_LIBC} != "no")
 LDADD+= -lminlib
 DPADD+= ${LIBMINLIB}
 CPPFLAGS+= -D_NETBSD_SOURCE
 .else
+
+.if ${CC} == "gcc"
 DPADD+=        ${LIBC}
 LDADD+=        -lgcc -lc -lgcc
+.elif ${CC} == "clang"
+DPADD+=        ${LIBC}
+LDADD+= -L/usr/pkg/lib
+LDADD+= -lCompilerRT-Generic -lc -lCompilerRT-Generic
 .endif
+
 .endif
 
 CPPFLAGS+=     -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
index bdb27862ba39d325fa8a1ef11085212f2b16d139..2e290f383cc6a84788a285162e9ee1bdc6779c8d 100644 (file)
@@ -2,12 +2,7 @@ OUTPUT_ARCH("i386")
 ENTRY(MINIX)
 SECTIONS
 {
-       . = 0x0;
-       _text = .;
-       begtext = .;
-       .text.head . : AT (0x0) {
-               *(.text.head)
-       }
+       . = 0x200000 + SIZEOF_HEADERS;
        .text . : AT (ADDR(.text) - 0x0000) {
                *(.text)
                *(.text.*)
@@ -16,8 +11,6 @@ SECTIONS
        _etext = .;
        etext = .;
 
-       _data = .;
-       begdata = .;
        .data . : AT (ADDR(.data) - 0x0000) {
                _rodata = .;
                /* kernel data starts with this magic number */
@@ -27,17 +20,15 @@ SECTIONS
                _erodata = .;
                *(.data)
                *(.data.*)
+               . = ALIGN(4096);
        }
        _edata = .;
-       _bss = .;
-       begbss = .;
+
        .bss . : AT (ADDR(.bss) - 0x0000) {
                *(.bss)
                *(.bss.*)
                *(COMMON)
        }
-       _ebss = .;
-       endbss = .;
        _end = .;
        end = .;
 
diff --git a/kernel/arch/i386/kernel_elf.lds b/kernel/arch/i386/kernel_elf.lds
deleted file mode 100644 (file)
index 2e290f3..0000000
+++ /dev/null
@@ -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.*)
-       }
-}