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++"
47 ourCommonFlags = [ Str "-m64",
51 Str "-fno-stack-protector",
52 Str "-Wno-unused-but-set-variable",
53 Str "-Wno-packed-bitfield-compat",
54 -- the intel mic architecture has no "normal" SIMD extensions
55 Str "-fno-tree-vectorize",
65 -- specific Xeon Phi architecture
66 -- Str "-Wa,-march=k1om",
67 -- Str "-Wa,-mtune=k1om",
72 cFlags = ArchDefaults.commonCFlags
73 ++ ArchDefaults.commonFlags
76 cxxFlags = ArchDefaults.commonCxxFlags
77 ++ ArchDefaults.commonFlags
80 cDefines = ArchDefaults.cDefines options
83 ourLdFlags = [ Str "-Wl,-z,max-page-size=0x1000",
84 -- Str "-Wl,-b,elf64-k1om",
85 -- Str "-Wl,--oformat,elf64-k1om",
86 Str "-Wl,--build-id=none",
90 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
91 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
93 options = (ArchDefaults.options arch archFamily) {
95 optCxxFlags = cxxFlags,
96 optDefines = cDefines,
98 optLdCxxFlags = ldCxxFlags,
99 optInterconnectDrivers = ["lmp", "ump", "multihop"],
100 optFlounderBackends = ["lmp", "ump", "multihop"]
104 -- The kernel is "different"
107 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
115 "-fno-stack-protector",
120 "-Wstrict-prototypes",
121 "-Wold-style-definition",
122 "-Wmissing-prototypes",
123 "-Wmissing-declarations",
124 "-Wmissing-field-initializers",
126 "-Wno-packed-bitfield-compat",
127 "-Wno-unused-but-set-variable",
129 "-imacros deputy/nodeputy.h",
130 "-fno-tree-vectorize",
142 kernelLdFlags = [ Str s | s <- [ "-Wl,-N",
143 --"-Wl,-b,elf64-k1om",
145 --"-Wl,--oformat,elf64-k1om",
150 "-Wl,--fatal-warnings",
154 ------------------------------------------------------------------------
156 -- Now, commands to actually do something
158 ------------------------------------------------------------------------
163 cCompiler = ArchDefaults.cCompiler arch compiler
164 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
165 makeDepend = ArchDefaults.makeDepend arch compiler
166 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
167 cToAssembler = ArchDefaults.cToAssembler arch compiler
168 assembler = ArchDefaults.assembler arch compiler
169 archive = ArchDefaults.archive arch
170 linker = ArchDefaults.linker arch compiler
171 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
174 -- Link the kernel (CPU Driver)
176 linkKernel :: Options -> [String] -> [String] -> String -> HRule
177 linkKernel opts objs libs kbin =
178 let linkscript = "/kernel/linker.lds"
180 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
181 NStr "-T", In BuildTree arch "/kernel/linker.lds",
182 Str "-o", Out arch kbin
186 [ In BuildTree arch o | o <- objs ]
188 [ In BuildTree arch l | l <- libs ]
190 [ NL, NStr "/bin/echo -e '\\0002' | dd of=",
192 Str "bs=1 seek=16 count=1 conv=notrunc status=noxfer"
196 NStr "-I", NoDep SrcTree "src" "/kernel/include/",
197 Str "-D__ASSEMBLER__",
198 Str "-P", In SrcTree "src" "/kernel/arch/k1om/linker.lds.in",