Hi! While working on a vax-linux cross-compiler, I noticed that my vax-linux kernel won't boot. I tracked this down to a function that re-calculates addresses (VM addresses to physical addresses for things that run before VM is switched on). I've then ran the C file through the preprocessor and put it through my host compiler (gcc-3.3.x on PeeCee). Same result even there. Testcase: void * s0vmaddr_to_load_addr(void *vaddr) { extern char _rtext; return (char *)vaddr - (0x80000000) - 0x00100000 + (unsigned int) &_rtext; } jbglaw@d2:~/vax-linux/kernel-2.5$ gcc -c testcase.c jbglaw@d2:~/vax-linux/kernel-2.5$ objdump -d testcase.o testcase.o: file format elf32-i386 Disassembly of section .text: 00000000 <s0vmaddr_to_load_addr>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: b8 00 00 00 00 mov $0x0,%eax 8: 05 00 00 f0 7f add $0x7ff00000,%eax d: 03 45 08 add 0x8(%ebp),%eax 10: 5d pop %ebp 11: c3 ret As you see, four bytes were reserved to be put in by the linker. However, it seems this is missing in case of a -O2 build: jbglaw@d2:~/vax-linux/kernel-2.5$ gcc -c -O2 testcase.c jbglaw@d2:~/vax-linux/kernel-2.5$ objdump -d testcase.o testcase.o: file format elf32-i386 Disassembly of section .text: 00000000 <s0vmaddr_to_load_addr>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 8b 45 08 mov 0x8(%ebp),%eax 6: 5d pop %ebp 7: 05 00 00 f0 7f add $0x7ff00000,%eax c: c3 ret ...or am I wrong here? Thanks! Jan-Benedict Glaw <jbglaw@lug-owl.de>
Hi! Here's how I configured it: /home/jbglaw/vax-linux/scm/build-20050424-193631-i686-linux/src/gcc/configure --disable-multilib --with-newlib --disable-nls --enable-threads=no --disable-threads --enable-symvers=gnu --enable-__cxa_atexit --disable-shared --target=i686-linux --prefix=/home/jbglaw/vax-linux/scm/build-20050424-193631-i686-linux/install/usr --enable-languages=c --disable-werror Thanks, Jan-Benedict Glaw <jbglaw@lug-owl.de>
pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax popl %ebp addl $_rtext+2146435072, %eax This is not a bug, see above: you are missing that relocates can happen in more places than where zero happens so that is the bug at all.
So closing this as invalid.