Code: Select all
$ objdump -h KeaKernel
KeaKernel: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .boot 00000340 0000000000100000 0000000000100000 00000190 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 00000974 ffffffff80101000 0000000000101000 000004d0 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 000002a0 ffffffff80102000 0000000000102000 00000e48 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .data 00000000 ffffffff80103000 ffffffff80103000 000010e8 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .bss 00005048 ffffffff80103000 0000000000103000 00002000 2**12
ALLOC
(... debug sections)
Code: Select all
#include <linker.h>
_KERNEL_PHYS = 0x100000;
_KERNEL_VMA = KERNEL_VMA; // 0xffffffff80000000
OUTPUT_ARCH(i386:x86-64)
OUTPUT_FORMAT(elf64-x86-64)
ENTRY(_entry)
SECTIONS {
/* Bootstrap code, only ASM allowed */
. = _KERNEL_PHYS;
.boot ALIGN(64) : {
*(.mb2)
*(.boot.text)
*(.boot.data)
. = ALIGN(64);
boot_stack_bottom = .;
. += 128;
boot_stack_top = .;
*(.boot.bss)
}
. += _KERNEL_VMA;
/* Add a symbol that indicates the start address of the kernel. */
_kernel_start = .;
.text ALIGN (4K) : AT (ADDR (.text) - _KERNEL_VMA) {
_text_start = .;
*(.text)
_text_end = .;
}
.rodata ALIGN (4K) : AT (ADDR (.rodata) - _KERNEL_VMA) {
_rodata_start = .;
*(.rodata)
*(.rodata.str1.1)
. = ALIGN(8);
*(.rodata.str1.8)
_rodata_end = .;
}
.data ALIGN (4K) : AT (ADDR (.data) - _KERNEL_VMA) {
*(.data)
}
.bss ALIGN (4K) : AT (ADDR (.bss) - _KERNEL_VMA) {
_bss_start_ = .;
*(COMMON)
*(.bss)
_bss_end_ = .;
}
/* Add a symbol that indicates the end address of the kernel. */
_kernel_end = .;
}
Code: Select all
$ objdump -t KeaKernel | rg -i bss
ffffffff80103000 l O .bss 00000000000002c8 boot_info
ffffffff80105000 l O .bss 0000000000000001 pml4t
ffffffff80106000 l O .bss 0000000000000001 pdpt
ffffffff80107000 l O .bss 0000000000000001 pdt
ffffffff80108000 l O .bss 0000000000000014 tty_info
ffffffff80108018 l O .bss 0000000000000030 kp_info
ffffffff80103300 g O .bss 0000000000001000 kernel_stack
ffffffff80103000 g .bss 0000000000000000 _bss_start_
ffffffff80108048 g .bss 0000000000000000 _bss_end_
ffffffff80108048 g .bss 0000000000000000 _kernel_end