From 35d1a6ef41fa716503925226837cf0f0b8894a90 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Thu, 18 Apr 2024 03:03:27 +0200 Subject: linker: "optimize" section arrangements 1. throw vectors in a custom ".reserved" section 2. throw idt in a NOLOAD ".reserved_0" section: save some binary size (like .bss) since we don't care for its initial value. 3. squash all ".data.*" sections from rust into ".data" --- src/arch/x86_64/asm/vectors.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/arch') diff --git a/src/arch/x86_64/asm/vectors.s b/src/arch/x86_64/asm/vectors.s index ba5fb87..2798032 100644 --- a/src/arch/x86_64/asm/vectors.s +++ b/src/arch/x86_64/asm/vectors.s @@ -5,7 +5,7 @@ [GLOBAL vectors_start] [EXTERN interrupt_gate] -[SECTION .data.idt] +[SECTION .reserved_0.idt] ; ; Interrupt descriptor table with 256 entries ; TODO: use a interrupt stack instead of the current stack. @@ -14,6 +14,7 @@ idt: ; reserve space for 256x idt entries (16 bytes each) resb 16 * 256 +[SECTION .reserved] idt_descr: dw 256*8 - 1 ; 256 entries dq idt @@ -22,6 +23,7 @@ idt_descr: ; bytes. DO NOT modify the wrapper, instead change the wrapper_body if needed. ; if the vector has to be modified into more than 16 bytes, ; arch::x86_64:: interrupt::_idt_init() must be modified accordingly +[SECTION .reserved.vectors] %macro wrapper 1 align 16 wrapper_%1: @@ -34,7 +36,6 @@ wrapper_%1: ; automatic generation of 256 interrupt-handling routines, based on above macro -[SECTION .data.vectors] vectors_start: %assign i 0 %rep 256 -- cgit v1.2.3-70-g09d2