Module Name: src
Committed By: uebayasi
Date: Fri Nov 7 16:41:17 UTC 2014
Modified Files:
src/usr.bin/config: TODO
Log Message:
config(1): TODO about kernel linkage
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/config/TODO
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/config/TODO
diff -u src/usr.bin/config/TODO:1.9 src/usr.bin/config/TODO:1.10
--- src/usr.bin/config/TODO:1.9 Sat Nov 1 14:15:31 2014
+++ src/usr.bin/config/TODO Fri Nov 7 16:41:17 2014
@@ -183,3 +183,49 @@ o Shared kernel objects.
While leaving optimizations as options (CPU specific optimizations, inlined
bus_space(9) operations, etc.) for users, the official binaries build
provided by TNF should be as portable as possible.
+
+o Control ELF sections using linker script.
+
+ Now kernel is linked and built directly from object files (*.o). Each port
+ has an MD linker script, which does everything needed to be done at link
+ time. As a result, they do from MI alignment restriction (read_mostly,
+ cacheline_aligned) to load address specification for external boot loaders.
+
+ Make this into multiple stages to make linkage more structural. Especially,
+ reserve the final link for purely MD purpose.
+
+ Monolithic build:
+ *.o ---> netbsd.ko Generic MI linkage
+ netbsd.ko ---> netbsd.ro Kernel MI linkage
+ netbsd.ro ---> netbsd Kernel MD linkage
+
+ Modular build (kernel):
+ *.o ---> *.ko Generic + Per-module MI linkage
+ *.ko ---> netbsd.ro Kernel MI linkage
+ netbsd.ro ---> netbsd Kernel MD linkage
+
+ Modular build (module):
+ *.o ---> *.ko Generic + Per-module MI linkage
+ *.ko ---> *.ro Modular MI linkage
+ *.ro ---> *.kmod Modular MD linkage
+
+ Genric MI linkage is for processing MI linkage that can be applied generally.
+ Data section alignment (.data.read_mostly and .data.cacheline_aligned) is
+ processed here.
+
+ Per-module MI linkage is for modules that want some ordering. For example,
+ machdep.ko wants to put entry code at the top of .text and .data.
+
+ Kernel MI linkage is for collecting kernel global section data, that is what
+ link-set is used for now. Once they are collected and symbols to the ranges
+ are assigned, those sections are merged into the pre-existing sections
+ (.rodata) because link-set sections in "netbsd" will never be interpreted by
+ external loaders.
+
+ Kernel MD linkage is used purely for MD purposes, that is, how kernels are
+ loaded by external loaders. It might be possible that one kernel relocatable
+ (netbsd.ro) is linked into multiple final kernel image (netbsd) for diferent
+ load addresses.
+
+ XXX Modular MI linkage
+ XXX Modular MD linkage