Clemens Fischer
2003-Aug-22 06:46 UTC
kernel: locore.s doesn't assemble (fillkpt, $PAGE_SHIFT, $PTESHIFT)
since august 8th, 2003 the kernel on my i386 pentiumIII won't compile. the problem arises in locore.s with the definition of the constants $PAGE_SHIFT and $PTESHIFT used in `shr' and `shl' instructions within the macros `fillkpt' and `fillkptphys'. i've tried to cvsup(1) RELENG_4 and RELENG_4_8 every day for over a week now, but kernel builds (as part of a buildworld) don't work anymore. i have set up an area different from the usual /usr/obj/, so i can experiment. if somebody has tips for me, i could do a lot without destroying what's left of my last clean install. locore.s depends on a number of files, one of which is assym.s. assym.s should "#define PAGE_SHIFT ...", but the file is empty (but it exists!). $PTESHIFT comes from machine/pmap.h, but this file exists and defines this constant. here's the make-log, with the offending lines right beneith the error messages. the formatting comes from the way cpp(1) expands macros: --8<---cut here:--start--->8-- Examining locore.o...non-existent...modified before source...out-of-date. cc -c -x assembler-with-cpp -DLOCORE -O -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I/www/freebsd/RELENG_4/src/sys -I/www/ freebsd/RELENG_4/src/sys/../include -I/www/freebsd/RELENG_4/src/sys/contrib/ipfilter -D_KERNEL -include opt_global.h -mpr eferred-stack-boundary=2 /www/freebsd/RELENG_4/src/sys/i386/i386/locore.s /tmp/ccOO8Chb.s: Assembler messages: /tmp/ccOO8Chb.s:2495: Error: suffix or operands invalid for `shr' shrl $PAGE_SHIFT,%ecx /tmp/ccOO8Chb.s:2496: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2496: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl %edx ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2512: Error: suffix or operands invalid for `shr' shrl $PAGE_SHIFT,%ecx /tmp/ccOO8Chb.s:2513: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2513: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl %edx ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2518: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2518: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %ea x,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2523: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2523: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %ea x,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2528: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2528: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %ea x,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2533: Error: suffix or operands invalid for `shr' /tmp/ccOO8Chb.s:2533: Error: suffix or operands invalid for `shl' movl %eax, %ebx ; shrl $PAGE_SHIFT, %ebx ; shll $PTESHIFT,%ebx ; addl (( KPTphys )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %ea x,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2539: Error: suffix or operands invalid for `shl' shll $PTESHIFT,%ebx ; addl (( vm86pa )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 | 0x004 ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2545: Error: suffix or operands invalid for `shl' shll $PTESHIFT,%ebx ; addl (( vm86pa )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 | 0x004 ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2554: Error: suffix or operands invalid for `shl' shll $PTESHIFT,%ebx ; addl (( IdlePTD )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2560: Error: suffix or operands invalid for `shl' shll $PTESHIFT,%ebx ; addl (( IdlePTD )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b /tmp/ccOO8Chb.s:2566: Error: suffix or operands invalid for `shl' shll $PTESHIFT,%ebx ; addl (( IdlePTD )-KERNBASE) ,%ebx ; orl $0x001 ,%eax ; orl $0x002 ,%eax ; 1: movl %eax,(%ebx) ; addl $PAGE_SIZE,%eax ; addl $PTESIZE,%ebx ; loop 1b *** Error code 1 Stop in /www/freebsd/obj/www/freebsd/RELENG_4/src/sys/n1. --8<---cut here:---end---->8-- btw: the .depend in my kernel build staging area lists more files than locore.s itself includes, and all opt_*.h files are empty, as is assym.s. i have checked the genassym.sh script and tried the nm(1) tool, re-installed perl (fearing that this beast was responsible) and tried to track the problem to the actual point of failure, but the number of files and procedures involved is too much for me. this problem needs someone who knows how building the kernel works. regards, clemens
Bosko Milekic
2003-Aug-22 08:54 UTC
kernel: locore.s doesn't assemble (fillkpt, $PAGE_SHIFT, $PTESHIFT)
Please show us exactly what you're doing to build the kernel. Try whiping the old kernel build directory and make sure that after you config you make depend before you make. -- Bosko Milekic * bmilekic@technokratis.com * bmilekic@FreeBSD.org TECHNOkRATIS Consulting Services * http://www.technokratis.com/
Clemens Fischer
2003-Aug-23 06:43 UTC
kernel: locore.s doesn't assemble (fillkpt, $PAGE_SHIFT, $PTESHIFT)
* Luoqi Chen:>> since august 8th, 2003 the kernel on my i386 pentiumIII won't >> compile. the problem arises in locore.s with the definition of the >> constants $PAGE_SHIFT and $PTESHIFT used in `shr' and `shl' >> instructions within the macros `fillkpt' and `fillkptphys'. >> > Did you do a make depend beforehand? The assym.s file is generated > during the make depend phase.yes, i go by the book. but while tracking RELENG_4 i use "make buildworld && make buildkernel KERNCONF=n1 && make installkernel KERNCONF=n1", just as outlined in usr/src/Makefile. i'll check assym.s right after "make depend", that's a good idea! /sys/compile/n1 1 p2 # cc -c -O -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I../.. -I../../../include -I../../contrib/dev/acpica -I../../contrib/ipfilter -D_KERNEL -include opt_global.h -mpreferred-stack-boundary=2 ../../i386/i386/genassym.c 0 p2 # lt|tail 1334981 -rw-r--r-- 1 root wheel - 0 Aug 23 14:57 assym.s 1334281 -rw-r--r-- 1 root wheel - 14202 Aug 23 14:59 genassym.o 1334458 drwxr-xr-x 2 root wheel - 10752 Aug 23 14:59 ./ 0 p2 # sh ../../kern/genassym.sh genassym.o > assym.s 0 p2 # lt|tail 1334281 -rw-r--r-- 1 root wheel - 14202 Aug 23 14:59 genassym.o 1334458 drwxr-xr-x 2 root wheel - 10752 Aug 23 14:59 ./ 1334981 -rw-r--r-- 1 root wheel - 0 Aug 23 14:59 assym.s but i found something very interesting: basically genassym.sh is a boune-shell script doing "nm <object-file> | awk 'awk-script'". genassym.o is that object file, and it sure contains all the symbols needed. so i ran this line manually, and the result was correct, all the symbols needed were either on stdout or in assym.s! my question is this: why does sys/kern/genassym.sh have this funny redirection (`3>/dev/stdout >&3 3>&-') at the end? why not only write `> "$outfile"'? i tried this version, and it works perfectly fine. the original line highly depends on when the shell does redirection. i don't understand why fd-3 is used at all, why it is closed, redirected from stdout and redirected to the file which can be specified with the `-o' option to genassym.sh. the simple version would do this equaly well, without complications. i have to admit, though, that i don't understand why nobody else is experiencing this problem. i have a build running currently, but with creating assym.s manually as a workaround i think i'll be able to install world and kernel fine. clemens