Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 69dc065 in mainline


Ignore:
Timestamp:
2009-09-17T22:42:56Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
master
Children:
c1618ed
Parents:
82cf692
Message:

initial Clang support

this is more like a proof-of-concept (tested with Clang and LLVM 2.6-pre1)

  • it is limited to ia32/amd64, but it will probably fail except compiling ia32 target on ia32 host
  • actually only Clang as compiler is used, native binutils are used for standalone assembler files and linking
  • kernel compiles fine, boots and even prints some scrambled initial messages to the framebuffer, but panics soon after that (it might be just a tiny glitch in output functions)
  • uspace compiles mostly fine, but the linking fails
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r82cf692 r69dc065  
    219219
    220220% Compiler
    221 @ "gcc_cross" GCC Cross-compiler
    222 @ "gcc_native" GCC Native
    223 @ "icc_native" ICC Native
    224 @ "suncc_native" Sun Studio C Compiler
     221@ "gcc_cross" GNU C Compiler (cross-compiler)
     222@ "gcc_native" GNU C Compiler (native)
     223@ "icc" Intel C Compiler
     224@ "suncc" Sun Studio C Compiler
     225@ "clang" Clang
    225226! [PLATFORM=amd64|PLATFORM=ia32] COMPILER (choice)
    226227
    227228% Compiler
    228 @ "gcc_cross" GCC Cross-compiler
    229 @ "gcc_native" GCC Native
    230 @ "icc_native" ICC Native
     229@ "gcc_cross" GNU C Compiler (cross-compiler)
     230@ "gcc_native" GNU C Compiler (native)
     231@ "icc" Intel C Compiler
    231232! [PLATFORM=ia64] COMPILER (choice)
    232233
    233234% Compiler
    234 @ "gcc_cross" GCC Cross-compiler
    235 @ "gcc_native" GCC Native
    236 @ "suncc_native" Sun Studio C Compiler
     235@ "gcc_cross" GNU C Compiler (cross-compiler)
     236@ "gcc_native" GNU C Compiler (native)
     237@ "suncc" Sun Studio C Compiler
    237238! [PLATFORM=sparc64] COMPILER (choice)
    238239
    239240% Compiler
    240 @ "gcc_cross" GCC Cross-compiler
    241 @ "gcc_native" GCC Native
     241@ "gcc_cross" GNU C Compiler (cross-compiler)
     242@ "gcc_native" GNU C Compiler (native)
    242243! [PLATFORM=arm32|PLATFORM=mips32|PLATFORM=ppc32] COMPILER (choice)
    243244
  • boot/arch/ia64/loader/Makefile

    r82cf692 r69dc065  
    5151endif
    5252
    53 ifeq ($(COMPILER),icc_native)
     53ifeq ($(COMPILER),icc)
    5454        CC = icc
    5555        AS = as
  • kernel/Makefile

    r82cf692 r69dc065  
    5454ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
    5555        -fno-builtin -Wall -Wmissing-prototypes -Werror \
    56         -nostdlib -nostdinc \
    57         -wd170
     56        -nostdlib -nostdinc -wd170
    5857
    5958SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
    6059        -xnolib -xc99=all -features=extensions \
    6160        -erroff=E_ZERO_SIZED_STRUCT_UNION
     61
     62CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
     63        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     64        -finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
     65        -Wmissing-prototypes -nostdlib -nostdinc -pipe
    6266
    6367LFLAGS = -M
     
    109113endif
    110114
    111 ifeq ($(COMPILER),icc_native)
     115ifeq ($(COMPILER),gcc_cross)
     116        CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
     117        GCC = $(CC)
     118        AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
     119        LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
     120        OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
     121        OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
     122        LIBDIR = $(TOOLCHAIN_DIR)/lib
     123        CFLAGS = $(GCC_CFLAGS)
     124        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     125endif
     126
     127ifeq ($(COMPILER),icc)
    112128        CC = icc
    113129        GCC = gcc
     
    121137endif
    122138
    123 ifeq ($(COMPILER),suncc_native)
     139ifeq ($(COMPILER),suncc)
    124140        CC = suncc
    125141        GCC = gcc
     
    134150endif
    135151
    136 ifeq ($(COMPILER),gcc_cross)
    137         CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
    138         GCC = $(CC)
    139         AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
    140         LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
    141         OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
    142         OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
    143         LIBDIR = $(TOOLCHAIN_DIR)/lib
    144         CFLAGS = $(GCC_CFLAGS)
     152ifeq ($(COMPILER),clang)
     153        CC = clang
     154        GCC = gcc
     155        AS = $(BINUTILS_PREFIX)as
     156        LD = $(BINUTILS_PREFIX)ld
     157        OBJCOPY = $(BINUTILS_PREFIX)objcopy
     158        OBJDUMP = $(BINUTILS_PREFIX)objdump
     159        LIBDIR = /usr/lib
     160        CFLAGS = $(CLANG_CFLAGS)
    145161        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    146162endif
  • kernel/arch/ia32/Makefile.inc

    r82cf692 r69dc065  
    4343ICC_CFLAGS += $(CMN1)
    4444SUNCC_CFLAGS += $(CMN1)
     45CLANG_CFLAGS += $(CMN1)
    4546
    4647## Accepted CPUs
     
    7172GCC_CFLAGS += $(CMN2)
    7273ICC_CFLAGS += $(CMN2)
     74CLANG_CFLAGS += $(CMN2)
    7375
    7476ARCH_SOURCES = \
  • uspace/lib/libc/Makefile.toolchain

    r82cf692 r69dc065  
    6464#
    6565
     66ifeq ($(COMPILER),gcc_cross)
     67        CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
     68        AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
     69        LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
     70        AR = $(TOOLCHAIN_DIR)/$(TARGET)-ar
     71        OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
     72        OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
     73        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     74endif
     75
    6676ifeq ($(COMPILER),gcc_native)
    6777        CC = gcc
     
    7484endif
    7585
    76 ifeq ($(COMPILER),icc_native)
     86ifeq ($(COMPILER),icc)
    7787        CC = icc
    7888        AS = as
     
    8494endif
    8595
    86 ifeq ($(COMPILER),gcc_cross)
    87         CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
    88         AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
    89         LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
    90         AR = $(TOOLCHAIN_DIR)/$(TARGET)-ar
    91         OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
    92         OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
     96ifeq ($(COMPILER),clang)
     97        CC = clang
     98        AS = $(BINUTILS_PREFIX)as
     99        LD = $(BINUTILS_PREFIX)ld
     100        AR = $(BINUTILS_PREFIX)ar
     101        OBJCOPY = $(BINUTILS_PREFIX)objcopy
     102        OBJDUMP = $(BINUTILS_PREFIX)objdump
    93103        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    94104endif
Note: See TracChangeset for help on using the changeset viewer.