The linker script and the dump are shown below.
Code:
bin/x86_32/phios.elf: file format elf32-i386
bin/x86_32/phios.elf
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00100018
Program Header:
LOAD off 0x00001000 vaddr 0x00100000 paddr 0x00100000 align 2**12
filesz 0x00005530 memsz 0x00005530 flags r-x
LOAD off 0x00007000 vaddr 0x00106000 paddr 0x00106000 align 2**12
filesz 0x00000248 memsz 0x0000a020 flags rw-
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000049c8 00100000 00100000 00001000 2**12
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text.__x86.get_pc_thunk.cx 00000004 001049c8 001049c8 000059c8 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .text.__x86.get_pc_thunk.bx 00000004 001049cc 001049cc 000059cc 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .rodata 00000058 00105000 00105000 00006000 2**12
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .rodata.str1.1 00000330 00105058 00105058 00006058 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .rodata.str1.4 000001a8 00105388 00105388 00006388 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .data 00000159 00106000 00106000 00007000 2**12
CONTENTS, ALLOC, LOAD, DATA
7 .got 000000e0 0010615c 0010615c 0000715c 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .got.plt 0000000c 0010623c 0010623c 0000723c 2**2
CONTENTS, ALLOC, LOAD, DATA
9 .bss 00009020 00107000 00107000 00007248 2**12
ALLOC
SYMBOL TABLE:
00100000 l d .text 00000000 .text
001049c8 l d .text.__x86.get_pc_thunk.cx 00000000 .text.__x86.get_pc_thunk.cx
001049cc l d .text.__x86.get_pc_thunk.bx 00000000 .text.__x86.get_pc_thunk.bx
00105000 l d .rodata 00000000 .rodata
00105058 l d .rodata.str1.1 00000000 .rodata.str1.1
00105388 l d .rodata.str1.4 00000000 .rodata.str1.4
00106000 l d .data 00000000 .data
0010615c l d .got 00000000 .got
0010623c l d .got.plt 00000000 .got.plt
00107000 l d .bss 00000000 .bss
00000000 l df *ABS* 00000000 CMakeFiles/phios.elf.dir/kernel/src/arch/x86/boot32.s.o
00100000 l .text 00000000 multiboot_header_begin
00100018 l .text 00000000 multiboot_header_end
0010b000 l .bss 00000000 stack_top
00107000 l .bss 00000000 stack_bottom
00000000 l df *ABS* 00000000 phi_main.c
00000000 l df *ABS* 00000000 paa.c
0010b004 l O .bss 00000004 g_placementAddress
00000000 l df *ABS* 00000000 bitmap_pma.c
00000000 l df *ABS* 00000000 pmm.c
00000000 l df *ABS* 00000000 asm_io.c
00000000 l df *ABS* 00000000 gdt32.c
0010b080 l O .bss 0000003c g_GDT32Struct
0010b040 l O .bss 00000030 g_GDT32Entries
0010b020 l O .bss 00000006 g_GDT32Pointer
00000000 l df *ABS* 00000000 idt32.c
0010b0c0 l O .bss 00000400 g_intHandlers
0010b500 l O .bss 00000800 g_IDTEntries32
0010b4c0 l O .bss 00000006 g_IDTPointer32
00000000 l df *ABS* 00000000 handlers32.c
00000000 l df *ABS* 00000000 pit.c
00102390 l F .text 00000002 helper_pitHandler
0010bd00 l O .bss 00000004 g_time
00000000 l df *ABS* 00000000 ia32.c
00102430 l F .text 00000093 helper_IA32_4KB_createPaging
001024d0 l F .text 0000007d helper_IA32_4KB_deletePaging
00000000 l df *ABS* 00000000 cpu.c
00000000 l df *ABS* 00000000 pic.c
00000000 l df *ABS* 00000000 tss32.c
00000000 l df *ABS* 00000000 cpuid.c
0010bd20 l O .bss 00000028 g_cpuInfo
00000000 l df *ABS* 00000000 init32.c
00000000 l df *ABS* 00000000 drivers_test.c
00000000 l df *ABS* 00000000 util_test.c
00000000 l df *ABS* 00000000 CMakeFiles/phios.elf.dir/kernel/src/arch/x86/descriptors32.s.o
00103360 l .text 00000000 flush
00000000 l df *ABS* 00000000 CMakeFiles/phios.elf.dir/kernel/src/arch/x86/interrupts32.s.o
0010353d l .text 00000000 isr_common_stub_32
0010358c l .text 00000000 irq_common_stub_32
00000000 l df *ABS* 00000000 keyboard.c
00000000 l df *ABS* 00000000 rtc.c
00103930 l F .text 0000005f helper_getRegisterValue
0010bd48 l O .bss 00000007 g_rtc
00000000 l df *ABS* 00000000 text_mode.c
00000000 l df *ABS* 00000000 kstring.c
00000000 l df *ABS* 00000000 kstdio.c
00104750 l .text 00000000 .L7
00104730 l .text 00000000 .L8
00104700 l .text 00000000 .L10
001046b0 l .text 00000000 .L11
00104690 l .text 00000000 .L12
00104640 l .text 00000000 .L13
001045c0 l .text 00000000 .L14
00000000 l df *ABS* 00000000 kstdlib.c
00000000 l df *ABS* 00000000
0010623c l O .got.plt 00000000 _GLOBAL_OFFSET_TABLE_
001049c8 g F .text.__x86.get_pc_thunk.cx 00000000 .hidden __x86.get_pc_thunk.cx
00100c10 g F .text 00000026 GDT32_setStruct
00100e00 g F .text 00000046 IDT32_registerHandler
00100e50 g F .text 00000b1c IDT32_init
00106000 g .data 00000000 linker_dataStart
0010bd80 g O .bss 00002000 g_userStack
0010352f g F .text 00000000 irq_32_14
00103d40 g F .text 00000018 VGA_SetBackgroundColor
001035db g F .text 00000000 CPUID_IsSuported
00103627 g F .text 00000000 jumpToUserMode
001033fb g F .text 00000000 isr_32_15
00103371 g F .text 00000000 isr_32_0
001029e0 g F .text 0000004a IA32_4KB_switchDirectory
001034d0 g F .text 00000000 irq_32_3
0010fec0 g O .bss 00000004 g_layout
0010351a g F .text 00000000 irq_32_11
00103326 g F .text 00000000 readCR0
00103cc0 g F .text 0000007a VGA_MoveCursor
00102870 g F .text 00000169 IA32_4KB_init
00103423 g F .text 00000000 isr_32_19
001033ad g F .text 00000000 isr_32_6
0010b000 g O .bss 00000004 x
00100be0 g F .text 00000007 io_inw
00100af0 g F .text 000000a3 PMM_reserve
001034b2 g F .text 00000000 irq_32_0
00103320 g F .text 00000006 util_test_func
001042e0 g F .text 00000047 kmemset
00100ba0 g F .text 0000000a io_outb
00104010 g F .text 0000006e VGA_Clear
001049c8 g .text 00000000 linker_textEnd
001033e3 g F .text 00000000 isr_32_12
0010b009 g O .bss 00000001 g_index
001019f0 g F .text 00000063 handlers32_default
00100a40 g F .text 000000a3 PMM_free
0010347d g F .text 00000000 isr_32_28
00100042 g F .text 00000000 _higherHalf
001033db g F .text 00000000 isr_32_11
0010338f g F .text 00000000 isr_32_3
00101ad0 g F .text 00000063 handlers32_debug
001039c0 g F .text 000002f3 RTC_getDateAndTime
00104460 g F .text 00000036 kstrlen
00103650 g F .text 00000163 helper_keyboardReadScanCode
00103eb0 g F .text 0000002f VGA_WriteChar
00103536 g F .text 00000000 irq_32_15
00100bc0 g F .text 0000000a io_outl
0010345f g F .text 00000000 isr_32_25
00106000 g O .data 00000059 g_USasciiCapsOn
00103310 g F .text 00000006 drivers_test_func
0011000c g O .bss 00000004 g_VGA_foregroundColor
00103335 g F .text 00000000 readCR3
00103419 g F .text 00000000 isr_32_18
001033c9 g F .text 00000000 isr_32_9
001019a0 g F .text 0000004b IDT32_irqHandler
00103d60 g F .text 00000018 VGA_SetForegroundColor
00103840 g F .text 00000086 keyboard_init
00100140 g F .text 00000060 PAA_alloc
00103339 g F .text 00000000 writeCR3
00102080 g F .text 00000063 handlers32_pageFault
00100c90 g F .text 0000009d GDT32_createEntries
001008b0 g F .text 000000d7 PMM_addAllocator
00100750 g F .text 000000c7 BitmapPMA_reserve
001001a0 g F .text 00000012 PAA_getCurrentAddress
0010fec4 g O .bss 00000004 g_keyboardBufferPos
00100d30 g F .text 000000d0 GDT32_init
00103fd0 g F .text 00000031 VGA_WriteBuffer
0010de40 g O .bss 00002000 g_kernelStack
001034ee g F .text 00000000 irq_32_6
001034e4 g F .text 00000000 irq_32_5
001025b0 g F .text 0000004c IA32_4KB_free
00103f40 g F .text 0000002d VGA_WriteString
00101e50 g F .text 00000063 handlers32_coprocessorSegmentOverrun
0010349b g F .text 00000000 isr_32_31
00100000 g .text 00000000 linker_kernelStart
00101de0 g F .text 00000063 handlers32_doubleFault
0010350c g F .text 00000000 irq_32_9
00102a30 g F .text 00000044 IA32_4KB_enablePaging
00101f30 g F .text 00000063 handlers32_segmentNotPresent
00104080 g F .text 00000055 VGA_Init
00110010 g O .bss 00000004 g_VGA_backgroundColor
00102dc0 g F .text 0000016e CPUID_Init
00101970 g F .text 00000023 IDT32_isrHandler
00102240 g F .text 00000063 handlers32_SIMDFloatingPoint
00107000 g .bss 00000000 linker_bssStart
00101ec0 g F .text 00000063 handlers32_invalidTSS
001034c6 g F .text 00000000 irq_32_2
001001c0 g F .text 00000199 BitmapPMA_createAllocator
00101d00 g F .text 00000063 handlers32_invaildOpcode
00110020 g .bss 00000000 linker_kernelEnd
00102160 g F .text 00000063 handlers32_alignmentCheck
0010fe40 g O .bss 0000001c g_PMAVM
001020f0 g F .text 00000063 handlers32_FPUx87Exception
00102f30 g F .text 00000046 CPUID_GetVendorName
00100bb0 g F .text 0000000b io_outw
00102b90 g F .text 0000001d cpu_printState
001000d0 g F .text 00000024 kernel_main
00100bf0 g F .text 00000006 io_inl
001037c0 g F .text 00000019 keyboard_intHandler
00103db0 g F .text 000000f8 VGA_WriteColoredChar
0010337b g F .text 00000000 isr_32_1
00101bb0 g F .text 00000063 handlers32_breakpoint
0010fe5c g O .bss 0000001c g_kernelPaging
001022b0 g F .text 00000063 handlers32_virtualization
001037e0 g F .text 0000005a keyboard_setLayout
00100100 g F .text 0000003b PAA_init
0010344b g F .text 00000000 isr_32_23
00103528 g F .text 00000000 irq_32_13
001033b7 g F .text 00000000 isr_32_7
00105058 g .rodata 00000000 linker_rodataEnd
00103441 g F .text 00000000 isr_32_22
00101a60 g F .text 00000063 handlers32_zeroDivision
00103da0 g F .text 00000002 VGA_Scroll
00101fa0 g F .text 00000063 handlers32_stackSegmentFault
00105000 g .rodata 00000000 linker_rodataStart
00100000 g *ABS* 00000000 KERNEL_VMA
00104930 g F .text 00000098 kitoa
00104250 g F .text 00000084 kmemmove
001043d0 g F .text 00000089 kstrcpy
00102ca0 g F .text 0000004d PIC_clearMask
0010fec8 g O .bss 00000001 g_capsOn
00102b60 g F .text 0000002e cpu_printState64
00104150 g F .text 0000008b kmemcmp
00102010 g F .text 00000063 handlers32_generalProtectionFault
001038d0 g F .text 00000051 keyboard_readKey
00103399 g F .text 00000000 isr_32_4
00101b40 g F .text 00000063 handlers32_NMI
0010ff00 g O .bss 00000100 g_keyboardBuffer
00103f70 g F .text 00000053 VGA_WriteColoredBuffer
001049cc g F .text.__x86.get_pc_thunk.bx 00000000 .hidden __x86.get_pc_thunk.bx
00106100 g O .data 00000059 g_USasciiNonShift
00106080 g O .data 00000059 g_USasciiShift
00100990 g F .text 000000a3 PMM_alloc
00104330 g F .text 00000099 kstrcmp
00103ee0 g F .text 00000051 VGA_WriteColoredString
00103513 g F .text 00000000 irq_32_10
00100bd0 g F .text 00000006 io_inb
00101c90 g F .text 00000063 handlers32_boundRangeExceed
00110014 g O .bss 00000004 g_VGA_row
00102da0 g F .text 0000001b TSS32_setKernelStack
001023a0 g F .text 00000090 PIT_init
00100820 g F .text 00000087 PMM_init
001034da g F .text 00000000 irq_32_4
0010fe80 g O .bss 00000024 g_kernelArea
0010b00c g O .bss 00000004 g_allocators
00102550 g F .text 0000005f IA32_4KB_alloc
001005c0 g F .text 00000184 BitmapPMA_free
00101c20 g F .text 00000063 handlers32_overflow
00106159 g .data 00000000 linker_dataEnd
0010dd80 g O .bss 00000004 y
001034f8 g F .text 00000000 irq_32_7
00103473 g F .text 00000000 isr_32_27
00103344 g F .text 00000000 GDT32_Load
001047c0 g F .text 0000016c kutoa
00103d80 g F .text 00000019 VGA_CreateEntry
00103990 g F .text 00000026 RTC_init
001034a5 g F .text 00000000 isr_32_128
001033eb g F .text 00000000 isr_32_13
001044a0 g F .text 0000007b kstrrev
00100c40 g F .text 00000047 GDT32_getStruct
001033d3 g F .text 00000000 isr_32_10
00110018 g O .bss 00000004 g_VGA_column
00102c50 g F .text 0000004d PIC_setMask
00102bb0 g F .text 00000091 PIC_init
0010342d g F .text 00000000 isr_32_20
00103455 g F .text 00000000 isr_32_24
00100c00 g F .text 00000005 io_wait
00101d70 g F .text 00000063 handlers32_deviceNotAvailable
00103361 g F .text 00000000 IDT32_Load
001034bc g F .text 00000000 irq_32_1
00103369 g F .text 00000000 TSS32_Load
00110020 g .bss 00000000 linker_bssEnd
0010340f g F .text 00000000 isr_32_17
00103385 g F .text 00000000 isr_32_2
0010332a g F .text 00000000 writeCR0
00102a80 g F .text 000000df cpu_printState32
00104520 g F .text 00000294 kprintf
001041e0 g F .text 00000064 kmemcpy
001033c1 g F .text 00000000 isr_32_8
00110000 g O .bss 00000004 g_capsOnLayout
00100060 g F .text 00000070 user_main
001040e0 g F .text 00000066 kmemchr
0010b008 g O .bss 00000001 g_allocatorsNumber
001033f3 g F .text 00000000 isr_32_14
00110004 g O .bss 00000001 g_shift
00103040 g F .text 000002c9 init_init32
00103521 g F .text 00000000 irq_32_12
0011001c g O .bss 00000004 g_VGA_buffer
00102600 g F .text 0000026e IA32_4KB_initKernelPaging
00102d30 g F .text 00000065 TSS32_init
00103437 g F .text 00000000 isr_32_21
001035ef g F .text 00000000 CPUID_Call
001033a3 g F .text 00000000 isr_32_5
00100360 g F .text 0000025a BitmapPMA_alloc
00103487 g F .text 00000000 isr_32_29
00102320 g F .text 00000063 handlers32_security
001021d0 g F .text 00000063 handlers32_machineCheck
0010ddc0 g O .bss 00000068 g_TSSKernelEntry
00100018 g F .text 0000003f _start32
00102f80 g F .text 000000b7 CPUID_HasFeature
00110005 g O .bss 00000001 g_special
00103405 g F .text 00000000 isr_32_16
00103502 g F .text 00000000 irq_32_8
00100000 g *ABS* 00000000 KERNEL_PMA
00102cf0 g F .text 0000003c PIC_maskUnusedIRQs
00100000 g .text 00000000 linker_textStart
00103491 g F .text 00000000 isr_32_30
00103469 g F .text 00000000 isr_32_26
00110008 g O .bss 00000004 g_shiftLayout
Code:
KERNEL_VMA = 0x100000;
KERNEL_PMA = 0x100000;
OUTPUT_FORMAT("elf32-i386")
ENTRY(_start32)
SECTIONS
{
/* Place kernel at 1 MiB */
. = KERNEL_PMA;
linker_kernelStart = .;
/* Read-Only sections */
.text BLOCK(4K) : ALIGN(4K)
{
linker_textStart = .;
CMakeFiles/phios.elf.dir/kernel/src/arch/x86/boot32.s.o (.text)
*(EXCLUDE_FILE(CMakeFiles/phios.elf.dir/kernel/src/arch/x86/boot32.s.o) .text)
linker_textEnd = .;
}
.rodata BLOCK(4K) : ALIGN(4K)
{
linker_rodataStart = .;
*(.rodata)
linker_rodataEnd = .;
}
/* Read-Write sections */
.data BLOCK(4K) : ALIGN(4K)
{
linker_dataStart = .;
*(.data)
linker_dataEnd = .;
}
.bss BLOCK(4K) : ALIGN(4K)
{
linker_bssStart = .;
*(.bss)
*(COMMON)
linker_bssEnd = .;
}
linker_kernelEnd = .;
/* Discard useless sections */
/DISCARD/ :
{
*(.note)
*(.comment)
*(.eh_frame) /* Add this if C++ support is needed */
}
}