1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2015, 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ätstr. 6, CH-8092 Zurich. Attn: Systems Group.
9 -- Architectural definitions for Barrelfish on x86_32.
11 --------------------------------------------------------------------------
16 import qualified Config
17 import qualified ArchDefaults
19 -------------------------------------------------------------------------
21 -- Architecture specific definitions for x86_32
23 -------------------------------------------------------------------------
28 compiler = Config.x86_cc
29 cxxcompiler = Config.x86_cxx
31 ourCommonFlags = [ Str "-m32",
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
47 cDefines = ArchDefaults.cDefines options
49 ourLdFlags = [ Str "-Wl,-section-start,.text=0x300000",
50 Str "-Wl,-section-start,.data.rel.ro=0x640000",
51 Str "-Wl,-z,max-page-size=0x1000",
52 Str "-Wl,--build-id=none",
55 ldFlags = ArchDefaults.ldFlags arch ++ ourLdFlags
56 ldCxxFlags = ArchDefaults.ldCxxFlags arch ++ ourLdFlags
58 options = (ArchDefaults.options arch archFamily) {
60 optCxxFlags = cxxFlags,
61 optDefines = cDefines,
62 optLibs = (ArchDefaults.stdLibs arch) ++ [ Str "-lgcc" ],
65 optInterconnectDrivers = ["lmp", "ump", "multihop"],
66 optFlounderBackends = ["lmp", "ump", "multihop"]
70 -- The kernel is "different"
73 kernelCFlags = [ Str s | s <- [ "-fno-builtin",
79 "-fno-stack-protector",
83 "-Wstrict-prototypes",
84 "-Wold-style-definition",
85 "-Wmissing-prototypes",
86 "-Wmissing-declarations",
87 "-Wmissing-field-initializers",
89 "-Wno-packed-bitfield-compat",
90 "-Wno-unused-but-set-variable",
92 "-imacros deputy/nodeputy.h",
103 kernelLdFlags = [ Str s | s <- [ "-Wl,-N",
107 "-Wl,--fatal-warnings",
113 cCompiler = ArchDefaults.cCompiler arch compiler
114 cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
115 makeDepend = ArchDefaults.makeDepend arch compiler
116 makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
117 cToAssembler = ArchDefaults.cToAssembler arch compiler
118 assembler = ArchDefaults.assembler arch compiler
119 archive = ArchDefaults.archive arch
120 linker = ArchDefaults.linker arch compiler
121 cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
124 -- Link the kernel (CPU Driver)
126 linkKernel :: Options -> [String] -> [String] -> String -> HRule
127 linkKernel opts objs libs kbin =
128 Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
129 NStr "-T", In BuildTree arch "/kernel/linker.lds",
130 Str "-o", Out arch kbin
134 [ In BuildTree arch o | o <- objs ]
136 [ In BuildTree arch l | l <- libs ]
140 [ NL, NStr "/bin/echo -e '\\0002' | dd of=",
142 Str "bs=1 seek=16 count=1 conv=notrunc status=noxfer"
146 NStr "-I", NoDep SrcTree "src" "/kernel/include/",
147 Str "-D__ASSEMBLER__",
148 Str "-P", In SrcTree "src" "/kernel/arch/x86_32/linker.lds.in",
149 Out arch "/kernel/linker.lds"