diff options
author | Richard Braun <rbraun@sceen.net> | 2012-11-09 22:05:35 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2012-11-09 22:06:21 +0100 |
commit | 7ac57ae95ef88c9b232314578df240bd20679993 (patch) | |
tree | f934a458df97e00ed079c4fdd7557abffcee3b6b | |
parent | 2e842bf0943e3f16eddb85fff842ecd73791d3cb (diff) |
x86: linker script and assembly tidying
Build with -fno-asynchronous-unwind-tables so that a .debug_frame
section is properly created, discard .eh_frame, and don't generate
xxx_end symbols when using ASM_END. Also, remove the unused ASM_IRET
macro.
-rw-r--r-- | arch/x86/Makefrag.am | 4 | ||||
-rw-r--r-- | arch/x86/machine/asm.h | 17 | ||||
-rw-r--r-- | arch/x86/machine/boot_asm.S | 1 | ||||
-rw-r--r-- | arch/x86/x15.lds.S | 20 |
4 files changed, 24 insertions, 18 deletions
diff --git a/arch/x86/Makefrag.am b/arch/x86/Makefrag.am index a6baf70d..71aabbc9 100644 --- a/arch/x86/Makefrag.am +++ b/arch/x86/Makefrag.am @@ -37,6 +37,10 @@ EXTRA_DIST += arch/x86/x15.lds.S $(x86_FILES) if X86 +# Store unwind information in .debug_frame instead of .eh_frame. Unwind +# tables aren't used at runtime, so using a debug section reduces the kernel +# code size. +AM_CFLAGS += -fno-asynchronous-unwind-tables x15_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 if I386 diff --git a/arch/x86/machine/asm.h b/arch/x86/machine/asm.h index c2c4e997..6118bb8a 100644 --- a/arch/x86/machine/asm.h +++ b/arch/x86/machine/asm.h @@ -18,9 +18,11 @@ #ifndef _X86_ASM_H #define _X86_ASM_H -#include <machine/param.h> +#ifndef __ASSEMBLER__ +#warning "asm.h included from a C file" +#endif /* __ASSEMBLER__ */ -#ifdef __ASSEMBLER__ +#include <machine/param.h> #define ASM_ENTRY(x) \ .align TEXT_ALIGN; \ @@ -35,15 +37,6 @@ x: x: #define ASM_END(x) \ -.size x, . - x; \ -x ## _end: - -#ifdef __LP64__ -#define ASM_IRET iretq -#else /* __LP64__ */ -#define ASM_IRET iret -#endif /* __LP64__ */ - -#endif /* __ASSEMBLER__ */ +.size x, . - x #endif /* _X86_ASM_H */ diff --git a/arch/x86/machine/boot_asm.S b/arch/x86/machine/boot_asm.S index 49074f94..d29689e2 100644 --- a/arch/x86/machine/boot_asm.S +++ b/arch/x86/machine/boot_asm.S @@ -290,6 +290,7 @@ ASM_DATA(boot_gdt) .quad 0x00209a0000000000 /* 64-bit code segment selector */ #endif /* __LP64__ */ ASM_END(boot_gdt) +boot_gdt_end: ASM_DATA(boot_mp_trampoline_size) .long . - boot_mp_trampoline diff --git a/arch/x86/x15.lds.S b/arch/x86/x15.lds.S index 4959c067..8d144d12 100644 --- a/arch/x86/x15.lds.S +++ b/arch/x86/x15.lds.S @@ -25,7 +25,7 @@ SECTIONS . = BOOT_OFFSET; _init = .; - .init ALIGN(PAGE_SIZE): { + .init ALIGN(PAGE_SIZE) : { *(.init.hdr) *(.init.text) *(.init.data) @@ -37,33 +37,41 @@ SECTIONS . += KERNEL_OFFSET; _text = .; - .text ALIGN(PAGE_SIZE): AT(BOOT_VTOP(ADDR(.text))) { + .text ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.text))) { *(.text) } : text . = ALIGN(PAGE_SIZE); _rodata = .; - .rodata ALIGN(PAGE_SIZE): AT(BOOT_VTOP(ADDR(.rodata))) { + .rodata ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.rodata))) { *(.rodata) } : rodata - .notes ALIGN(8): AT(BOOT_VTOP(ADDR(.notes))) { + .notes ALIGN(8) : AT(BOOT_VTOP(ADDR(.notes))) { *(.note.*) } : rodata . = ALIGN(PAGE_SIZE); _data = .; - .data ALIGN(PAGE_SIZE): AT(BOOT_VTOP(ADDR(.data))) { + .data ALIGN(PAGE_SIZE) : AT(BOOT_VTOP(ADDR(.data))) { *(.data) } : data - .bss ALIGN(8): AT(BOOT_VTOP(ADDR(.bss))) { + .bss ALIGN(8) : AT(BOOT_VTOP(ADDR(.bss))) { *(.bss) *(COMMON) } : data . = ALIGN(PAGE_SIZE); _end = .; + + /* + * A global offset section is created because of linking with libgcc. + * Is it safe to discard it ? + */ + /DISCARD/ : { + *(.eh_frame) + } } |