1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2010, ETH Zurich.
3 -- All rights reserved.
5 -- This file is distributed under the terms in the attached LICENSE file.
6 -- If you do not find this file, copies can be found by writing to:
7 -- ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
9 -- Architectural definitions for Barrelfish on x86_mic.
11 -- This architecture is used to build for the Intel Xeon Phi architecture.
13 --------------------------------------------------------------------------
19 import qualified Config
20 import qualified ArchDefaults
22 -------------------------------------------------------------------------
24 -- Architecture specific definitions for X86_64-k1om
26 -------------------------------------------------------------------------
31 compiler = "x86_64-k1om-barrelfish-gcc"
32 objcopy = "x86_64-k1om-barrelfish-objcopy"
33 objdump = "x86_64-k1om-barrelfish-objdump"
34 ar = "x86_64-k1om-barrelfish-ar"
35 ranlib = "x86_64-k1om-barrelfish-ranlib"
36 cxxcompiler = "x86_64-k1om-barrelfish-g++"
39 ourCommonFlags = [ Str "-m64",
42 Str "-fno-stack-protector",
43 Str "-Wno-unused-but-set-variable",
44 Str "-Wno-packed-bitfield-compat",
45 -- the intel mic architecture has no "normal" SIMD extensions
55 -- specific Xeon Phi architecture
56 Str "-Wa,-march=k1om",
57 Str "-Wa,-mtune=k1om",
60 cFlags = ArchDefaults.commonCFlags
61 ++ ArchDefaults.commonFlags
64 cxxFlags = ArchDefaults.commonCxxFlags
65 ++ ArchDefaults.commonFlags
68 cDefines = ArchDefaults.cDefines options
70 ourLdFlags = [ Str "-Wl,-z,max-page-size=0x1000",
71 Str "-Wl,--build-id=none",
74 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
75 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
77 options = (ArchDefaults.options arch archFamily) {
79 optCxxFlags = cxxFlags,
80 optDefines = cDefines,
82 optLdCxxFlags = ldCxxFlags,
83 optInterconnectDrivers = ["lmp", "ump", "multihop"],
84 optFlounderBackends = ["lmp", "ump", "multihop"]
88 -- The kernel is "different"
91 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
97 "-fno-stack-protector",
101 "-Wstrict-prototypes",
102 "-Wold-style-definition",
103 "-Wmissing-prototypes",
104 "-Wmissing-declarations",
105 "-Wmissing-field-initializers",
107 "-Wno-packed-bitfield-compat",
108 "-Wno-unused-but-set-variable",
110 "-imacros deputy/nodeputy.h" ] ]
117 -- "-Wno-unused-but-set-variable",
123 kernelLdFlags = [ Str s | s <- [ "-Wl,-N",
127 "-Wl,--fatal-warnings",
131 ------------------------------------------------------------------------
133 -- Now, commands to actually do something
135 ------------------------------------------------------------------------
140 cCompiler = ArchDefaults.cCompiler arch compiler
141 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
142 makeDepend = ArchDefaults.makeDepend arch compiler
143 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
144 cToAssembler = ArchDefaults.cToAssembler arch compiler
145 assembler = ArchDefaults.assembler arch compiler
146 archive = ArchDefaults.archive arch
147 linker = ArchDefaults.linker arch compiler
148 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
151 -- Link the kernel (CPU Driver)
153 linkKernel :: Options -> [String] -> [String] -> String -> HRule
154 linkKernel opts objs libs kbin =
155 let linkscript = "/kernel/linker.lds"
157 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
158 NStr "-T", In BuildTree arch "/kernel/linker.lds",
159 Str "-o", Out arch kbin
163 [ In BuildTree arch o | o <- objs ]
165 [ In BuildTree arch l | l <- libs ]
167 [ NL, NStr "/bin/echo -e '\\0002' | dd of=",
169 Str "bs=1 seek=16 count=1 conv=notrunc status=noxfer"
173 NStr "-I", NoDep SrcTree "src" "/kernel/include/",
174 Str "-D__ASSEMBLER__",
175 Str "-P", In SrcTree "src" "/kernel/arch/k1om/linker.lds.in",