diff --git a/blog/intro.org b/blog/intro.org index a9c8f2c..58680ea 100644 --- a/blog/intro.org +++ b/blog/intro.org @@ -109,32 +109,33 @@ As is, attempting to build this code will throw linker errors, because cargo wil #+begin_src json { - "arch": "x86_64", - "code-model": "kernel", - "cpu": "x86-64", - "crt-objects-fallback": "false", - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - "disable-redzone": true, - "target-endian": "little", - "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float", - "linker": "mold", - "linker-flavor": "gnu", - "llvm-target": "x86_64-unknown-none-elf", - "max-atomic-width": 64, - "panic-strategy": "abort", - "plt-by-default": false, - "position-independent-executables": true, - "relro-level": "full", - "rustc-abi": "softfloat", - "stack-probes": { - "kind": "inline" - }, - "static-position-independent-executables": true, - "supported-sanitizers": [ - "kcfi", - "kernel-address" - ], - "target-pointer-width": 64 + "arch": "x86_64", + "code-model": "kernel", + "cpu": "x86-64", + "crt-objects-fallback": "false", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", + "disable-redzone": true, + "target-endian": "little", + "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float", + "linker": "rust-lld", + "linker-flavor": "ld.lld", + "llvm-target": "x86_64-unknown-none-elf", + "max-atomic-width": 64, + "panic-strategy": "abort", + "plt-by-default": false, + "os": "none", + "executables": true, + "relro-level": "full", + "rustc-abi": "softfloat", + "stack-probes": { + "kind": "inline" + }, + "supported-sanitizers": [ + "kcfi", + "kernel-address" + ], + "target-pointer-width": 64, + "target-c-int-width": 32 } #+end_src @@ -148,6 +149,8 @@ More options available in the current rustc can be found by running the followin rustc -Zunstable-options --print target-spec-json-schema #+end_src +Notably, I have not copied the =*position-independent-executables= fields from the =x86_64-unknown-none-elf= target, because we will later use a linker script to place our kernel in the higher-half of the address space and modify the layout of our sections manually, and position independent executables complicate this. + If we now attempt to build our kernel, cargo will now complain that it cannot find the =core= crate since it is not available for our custom target: #+begin_src bash cargo -Zjson-target-spec build --target x86_64-unknown-kernel.json