From 700ac7a490b46d5ddc1e730c971bc6f7ec9d70ca Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 13 Jul 2009 16:49:50 +0100 Subject: x86-64: reduce symbol table size With all of Xen's symbols sitting within a 2Gb range on x86-64, they can be referred to by the kallsyms-like offset table using 4- instead of 8-byte slots. The marker table can use 4-byte slots in all cases, just like the table entry counts can (though that's only a minor improvement). If ia64's PERCPU_ADDR got moved down to (KERNEL_START + 2Gb - PERCPU_PAGE_SIZE), it could also utilize the more compact form. Signed-off-by: Jan Beulich --- xen/tools/symbols.c | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) (limited to 'xen/tools') diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c index bf632d7aea..f39c906d5b 100644 --- a/xen/tools/symbols.c +++ b/xen/tools/symbols.c @@ -108,10 +108,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) else if (toupper((uint8_t)stype) == 'A') { /* Keep these useful absolute symbols */ - if (strcmp(sym, "__kernel_syscall_via_break") && - strcmp(sym, "__kernel_syscall_via_epc") && - strcmp(sym, "__kernel_sigtramp") && - strcmp(sym, "__gp")) + if (strcmp(sym, "__gp")) return -1; } @@ -134,24 +131,6 @@ static int read_symbol(FILE *in, struct sym_entry *s) static int symbol_valid(struct sym_entry *s) { - /* Symbols which vary between passes. Passes 1 and 2 must have - * identical symbol lists. The symbols_* symbols below are only added - * after pass 1, they would be included in pass 2 when --all-symbols is - * specified so exclude them to get a stable symbol list. - */ - static char *special_symbols[] = { - "symbols_addresses", - "symbols_num_syms", - "symbols_names", - "symbols_markers", - "symbols_token_table", - "symbols_token_index", - - /* Exclude linker generated symbols which vary between passes */ - "_SDA_BASE_", /* ppc */ - "_SDA2_BASE_", /* ppc */ - NULL }; - int i; int offset = 1; /* skip prefix char */ @@ -181,10 +160,6 @@ static int symbol_valid(struct sym_entry *s) if (strstr((char *)s->sym + offset, "_compiled.")) return 0; - for (i = 0; special_symbols[i]; i++) - if( strcmp((char *)s->sym + offset, special_symbols[i]) == 0 ) - return 0; - return 1; } @@ -251,8 +226,9 @@ static void write_src(void) unsigned int *markers; char buf[KSYM_NAME_LEN+1]; + printf("#include \n"); printf("#include \n"); - printf("#if BITS_PER_LONG == 64\n"); + printf("#if BITS_PER_LONG == 64 && !defined(SYMBOLS_ORIGIN)\n"); printf("#define PTR .quad\n"); printf("#define ALGN .align 8\n"); printf("#else\n"); @@ -260,16 +236,21 @@ static void write_src(void) printf("#define ALGN .align 4\n"); printf("#endif\n"); - printf(".data\n"); + printf("\t.section .rodata, \"a\"\n"); + printf("#ifndef SYMBOLS_ORIGIN\n"); + printf("#define SYMBOLS_ORIGIN 0\n"); output_label("symbols_addresses"); + printf("#else\n"); + output_label("symbols_offsets"); + printf("#endif\n"); for (i = 0; i < table_cnt; i++) { - printf("\tPTR\t%#llx\n", table[i].addr); + printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n", table[i].addr); } printf("\n"); output_label("symbols_num_syms"); - printf("\tPTR\t%d\n", table_cnt); + printf("\t.long\t%d\n", table_cnt); printf("\n"); /* table of offset markers, that give the offset in the compressed stream @@ -293,7 +274,7 @@ static void write_src(void) output_label("symbols_markers"); for (i = 0; i < ((table_cnt + 255) >> 8); i++) - printf("\tPTR\t%d\n", markers[i]); + printf("\t.long\t%d\n", markers[i]); printf("\n"); free(markers); -- cgit v1.2.3