I am writing a linker script as:
SECTIONS
{
. = 0x100000;
.phys . :
{
*(.phys.text)
*(.phys.data)
. = ALIGN(4K);
}
.phys.bss . (NOLOAD) :
{
boot_stack_bottom = .;
. = . + 4K;
boot_stack_top = .;
*(.phys.bss)
}
. = . + KERNEL_OFFSET;
.boot . : AT(ADDR(.boot) - KERNEL_OFFSET)
{
*(.boot.text)
*(.boot.data)
}
}
When compiling my code, I expect to have .phys
section at address 0x100000
which is true. I also expect .phy.bss
to be at address 0x100000 + SIZEOF(.phys)
but its not. The .phys.bss
section has address 0x0
. But, if i remove the .
from the .phys.bss
section and simply write .phys.bss (NOLOAD) :
or explicitly specify the address using 0x100000 + SIZEOF(.phys)
everything work OK. Why is .
invalid for the .phys.bss
section!?
This is output of the objdump
for two cases:
.phys.bss (NOLOAD) :
architecture: i386:x86-64, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x00000000001012b3 Program Header: LOAD off 0x0000000000001000 vaddr 0x0000000000100000 paddr 0x0000000000100000 align 2**12 filesz 0x0000000000003000 memsz 0x0000000000006000 flags rw- LOAD off 0x0000000000004000 vaddr 0xffffffff80106000 paddr 0x0000000000106000 align 2**5 filesz 0x0000000000008918 memsz 0x000000000060a000 flags rwx LOAD off 0x000000000000d000 vaddr 0xffffffff80710000 paddr 0x0000000000710000 align 2**12 filesz 0x0000000000013aa7 memsz 0x0000000000023000 flags rwx STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4 filesz 0x0000000000000000 memsz 0x0000000000000000 flags rwx Sections: Idx Name Size VMA LMA File off Algn 0 .phys 00003000 0000000000100000 0000000000100000 00001000 2**12 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .phys.bss 00003000 0000000000103000 0000000000103000 00004000 2**12 ALLOC 2 .boot 00008918 ffffffff80106000 0000000000106000 00004000 2**5 CONTENTS, ALLOC, LOAD, CODE 3 .boot.bss 006016e8 ffffffff8010e918 000000000010e918 0000c918 2**5 ALLOC 4 .text 00011735 ffffffff80710000 0000000000710000 0000d000 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 5 .rodata 00002372 ffffffff80721735 0000000000721735 0001e735 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .bss 0000e571 ffffffff80723aa7 0000000000723aa7 00020aa7 2**12 ALLOC 7 .ehframe 00000fe8 ffffffff80732018 0000000000732018 00020aa7 2**0 ALLOC SYMBOL TABLE: 0000000000100000 l d .phys 0000000000000000 .phys 0000000000103000 l d .phys.bss 0000000000000000 .phys.bss ffffffff80106000 l d .boot 0000000000000000 .boot ffffffff8010e918 l d .boot.bss 0000000000000000 .boot.bss ffffffff80710000 l d .text 0000000000000000 .text ffffffff80721735 l d .rodata 0000000000000000 .rodata ffffffff80723aa7 l d .bss 0000000000000000 .bss ffffffff80732018 l d .ehframe 0000000000000000 .ehframe 0000000000000000 l df *ABS* 0000000000000000 src/arch/x86/64/head.o 000000000010102e l .phys 0000000000000000 huge_page_error_string 0000000000000029 l *ABS* 0000000000000000 huge_page_error_size 00000000001010ff l .phys 0000000000000000 pcid_error_string 0000000000000025 l *ABS* 0000000000000000 pcid_error_size 0000000000101148 l .phys 0000000000000000 invpcid_error_string 0000000000000033 l *ABS* 0000000000000000 invpcid_error_size 000000000010119f l .phys 0000000000000000 syscall_error_string 000000000000003a l *ABS* 0000000000000000 syscall_error_size 0000000000101205 l .phys 0000000000000000 fsgsbase_error_string 0000000000000035 l *ABS* 0000000000000000 fsgsbase_error_size 0000000000102010 l .phys 0000000000000000 _gdt64_ptr 0000000000102020 l .phys 0000000000000000 _gdt64 0000000000000000 l df *ABS* 0000000000000000 kernel_final.c ffffffff80106030 l F .boot 00000000000000a5 merge_regions ffffffff8030f0c0 l O .boot.bss 0000000000400118 allocated_p_regions ffffffff80713930 l F .text 00000000000000a4 lookupIOPTSlot_resolve_levels ffffffff807139e0 l F .text 00000000000000b9 vtd_process_faults ffffffff80713aa0 l F .text 000000000000005b single_ioapic_init ffffffff80723ae0 l O .bss 0000000000000060 ioredtbl_state ffffffff80713b00 l F .text 000000000000005e lookupPDPTSlot ffffffff801060e0 l F .boot 0000000000000037 init_pat_msr.part.173 ffffffff80713b60 l F .text 0000000000000016 Arch_fpuThreadDelete.part.177 ffffffff80713b80 l F .text 0000000000000046 preemptionPoint.part.183 ffffffff80713bd0 l F .text 0000000000000094 tcbSchedEnqueue.part.186 ffffffff80713c70 l F .text 0000000000000094 tcbSchedAppend.part.189 ffffffff80713d10 l F .text 0000000000000026 invokeTCB_NotificationControl.part.193 ffffffff80713d40 l F .text 000000000000009a parse_bool.constprop.210 ffffffff80714120 l F .text 000000000000014e cap_get_capPtr ffffffff80714270 l F .text 000000000000002c cap_get_capMappedASID ffffffff80714540 l F .text 000000000000006d lookup_vtd_context_slot ffffffff807146d0 l F .text 0000000000000071 makeUserPDPTEHugePage ffffffff80106d30 l F .boot 000000000000005e add_mem_p_regs ffffffff807150d0 l F .text 0000000000000076 unmapPDPT ffffffff8010e920 l O .boot.bss 0000000000000018 cpu_identity ffffffff80716640 l F .text 0000000000000088 possibleSwitchTo ffffffff807166f0 l F .text 0000000000000021 scheduleTCB.part.187 ffffffff80716740 l F .text 0000000000000012 setThreadState.part.188 ffffffff80717390 l F .text 000000000000001a capSwapForDelete.part.184 ffffffff80723ad0 l O .bss 0000000000000004 num_ioapics ffffffff80723ac8 l O .bss 0000000000000008 ioapic_target_cpu ffffffff8071ce80 l F .text 0000000000000062 maskInterrupt.part.196 ffffffff8071d100 l F .text 0000000000000113 emptySlot.part.197 ffffffff8071d220 l F .text 000000000000004a cteDeleteOne.part.198 ffffffff8071d3b0 l F .text 000000000000004d handleReply ffffffff8071e3a0 l F .text 00000000000001cc handleRecv ffffffff80720b00 l F .text 00000000000001b4 handleInvocation ffffffff80723b40 l O .bss 0000000000000008 control_reg_order ffffffff80712e90 g F .text 0000000000000038 int_d3 000000000010117b g F .phys 000000000000005e syscall_check ffffffff80733000 g .ehframe 0000000000000000 ki_end ffffffff80714da0 g F .text 000000000000001f findMapForASID ffffffff8071dc80 g F .text 00000000000000f0 decodeWriteRegisters ffffffff807122c0 g F .text 0000000000000038 int_9d ffffffff80712fe0 g F .text 0000000000000038 int_d9 ffffffff80713750 g F .text 0000000000000038 int_fb ffffffff8010d620 g F .boot 000000000000012f apic_init ffffffff80712b10 g F .text 0000000000000038 int_c3 ffffffff80715a10 g F .text 0000000000000011 decodeX86IOSpaceInvocation ffffffff80712e20 g F .text 0000000000000038 int_d1 ffffffff80710f48 g F .text 0000000000000038 int_44 ffffffff807100ae g F .text 0000000000000038 int_01 ffffffff807120c8 g F .text 0000000000000038 int_94 ffffffff80721520 g F .text 0000000000000022 c_handle_syscall ffffffff80711ca0 g F .text 0000000000000038 int_81 ffffffff807101fe g F .text 0000000000000038 int_07 ffffffff80712d08 g F .text 0000000000000038 int_cc ffffffff8010cbf0 g F .boot 00000000000001ba acpi_dmar_scan ffffffff807185c0 g F .text 00000000000007b2 decodeX86ModeMMUInvocation ffffffff8010e120 g F .boot 00000000000001c5 x86_cpuid_initialize ffffffff80717130 g F .text 0000000000000096 cteMove ffffffff80724000 g O .bss 0000000000000010 current_fault ffffffff80711f40 g F .text 0000000000000038 int_8d ffffffff807103b2 g F .text 0000000000000038 int_0f ffffffff80710ab0 g F .text 0000000000000038 int_2f ffffffff80724010 g O .bss 0000000000000008 seL4_VMFault_Msg ffffffff801061d0 g F .boot 0000000000000021 apic_send_init_ipi ffffffff807184f0 g F .text 0000000000000082 isFinalCapability ffffffff80717870 g F .text 0000000000000012 isIRQActive ffffffff8071e370 g F .text 0000000000000025 deleteCallerCap ffffffff807145b0 g F .text 0000000000000085 makeUserPDELargePage ffffffff807118b0 g F .text 0000000000000038 int_6f ffffffff80715be0 g F .text 0000000000000077 Arch_maskCapRights ffffffff80719690 g F .text 00000000000000ae lookupExtraCaps ffffffff8010d810 g F .boot 00000000000000fe tsc_init ffffffff8071a030 g F .text 0000000000000021 performInvocation_Endpoint ffffffff807168e0 g F .text 0000000000000210 decodeX86PortInvocation ffffffff80107090 g F .boot 00000000000031c4 init_vm_state ffffffff80710960 g F .text 0000000000000038 int_29 ffffffff80712aa0 g F .text 0000000000000038 int_c1 ffffffff80713478 g F .text 0000000000000038 int_ee ffffffff807190b0 g F .text 000000000000011c createNewObjects ffffffff80711b88 g F .text 0000000000000038 int_7c ffffffff807155d0 g F .text 0000000000000042 switchLocalFpuOwner ffffffff80714f20 g F .text 0000000000000005 Arch_switchToThread ffffffff80715a30 g F .text 00000000000000c5 Arch_deriveCap ffffffff80713050 g F .text 0000000000000038 int_db ffffffff80713e90 g F .text 0000000000000030 makeUserPDEPageTable ffffffff80711e60 g F .text 0000000000000038 int_89 ffffffff80710ed8 g F .text 0000000000000038 int_42 ffffffff8071382a g F .text 0000000000000035 int_ff ffffffff807118e8 g F .text 0000000000000038 int_70 ffffffff80714d90 g F .text 0000000000000002 isValidNativeRoot ffffffff80710e30 g F .text 0000000000000038 int_3f ffffffff80724018 g O .bss 0000000000000008 seL4_UnknownSyscall_Msg ffffffff80719320 g F .text 0000000000000092 chooseThread ffffffff8071ef60 g F .text 00000000000002d0 invokeTCB_ThreadControl ffffffff80725000 g O .bss 0000000000001000 x64KSGlobalPD ffffffff8010b1e0 g F .boot 00000000000004b1 create_it_address_space ffffffff80712b80 g F .text 0000000000000038 int_c5 ffffffff80711df0 g F .text 0000000000000038 int_87 0000000000100000 g *ABS* 0000000000000000 PADDR_LOAD ffffffff80716e30 g F .text 000000000000005f timerTick ffffffff80712d40 g F .text 0000000000000038 int_cd ffffffff80715350 g F .text 00000000000000f7 unmapPage ffffffff80711098 g F .text 0000000000000038 int_4a ffffffff80723a14 g O .rodata 0000000000000004 gpRegisters ffffffff8071d9c0 g F .text 0000000000000010 invokeTCB_Resume ffffffff807132b8 g F .text 0000000000000038 int_e6 ffffffff80712560 g F .text 0000000000000038 int_a9 ffffffff80718580 g F .text 000000000000003d slotCapLongRunningDelete ffffffff80726000 g O .bss 0000000000000008 seL4_CapFault_Msg ffffffff80106000 g F .boot 0000000000000027 _entry_64 ffffffff80711258 g F .text 0000000000000038 int_52 ffffffff80711370 g F .text 0000000000000038 int_57 ffffffff80710458 g F .text 0000000000000038 int_12 ffffffff80726008 g O .bss 0000000000000008 x64KSCurrentCR3
.phys.bss . (NOLOAD) :
architecture: i386:x86-64, flags 0x00000012: EXEC_P, HAS_SYMS start address 0x00000000001012b3 Program Header: LOAD off 0x0000000000001000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12 filesz 0x0000000000000000 memsz 0x0000000000003000 flags rw- LOAD off 0x0000000000000160 vaddr 0xffffffff80003000 paddr 0x0000000000003000 align 2**5 filesz 0x0000000000008918 memsz 0x000000000060a000 flags rwx LOAD off 0x0000000000009000 vaddr 0x0000000000100000 paddr 0x0000000000100000 align 2**12 filesz 0x0000000000003000 memsz 0x0000000000003000 flags r-- LOAD off 0x000000000000c000 vaddr 0xffffffff8060d000 paddr 0x000000000060d000 align 2**12 filesz 0x0000000000013aa7 memsz 0x0000000000023000 flags rwx STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4 filesz 0x0000000000000000 memsz 0x0000000000000000 flags rwx Sections: Idx Name Size VMA LMA File off Algn 0 .phys 00003000 0000000000100000 0000000000100000 00009000 2**12 CONTENTS, ALLOC, LOAD, READONLY, DATA 1 .phys.bss 00003000 0000000000000000 0000000000000000 00001000 2**12 ALLOC 2 .boot 00008918 ffffffff80003000 0000000000003000 00000160 2**5 CONTENTS, ALLOC, LOAD, CODE 3 .boot.bss 006016e8 ffffffff8000b918 000000000000b918 00008a78 2**5 ALLOC 4 .text 00011735 ffffffff8060d000 000000000060d000 0000c000 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 5 .rodata 00002372 ffffffff8061e735 000000000061e735 0001d735 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .bss 0000e571 ffffffff80620aa7 0000000000620aa7 0001faa7 2**12 ALLOC 7 .ehframe 00000fe8 ffffffff8062f018 000000000062f018 0001faa7 2**0 ALLOC SYMBOL TABLE: 0000000000100000 l d .phys 0000000000000000 .phys 0000000000000000 l d .phys.bss 0000000000000000 .phys.bss ffffffff80003000 l d .boot 0000000000000000 .boot ffffffff8000b918 l d .boot.bss 0000000000000000 .boot.bss ffffffff8060d000 l d .text 0000000000000000 .text ffffffff8061e735 l d .rodata 0000000000000000 .rodata ffffffff80620aa7 l d .bss 0000000000000000 .bss ffffffff8062f018 l d .ehframe 0000000000000000 .ehframe 0000000000000000 l df *ABS* 0000000000000000 src/arch/x86/64/head.o 000000000010102e l .phys 0000000000000000 huge_page_error_string 0000000000000029 l *ABS* 0000000000000000 huge_page_error_size 00000000001010ff l .phys 0000000000000000 pcid_error_string 0000000000000025 l *ABS* 0000000000000000 pcid_error_size 0000000000101148 l .phys 0000000000000000 invpcid_error_string 0000000000000033 l *ABS* 0000000000000000 invpcid_error_size 000000000010119f l .phys 0000000000000000 syscall_error_string 000000000000003a l *ABS* 0000000000000000 syscall_error_size 0000000000101205 l .phys 0000000000000000 fsgsbase_error_string 0000000000000035 l *ABS* 0000000000000000 fsgsbase_error_size 0000000000102010 l .phys 0000000000000000 _gdt64_ptr 0000000000102020 l .phys 0000000000000000 _gdt64 0000000000000000 l df *ABS* 0000000000000000 kernel_final.c ffffffff80003030 l F .boot 00000000000000a5 merge_regions ffffffff8020c0c0 l O .boot.bss 0000000000400118 allocated_p_regions ffffffff80610930 l F .text 00000000000000a4 lookupIOPTSlot_resolve_levels ffffffff806109e0 l F .text 00000000000000b9 vtd_process_faults ffffffff80610aa0 l F .text 000000000000005b single_ioapic_init ffffffff80620ae0 l O .bss 0000000000000060 ioredtbl_state ffffffff80610b00 l F .text 000000000000005e lookupPDPTSlot ffffffff800030e0 l F .boot 0000000000000037 init_pat_msr.part.173 ffffffff80610b60 l F .text 0000000000000016 Arch_fpuThreadDelete.part.177 ffffffff80610b80 l F .text 0000000000000046 preemptionPoint.part.183 ffffffff80610bd0 l F .text 0000000000000094 tcbSchedEnqueue.part.186 ffffffff80610c70 l F .text 0000000000000094 tcbSchedAppend.part.189 ffffffff80610d10 l F .text 0000000000000026 invokeTCB_NotificationControl.part.193 ffffffff80610d40 l F .text 000000000000009a parse_bool.constprop.210 ffffffff80611120 l F .text 000000000000014e cap_get_capPtr ffffffff80611270 l F .text 000000000000002c cap_get_capMappedASID ffffffff80611540 l F .text 000000000000006d lookup_vtd_context_slot ffffffff806116d0 l F .text 0000000000000071 makeUserPDPTEHugePage ffffffff80003d30 l F .boot 000000000000005e add_mem_p_regs ffffffff806120d0 l F .text 0000000000000076 unmapPDPT ffffffff8000b920 l O .boot.bss 0000000000000018 cpu_identity ffffffff80613640 l F .text 0000000000000088 possibleSwitchTo ffffffff806136f0 l F .text 0000000000000021 scheduleTCB.part.187 ffffffff80613740 l F .text 0000000000000012 setThreadState.part.188 ffffffff80614390 l F .text 000000000000001a capSwapForDelete.part.184 ffffffff80620ad0 l O .bss 0000000000000004 num_ioapics ffffffff80620ac8 l O .bss 0000000000000008 ioapic_target_cpu ffffffff80619e80 l F .text 0000000000000062 maskInterrupt.part.196 ffffffff8061a100 l F .text 0000000000000113 emptySlot.part.197 ffffffff8061a220 l F .text 000000000000004a cteDeleteOne.part.198 ffffffff8061a3b0 l F .text 000000000000004d handleReply ffffffff8061b3a0 l F .text 00000000000001cc handleRecv ffffffff8061db00 l F .text 00000000000001b4 handleInvocation ffffffff80620b40 l O .bss 0000000000000008 control_reg_order ffffffff8060fe90 g F .text 0000000000000038 int_d3 000000000010117b g F .phys 000000000000005e syscall_check ffffffff80630000 g .ehframe 0000000000000000 ki_end ffffffff80611da0 g F .text 000000000000001f findMapForASID ffffffff8061ac80 g F .text 00000000000000f0 decodeWriteRegisters ffffffff8060f2c0 g F .text 0000000000000038 int_9d ffffffff8060ffe0 g F .text 0000000000000038 int_d9 ffffffff80610750 g F .text 0000000000000038 int_fb ffffffff8000a620 g F .boot 000000000000012f apic_init ffffffff8060fb10 g F .text 0000000000000038 int_c3 ffffffff80612a10 g F .text 0000000000000011 decodeX86IOSpaceInvocation ffffffff8060fe20 g F .text 0000000000000038 int_d1 ffffffff8060df48 g F .text 0000000000000038 int_44 ffffffff8060d0ae g F .text 0000000000000038 int_01 ffffffff8060f0c8 g F .text 0000000000000038 int_94 ffffffff8061e520 g F .text 0000000000000022 c_handle_syscall ffffffff8060eca0 g F .text 0000000000000038 int_81 ffffffff8060d1fe g F .text 0000000000000038 int_07 ffffffff8060fd08 g F .text 0000000000000038 int_cc ffffffff80009bf0 g F .boot 00000000000001ba acpi_dmar_scan ffffffff806155c0 g F .text 00000000000007b2 decodeX86ModeMMUInvocation ffffffff8000b120 g F .boot 00000000000001c5 x86_cpuid_initialize ffffffff80614130 g F .text 0000000000000096 cteMove ffffffff80621000 g O .bss 0000000000000010 current_fault ffffffff8060ef40 g F .text 0000000000000038 int_8d ffffffff8060d3b2 g F .text 0000000000000038 int_0f ffffffff8060dab0 g F .text 0000000000000038 int_2f ffffffff80621010 g O .bss 0000000000000008 seL4_VMFault_Msg ffffffff800031d0 g F .boot 0000000000000021 apic_send_init_ipi ffffffff806154f0 g F .text 0000000000000082 isFinalCapability ffffffff80614870 g F .text 0000000000000012 isIRQActive ffffffff8061b370 g F .text 0000000000000025 deleteCallerCap ffffffff806115b0 g F .text 0000000000000085 makeUserPDELargePage ffffffff8060e8b0 g F .text 0000000000000038 int_6f ffffffff80612be0 g F .text 0000000000000077 Arch_maskCapRights ffffffff80616690 g F .text 00000000000000ae lookupExtraCaps ffffffff8000a810 g F .boot 00000000000000fe tsc_init ffffffff80617030 g F .text 0000000000000021 performInvocation_Endpoint ffffffff806138e0 g F .text 0000000000000210 decodeX86PortInvocation ffffffff80004090 g F .boot 00000000000031c4 init_vm_state ffffffff8060d960 g F .text 0000000000000038 int_29 ffffffff8060faa0 g F .text 0000000000000038 int_c1 ffffffff80610478 g F .text 0000000000000038 int_ee ffffffff806160b0 g F .text 000000000000011c createNewObjects ffffffff8060eb88 g F .text 0000000000000038 int_7c ffffffff806125d0 g F .text 0000000000000042 switchLocalFpuOwner ffffffff80611f20 g F .text 0000000000000005 Arch_switchToThread ffffffff80612a30 g F .text 00000000000000c5 Arch_deriveCap ffffffff80610050 g F .text 0000000000000038 int_db ffffffff80610e90 g F .text 0000000000000030 makeUserPDEPageTable ffffffff8060ee60 g F .text 0000000000000038 int_89 ffffffff8060ded8 g F .text 0000000000000038 int_42 ffffffff8061082a g F .text 0000000000000035 int_ff ffffffff8060e8e8 g F .text 0000000000000038 int_70 ffffffff80611d90 g F .text 0000000000000002 isValidNativeRoot ffffffff8060de30 g F .text 0000000000000038 int_3f ffffffff80621018 g O .bss 0000000000000008 seL4_UnknownSyscall_Msg ffffffff80616320 g F .text 0000000000000092 chooseThread ffffffff8061bf60 g F .text 00000000000002d0 invokeTCB_ThreadControl ffffffff80622000 g O .bss 0000000000001000 x64KSGlobalPD ffffffff800081e0 g F .boot 00000000000004b1 create_it_address_space ffffffff8060fb80 g F .text 0000000000000038 int_c5 ffffffff8060edf0 g F .text 0000000000000038 int_87 0000000000100000 g *ABS* 0000000000000000 PADDR_LOAD ffffffff80613e30 g F .text 000000000000005f timerTick ffffffff8060fd40 g F .text 0000000000000038 int_cd ffffffff80612350 g F .text 00000000000000f7 unmapPage ffffffff8060e098 g F .text 0000000000000038 int_4a ffffffff80620a14 g O .rodata 0000000000000004 gpRegisters ffffffff8061a9c0 g F .text 0000000000000010 invokeTCB_Resume ffffffff806102b8 g F .text 0000000000000038 int_e6 ffffffff8060f560 g F .text 0000000000000038 int_a9 ffffffff80615580 g F .text 000000000000003d slotCapLongRunningDelete ffffffff80623000 g O .bss 0000000000000008 seL4_CapFault_Msg ffffffff80003000 g F .boot 0000000000000027 _entry_64 ffffffff8060e258 g F .text 0000000000000038 int_52 ffffffff8060e370 g F .text 0000000000000038 int_57 ffffffff8060d458 g F .text 0000000000000038 int_12 ffffffff80623008 g O .bss 0000000000000008 x64KSCurrentCR3
User contributions licensed under CC BY-SA 3.0