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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
9 -- Architectural definitions for Barrelfish on x86_64.
11 --------------------------------------------------------------------------
16 import qualified Config
17 import qualified ArchDefaults
19 -------------------------------------------------------------------------
21 -- Architecture specific definitions for x86_64
23 -------------------------------------------------------------------------
28 compiler = Config.x86_cc
29 cxxcompiler = Config.x86_cxx
31 ourCommonFlags = [ Str "-m64",
34 Str "-fno-stack-protector",
35 Str "-Wno-unused-but-set-variable",
36 Str "-Wno-packed-bitfield-compat",
39 cFlags = ArchDefaults.commonCFlags
40 ++ ArchDefaults.commonFlags
43 cxxFlags = ArchDefaults.commonCxxFlags
44 ++ ArchDefaults.commonFlags
46 ++ [Str "-std=gnu++11"]
48 cDefines = ArchDefaults.cDefines options
50 ourLdFlags = [ Str "-Wl,-z,max-page-size=0x1000",
51 Str "-Wl,--build-id=none",
54 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
55 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
57 options = (ArchDefaults.options arch archFamily) {
59 optCxxFlags = cxxFlags,
60 optDefines = cDefines,
62 optLdCxxFlags = ldCxxFlags,
63 optInterconnectDrivers = ["lmp", "ump", "multihop"],
64 optFlounderBackends = ["lmp", "ump", "multihop"]
68 -- The kernel is "different"
71 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
77 "-fno-stack-protector",
81 "-Wstrict-prototypes",
82 "-Wold-style-definition",
83 "-Wmissing-prototypes",
84 "-Wmissing-declarations",
85 "-Wmissing-field-initializers",
87 "-Wno-packed-bitfield-compat",
88 "-Wno-unused-but-set-variable",
90 "-imacros deputy/nodeputy.h",
97 -- "-Wno-unused-but-set-variable",
102 kernelLdFlags = [ Str s | s <- [ "-Wl,-N",
106 "-Wl,--fatal-warnings",
110 ------------------------------------------------------------------------
112 -- Now, commands to actually do something
114 ------------------------------------------------------------------------
119 cCompiler = ArchDefaults.cCompiler arch compiler
120 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
121 makeDepend = ArchDefaults.makeDepend arch compiler
122 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
123 cToAssembler = ArchDefaults.cToAssembler arch compiler
124 assembler = ArchDefaults.assembler arch compiler
125 archive = ArchDefaults.archive arch
126 linker = ArchDefaults.linker arch compiler
127 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
130 -- Link the kernel (CPU Driver)
132 linkKernel :: Options -> [String] -> [String] -> String -> HRule
133 linkKernel opts objs libs kbin =
134 let linkscript = "/kernel/linker.lds"
136 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
137 NStr "-T", In BuildTree arch "/kernel/linker.lds",
138 Str "-o", Out arch kbin
142 [ In BuildTree arch o | o <- objs ]
144 [ In BuildTree arch l | l <- libs ]
146 [ NL, NStr "/bin/echo -e '\\0002' | dd of=",
148 Str "bs=1 seek=16 count=1 conv=notrunc status=noxfer"
152 NStr "-I", NoDep SrcTree "src" "/kernel/include/",
153 Str "-D__ASSEMBLER__",
154 Str "-P", In SrcTree "src" "/kernel/arch/x86_64/linker.lds.in",