diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-12-30 10:14:32 -0600 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-12-30 10:14:32 -0600 |
| commit | be74f368e44605c4bf0cf3c4c2696f380ae22a29 (patch) | |
| tree | 4c4b7df02410136a64608f86b00936efcf3fb54e /scripts | |
| parent | f5a46614de328e867f778e4dffa71b48eb29340f (diff) | |
kbuild: Fix kallsyms on 64 bit archs
The generated .tmp_kallsyms.S needs to use .long / .quad for
32/64 bit archs. To know which arch we're compiling for, we
use the preprocessor and BITS_PER_LONG from <asm/types.h>.
Unfortunately, asm/types.h was not safe to include from assembler
files, so lots of #ifndef __ASSEMBLY__ needed to be added - should
be fine now, untested for != i386, though.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kallsyms.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 88bd3c12d1d8..bb0f57dc1cd4 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -95,10 +95,19 @@ write_src(void) int i, valid = 0; char *prev; + printf("#include <asm/types.h>\n"); + printf("#if BITS_PER_LONG == 64\n"); + printf("#define PTR .quad\n"); + printf("#define ALGN .align 8\n"); + printf("#else\n"); + printf("#define PTR .long\n"); + printf("#define ALGN .align 4\n"); + printf("#endif\n"); + printf(".data\n"); printf(".globl kallsyms_addresses\n"); - printf("\t.align 8\n"); + printf("\tALGN\n"); printf("kallsyms_addresses:\n"); for (i = 0, last_addr = 0; i < cnt; i++) { if (!symbol_valid(&table[i])) @@ -107,20 +116,20 @@ write_src(void) if (table[i].addr == last_addr) continue; - printf("\t.long\t%#llx\n", table[i].addr); + printf("\tPTR\t%#llx\n", table[i].addr); valid++; last_addr = table[i].addr; } printf("\n"); printf(".globl kallsyms_num_syms\n"); - printf("\t.align 8\n"); + printf("\tALGN\n"); printf("kallsyms_num_syms:\n"); - printf("\t.long\t%d\n", valid); + printf("\tPTR\t%d\n", valid); printf("\n"); printf(".globl kallsyms_names\n"); - printf("\t.align 8\n"); + printf("\tALGN\n"); printf("kallsyms_names:\n"); prev = ""; for (i = 0, last_addr = 0; i < cnt; i++) { |
