Hello Eugene, I just tried to reproduce the issue and collect some more information. Unfortunately grub-legacy has not yet a dbgsym package. But is also crashing with a self built package.
# gdb -q --args /usr/sbin/grub Reading symbols from /usr/sbin/grub...done. (gdb) display/i $pc 1: x/i $pc <error: No registers.> (gdb) display/x $eax 2: /x $eax = <error: No registers.> (gdb) run Starting program: /usr/sbin/grub Probing devices to guess BIOS drives. This may take a long time. Program received signal SIGSEGV, Segmentation fault. doit () at asmstub.c:140 140 status = 0; 1: x/i $pc => 0x80498b3 <doit+102>: movl $0x0,0xee8(%eax) 2: /x $eax = 0x0 (gdb) bt #0 doit () at asmstub.c:140 #1 0x00000000 in ?? () This place is short after grub does some assembler magic to switch stacks. Short before that switch we have this stack: (gdb) bt #0 0x08049864 in doit () at asmstub.c:133 #1 0x08049aad in grub_stage2 () at asmstub.c:214 #2 0x0804963e in main (argc=<optimized out>, argv=<optimized out>) at main.c:271 I tried to build 0.97-73 on a Stretch system and that did work. So I tried to build on current testing with CC=gcc-6 and that did also work. Therefore I assume this issue started when switching the default compiler to gcc-7. gcc-8 produces nearly the same instruction and therefore also crashes. As far as I can follow the source, this line 140 status = 0; generates with gcc-6 this instruction: movl $0x0,0xee8(%ebx) with register $ebx holding the address of variable status nearly all of the time. Unfortunately gcc-7 generates this sequence: mov 0xc(%esp),%eax mov %eax,%ebx movl $0x0,0xee8(%eax) So i guess gcc-7 relies to have the address of some area holding the static variables at the stack "0xc(%esp)", but as we switched stacks some lines before we get just a 0 into register $eax. Attached file shows building and stepping through the instructions for different gcc versions. Kind regards, Bernhard
Stretch: apt install devscripts dpkg-dev debhelper dh-autoreconf dh-exec texinfo libncurses5-dev texi2html gdb mkdir grub_0.97-73; cd grub_0.97-73 dget http://http.debian.net/debian/pool/main/g/grub/grub_0.97-73.dsc cd grub-0.97 DEB_BUILD_OPTIONS="nostrip noopt" dpkg-buildpackage -b -uc cd .. # dpkg --purge grub2-common grub-pc # damages system, doing in writeprotected VM # dpkg -i grub-legacy_0.97-73_i386.deb root@debian:/home/benutzer# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/6/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) gcc-6 i386 6.3.0-18+deb9u1 script -a -c "gdb -q --args /usr/sbin/grub" gdb-grub_$(date +%Y-%m-%d_%H-%M-%S).log b asmstub.c:213 run display/i $pc display/x $esp display/x $eax display/x $ebx Script started on Do 05 Jul 2018 16:09:12 CEST Reading symbols from /usr/sbin/grub...done. (gdb) b asmstub.c:213 Breakpoint 1 at 0x8049c3c: file asmstub.c, line 213. (gdb) run Starting program: /usr/sbin/grub Probing devices to guess BIOS drives. This may take a long time. Breakpoint 1, grub_stage2 () at asmstub.c:213 warning: Source file is more recent than executable. 213 simstack = (char *) PROTSTACKINIT; (gdb) display/i $pc 1: x/i $pc => 0x8049c3c <grub_stage2+267>: mov 0xecc(%ebx),%eax (gdb) display/x $esp 2: /x $esp = 0xbffff650 (gdb) display/x $eax 3: /x $eax = 0x0 (gdb) display/x $ebx 4: /x $ebx = 0x8074000 (gdb) stepi 214 doit (); 1: x/i $pc => 0x8049c42 <grub_stage2+273>: lea 0x18(%esp),%ecx 2: /x $esp = 0xbffff650 3: /x $eax = 0xb79c6000 4: /x $ebx = 0x8074000 (gdb) 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049c46 <grub_stage2+277>: mov %eax,0xc(%esp) 2: /x $esp = 0xbffff650 3: /x $eax = 0xb79c6000 4: /x $ebx = 0x8074000 (gdb) 0x08049c4a 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049c4a <grub_stage2+281>: add $0x67ff0,%eax 2: /x $esp = 0xbffff650 3: /x $eax = 0xb79c6000 4: /x $ebx = 0x8074000 (gdb) 0x08049c4f 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049c4f <grub_stage2+286>: mov %eax,0x18(%esp) 2: /x $esp = 0xbffff650 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) 214 doit (); 1: x/i $pc => 0x8049c53 <grub_stage2+290>: call 0x8049a02 <doit> 2: /x $esp = 0xbffff650 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) doit () at asmstub.c:131 131 { 1: x/i $pc => 0x8049a02 <doit>: push %ebx 2: /x $esp = 0xbffff64c 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) nexti 0x08049a03 131 { 1: x/i $pc => 0x8049a03 <doit+1>: call 0x80498a0 <__x86.get_pc_thunk.bx> 2: /x $esp = 0xbffff648 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) 0x08049a08 131 { 1: x/i $pc => 0x8049a08 <doit+6>: add $0x2a5f8,%ebx 2: /x $esp = 0xbffff648 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8049a08 (gdb) 0x08049a0e 131 { 1: x/i $pc => 0x8049a0e <doit+12>: sub $0x8,%esp 2: /x $esp = 0xbffff648 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049a11 <doit+15>: mov (%ecx),%edx 2: /x $esp = 0xbffff640 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) 0x08049a13 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049a13 <doit+17>: mov %esp,%eax 2: /x $esp = 0xbffff640 3: /x $eax = 0xb7a2dff0 4: /x $ebx = 0x8074000 (gdb) 0x08049a15 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049a15 <doit+19>: mov %edx,%esp 2: /x $esp = 0xbffff640 3: /x $eax = 0xbffff640 4: /x $ebx = 0x8074000 (gdb) 0x08049a17 in doit () at asmstub.c:133 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049a17 <doit+21>: mov %eax,0xee4(%ebx) 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0xbffff640 4: /x $ebx = 0x8074000 (gdb) 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a1d <doit+27>: lea 0xf00(%ebx),%eax 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0xbffff640 4: /x $ebx = 0x8074000 (gdb) 0x08049a23 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a23 <doit+33>: sub $0xc,%esp 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049a26 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a26 <doit+36>: push %eax 2: /x $esp = 0xb7a2dfe4 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049a27 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a27 <doit+37>: call 0x8048fc0 <_setjmp@plt> 2: /x $esp = 0xb7a2dfe0 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049a2c 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a2c <doit+42>: add $0x10,%esp 2: /x $esp = 0xb7a2dfe0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x08049a2f 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a2f <doit+45>: test %eax,%eax 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x08049a31 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049a31 <doit+47>: je 0x8049a56 <doit+84> 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 140 status = 0; 1: x/i $pc => 0x8049a56 <doit+84>: movl $0x0,0xee8(%ebx) 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 141 init_bios_info (); 1: x/i $pc => 0x8049a60 <doit+94>: call 0x804c6dd <init_bios_info> 2: /x $esp = 0xb7a2dff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) kill Kill the program being debugged? (y or n) y (gdb) q Script done on Do 05 Jul 2018 16:10:37 CEST -> works #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### Buster/testing: apt install devscripts dpkg-dev debhelper dh-autoreconf dh-exec texinfo libncurses5-dev texi2html gdb mkdir grub_0.97-73; cd grub_0.97-73 dget http://http.debian.net/debian/pool/main/g/grub/grub_0.97-73.dsc cd grub-0.97 DEB_BUILD_OPTIONS="nostrip noopt" dpkg-buildpackage -b -uc cd .. # dpkg --purge grub2-common grub-pc # damages system, doing in writeprotected VM # dpkg -i grub-legacy_0.97-73_i386.deb root@debian:/home/benutzer/grub_0.97-73# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 7.3.0-24' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 7.3.0 (Debian 7.3.0-24) gcc-7 i386 7.3.0-24 script -a -c "gdb -q --args /usr/sbin/grub" gdb-grub_$(date +%Y-%m-%d_%H-%M-%S).log b asmstub.c:213 run display/i $pc display/x $esp display/x $eax display/x $ebx Script started on 2018-07-05 16:22:37+02:00 Reading symbols from /usr/sbin/grub...done. (gdb) b asmstub.c:213 Breakpoint 1 at 0x8049a95: file asmstub.c, line 213. (gdb) run Starting program: /usr/sbin/grub Probing devices to guess BIOS drives. This may take a long time. Breakpoint 1, grub_stage2 () at asmstub.c:213 warning: Source file is more recent than executable. 213 simstack = (char *) PROTSTACKINIT; (gdb) display/i $pc 1: x/i $pc => 0x8049a95 <grub_stage2+267>: mov 0xecc(%ebx),%eax (gdb) display/x $esp 2: /x $esp = 0xbffff610 (gdb) display/x $eax 3: /x $eax = 0x0 (gdb) display/x $ebx 4: /x $ebx = 0x8074000 (gdb) stepi 214 doit (); 1: x/i $pc => 0x8049a9b <grub_stage2+273>: lea 0x8(%esp),%ecx 2: /x $esp = 0xbffff610 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049a9f <grub_stage2+277>: add $0x67ff0,%eax 2: /x $esp = 0xbffff610 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 0x08049aa4 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049aa4 <grub_stage2+282>: mov %eax,0x8(%esp) 2: /x $esp = 0xbffff610 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 214 doit (); 1: x/i $pc => 0x8049aa8 <grub_stage2+286>: call 0x804984d <doit> 2: /x $esp = 0xbffff610 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) doit () at asmstub.c:131 131 { 1: x/i $pc => 0x804984d <doit>: push %ebx 2: /x $esp = 0xbffff60c 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) nexti 0x0804984e 131 { 1: x/i $pc => 0x804984e <doit+1>: call 0x80496f0 <__x86.get_pc_thunk.bx> 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049853 131 { 1: x/i $pc => 0x8049853 <doit+6>: add $0x2a7ad,%ebx 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8049853 (gdb) 0x08049859 131 { 1: x/i $pc => 0x8049859 <doit+12>: sub $0x18,%esp 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804985c <doit+15>: mov (%ecx),%edx 2: /x $esp = 0xbffff5f0 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x0804985e 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804985e <doit+17>: mov %ebx,0xc(%esp) 2: /x $esp = 0xbffff5f0 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049862 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049862 <doit+21>: mov %esp,%eax 2: /x $esp = 0xbffff5f0 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049864 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049864 <doit+23>: mov %edx,%esp 2: /x $esp = 0xbffff5f0 3: /x $eax = 0xbffff5f0 4: /x $ebx = 0x8074000 (gdb) 0x08049866 in doit () at asmstub.c:133 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049866 <doit+25>: mov %eax,0xee4(%ebx) 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff5f0 4: /x $ebx = 0x8074000 (gdb) 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804986c <doit+31>: lea 0xf00(%ebx),%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff5f0 4: /x $ebx = 0x8074000 (gdb) 0x08049872 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049872 <doit+37>: sub $0xc,%esp 2: /x $esp = 0xb79ff000 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049875 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049875 <doit+40>: push %eax 2: /x $esp = 0xb79feff4 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049876 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049876 <doit+41>: call 0x8048df0 <_setjmp@plt> 2: /x $esp = 0xb79feff0 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x0804987b 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804987b <doit+46>: add $0x10,%esp 2: /x $esp = 0xb79feff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x0804987e 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804987e <doit+49>: test %eax,%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x08049880 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049880 <doit+51>: je 0x80498ad <doit+96> 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 140 status = 0; 1: x/i $pc => 0x80498ad <doit+96>: mov 0xc(%esp),%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 141 init_bios_info (); 1: x/i $pc => 0x80498b1 <doit+100>: mov %eax,%ebx 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 140 status = 0; 1: x/i $pc => 0x80498b3 <doit+102>: movl $0x0,0xee8(%eax) 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x0 (gdb) Program received signal SIGSEGV, Segmentation fault. doit () at asmstub.c:140 140 status = 0; 1: x/i $pc => 0x80498b3 <doit+102>: movl $0x0,0xee8(%eax) 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x0 (gdb) kill Kill the program being debugged? (y or n) y (gdb) q Script done on 2018-07-05 16:23:56+02:00 (gdb) disassemble 0x804984d,0x804984d+120 Dump of assembler code from 0x804984d to 0x80498c5: 0x0804984d <doit+0>: push %ebx 0x0804984e <doit+1>: call 0x80496f0 <__x86.get_pc_thunk.bx> 0x08049853 <doit+6>: add $0x2a7ad,%ebx 0x08049859 <doit+12>: sub $0x18,%esp 0x0804985c <doit+15>: mov (%ecx),%edx 0x0804985e <doit+17>: mov %ebx,0xc(%esp) 0x08049862 <doit+21>: mov %esp,%eax 0x08049864 <doit+23>: mov %edx,%esp 0x08049866 <doit+25>: mov %eax,0xee4(%ebx) 0x0804986c <doit+31>: lea 0xf00(%ebx),%eax 0x08049872 <doit+37>: sub $0xc,%esp 0x08049875 <doit+40>: push %eax 0x08049876 <doit+41>: call 0x8048df0 <_setjmp@plt> 0x0804987b <doit+46>: add $0x10,%esp 0x0804987e <doit+49>: test %eax,%eax 0x08049880 <doit+51>: je 0x80498ad <doit+96> 0x08049882 <doit+53>: mov 0xc(%esp),%edx 0x08049886 <doit+57>: mov $0x8074fa0,%eax 0x0804988c <doit+63>: mov (%eax),%eax 0x0804988e <doit+65>: test %eax,%eax 0x08049890 <doit+67>: je 0x804989c <doit+79> 0x08049892 <doit+69>: movl $0x1,0xee8(%edx) 0x0804989c <doit+79>: mov 0xc(%esp),%eax 0x080498a0 <doit+83>: mov 0xee4(%eax),%eax 0x080498a6 <doit+89>: mov %eax,%esp 0x080498a8 <doit+91>: add $0x18,%esp 0x080498ab <doit+94>: pop %ebx 0x080498ac <doit+95>: ret 0x080498ad <doit+96>: mov 0xc(%esp),%eax 0x080498b1 <doit+100>: mov %eax,%ebx 0x080498b3 <doit+102>: movl $0x0,0xee8(%eax) 0x080498bd <doit+112>: call 0x804c5b7 <init_bios_info> 0x080498c2 <doit+117>: jmp 0x804989c <doit+79> 0x080498c4 <nread+0>: push %ebp End of assembler dump. #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### Buster/testing: gcc-6 apt install gcc-6 dget http://http.debian.net/debian/pool/main/g/grub/grub_0.97-73.dsc cd grub-0.97 CC=gcc-6 DEB_BUILD_OPTIONS="nostrip noopt" dpkg-buildpackage -b -uc cd .. # dpkg --purge grub2-common grub-pc # damages system, doing in writeprotected VM # dpkg -i grub-legacy_0.97-73_i386.deb root@debian:/home/benutzer/grub_0.97-73_gcc-6# gcc-6 -v Using built-in specs. COLLECT_GCC=gcc-6 COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/6/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.4.0-18' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-as=/usr/bin/i686-linux-gnu-as --with-ld=/usr/bin/i686-linux-gnu-ld --program-suffix=-6 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 6.4.0 20180615 (Debian 6.4.0-18) gcc-6 6.4.0-18 script -a -c "gdb -q --args /usr/sbin/grub" gdb-grub-gcc6_$(date +%Y-%m-%d_%H-%M-%S).log b asmstub.c:213 run display/i $pc display/x $esp display/x $eax display/x $ebx Script started on 2018-07-05 16:35:55+02:00 Reading symbols from /usr/sbin/grub...done. (gdb) b asmstub.c:213 Breakpoint 1 at 0x8049a8c: file asmstub.c, line 213. (gdb) run Starting program: /usr/sbin/grub Probing devices to guess BIOS drives. This may take a long time. Breakpoint 1, grub_stage2 () at asmstub.c:213 warning: Source file is more recent than executable. 213 simstack = (char *) PROTSTACKINIT; (gdb) display/i $pc 1: x/i $pc => 0x8049a8c <grub_stage2+267>: mov 0xecc(%ebx),%eax (gdb) display/x $esp 2: /x $esp = 0xbffff610 (gdb) display/x $eax 3: /x $eax = 0x0 (gdb) display/x $ebx 4: /x $ebx = 0x8074000 (gdb) stepi 214 doit (); 1: x/i $pc => 0x8049a92 <grub_stage2+273>: lea 0x18(%esp),%ecx 2: /x $esp = 0xbffff610 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049a96 <grub_stage2+277>: mov %eax,0xc(%esp) 2: /x $esp = 0xbffff610 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 0x08049a9a 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049a9a <grub_stage2+281>: add $0x67ff0,%eax 2: /x $esp = 0xbffff610 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 0x08049a9f 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x8049a9f <grub_stage2+286>: mov %eax,0x18(%esp) 2: /x $esp = 0xbffff610 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 214 doit (); 1: x/i $pc => 0x8049aa3 <grub_stage2+290>: call 0x8049852 <doit> 2: /x $esp = 0xbffff610 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) doit () at asmstub.c:131 131 { 1: x/i $pc => 0x8049852 <doit>: push %ebx 2: /x $esp = 0xbffff60c 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) nexti 0x08049853 131 { 1: x/i $pc => 0x8049853 <doit+1>: call 0x80496f0 <__x86.get_pc_thunk.bx> 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049858 131 { 1: x/i $pc => 0x8049858 <doit+6>: add $0x2a7a8,%ebx 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8049858 (gdb) 0x0804985e 131 { 1: x/i $pc => 0x804985e <doit+12>: sub $0x8,%esp 2: /x $esp = 0xbffff608 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049861 <doit+15>: mov (%ecx),%edx 2: /x $esp = 0xbffff600 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049863 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049863 <doit+17>: mov %esp,%eax 2: /x $esp = 0xbffff600 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049865 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049865 <doit+19>: mov %edx,%esp 2: /x $esp = 0xbffff600 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 0x08049867 in doit () at asmstub.c:133 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049867 <doit+21>: mov %eax,0xee4(%ebx) 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804986d <doit+27>: lea 0xf00(%ebx),%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 0x08049873 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049873 <doit+33>: sub $0xc,%esp 2: /x $esp = 0xb79ff000 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049876 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049876 <doit+36>: push %eax 2: /x $esp = 0xb79feff4 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x08049877 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049877 <doit+37>: call 0x8048df0 <_setjmp@plt> 2: /x $esp = 0xb79feff0 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x0804987c 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804987c <doit+42>: add $0x10,%esp 2: /x $esp = 0xb79feff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x0804987f 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804987f <doit+45>: test %eax,%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x08049881 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x8049881 <doit+47>: je 0x80498a6 <doit+84> 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 140 status = 0; 1: x/i $pc => 0x80498a6 <doit+84>: movl $0x0,0xee8(%ebx) 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 141 init_bios_info (); 1: x/i $pc => 0x80498b0 <doit+94>: call 0x804c52d <init_bios_info> 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) kill Kill the program being debugged? (y or n) y (gdb) q Script done on 2018-07-05 16:36:36+02:00 -> works (gdb) disassemble 0x8049852,0x8049852+120 Dump of assembler code from 0x8049852 to 0x80498ca: 0x08049852 <doit+0>: push %ebx 0x08049853 <doit+1>: call 0x80496f0 <__x86.get_pc_thunk.bx> 0x08049858 <doit+6>: add $0x2a7a8,%ebx 0x0804985e <doit+12>: sub $0x8,%esp 0x08049861 <doit+15>: mov (%ecx),%edx 0x08049863 <doit+17>: mov %esp,%eax 0x08049865 <doit+19>: mov %edx,%esp 0x08049867 <doit+21>: mov %eax,0xee4(%ebx) 0x0804986d <doit+27>: lea 0xf00(%ebx),%eax 0x08049873 <doit+33>: sub $0xc,%esp 0x08049876 <doit+36>: push %eax 0x08049877 <doit+37>: call 0x8048df0 <_setjmp@plt> 0x0804987c <doit+42>: add $0x10,%esp 0x0804987f <doit+45>: test %eax,%eax 0x08049881 <doit+47>: je 0x80498a6 <doit+84> 0x08049883 <doit+49>: mov $0x8074fa0,%eax 0x08049889 <doit+55>: mov (%eax),%eax 0x0804988b <doit+57>: test %eax,%eax 0x0804988d <doit+59>: je 0x8049899 <doit+71> 0x0804988f <doit+61>: movl $0x1,0xee8(%ebx) 0x08049899 <doit+71>: mov 0xee4(%ebx),%eax 0x0804989f <doit+77>: mov %eax,%esp 0x080498a1 <doit+79>: add $0x8,%esp 0x080498a4 <doit+82>: pop %ebx 0x080498a5 <doit+83>: ret 0x080498a6 <doit+84>: movl $0x0,0xee8(%ebx) 0x080498b0 <doit+94>: call 0x804c52d <init_bios_info> 0x080498b5 <doit+99>: jmp 0x8049899 <doit+71> 0x080498b7 <nread+0>: push %ebp 0x080498b8 <nread+1>: push %edi 0x080498b9 <nread+2>: mov %ecx,%edi 0x080498bb <nread+4>: push %esi 0x080498bc <nread+5>: push %ebx 0x080498bd <nread+6>: mov %edx,%esi 0x080498bf <nread+8>: call 0x80496f0 <__x86.get_pc_thunk.bx> 0x080498c4 <nread+13>: add $0x2a73c,%ebx End of assembler dump. #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### Buster/testing: gcc-8 apt install gcc-8 dget http://http.debian.net/debian/pool/main/g/grub/grub_0.97-73.dsc cd grub-0.97 CC=gcc-8 DEB_BUILD_OPTIONS="nostrip noopt" dpkg-buildpackage -b -uc cd .. # dpkg --purge grub2-common grub-pc # damages system, doing in writeprotected VM # dpkg -i grub-legacy_0.97-73_i386.deb root@debian:/home/benutzer/grub_0.97-73_gcc-8# gcc-8 -v Using built-in specs. COLLECT_GCC=gcc-8 COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 8.1.0-9' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 8.1.0 (Debian 8.1.0-9) gcc-8 8.1.0-9 script -a -c "gdb -q --args /usr/sbin/grub" gdb-grub-gcc8_$(date +%Y-%m-%d_%H-%M-%S).log b asmstub.c:213 run display/i $pc display/x $esp display/x $eax display/x $ebx Script started on 2018-07-05 16:59:06+02:00 Reading symbols from /usr/sbin/grub...done. (gdb) b asmstub.c:213 Breakpoint 1 at 0x80498c6: file asmstub.c, line 213. (gdb) run Starting program: /usr/sbin/grub Probing devices to guess BIOS drives. This may take a long time. Breakpoint 1, grub_stage2 () at asmstub.c:213 warning: Source file is more recent than executable. 213 simstack = (char *) PROTSTACKINIT; (gdb) display/i $pc 1: x/i $pc => 0x80498c6 <grub_stage2+267>: mov 0xecc(%ebx),%eax (gdb) display/x $esp 2: /x $esp = 0xbffff620 (gdb) display/x $eax 3: /x $eax = 0x0 (gdb) display/x $ebx 4: /x $ebx = 0x8074000 (gdb) stepi 0x080498cc 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x80498cc <grub_stage2+273>: lea 0x8(%esp),%ecx 2: /x $esp = 0xbffff620 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 0x080498d0 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x80498d0 <grub_stage2+277>: add $0x67ff0,%eax 2: /x $esp = 0xbffff620 3: /x $eax = 0xb7997010 4: /x $ebx = 0x8074000 (gdb) 0x080498d5 213 simstack = (char *) PROTSTACKINIT; 1: x/i $pc => 0x80498d5 <grub_stage2+282>: mov %eax,0x8(%esp) 2: /x $esp = 0xbffff620 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 214 doit (); 1: x/i $pc => 0x80498d9 <grub_stage2+286>: call 0x804967e <doit> 2: /x $esp = 0xbffff620 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) doit () at asmstub.c:133 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804967e <doit>: push %ebx 2: /x $esp = 0xbffff61c 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) nexti 0x0804967f 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804967f <doit+1>: call 0x8049530 <__x86.get_pc_thunk.bx> 2: /x $esp = 0xbffff618 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049684 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049684 <doit+6>: add $0x2a97c,%ebx 2: /x $esp = 0xbffff618 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8049684 (gdb) 0x0804968a 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804968a <doit+12>: sub $0x18,%esp 2: /x $esp = 0xbffff618 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x0804968d 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804968d <doit+15>: mov (%ecx),%edx 2: /x $esp = 0xbffff600 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x0804968f 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x804968f <doit+17>: mov %ebx,0xc(%esp) 2: /x $esp = 0xbffff600 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049693 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049693 <doit+21>: mov %esp,%eax 2: /x $esp = 0xbffff600 3: /x $eax = 0xb79ff000 4: /x $ebx = 0x8074000 (gdb) 0x08049695 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049695 <doit+23>: mov %edx,%esp 2: /x $esp = 0xbffff600 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 0x08049697 in doit () at asmstub.c:133 133 asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" 1: x/i $pc => 0x8049697 <doit+25>: mov %eax,0xee4(%ebx) 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x804969d <doit+31>: sub $0xc,%esp 2: /x $esp = 0xb79ff000 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 0x080496a0 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496a0 <doit+34>: lea 0xf00(%ebx),%eax 2: /x $esp = 0xb79feff4 3: /x $eax = 0xbffff600 4: /x $ebx = 0x8074000 (gdb) 0x080496a6 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496a6 <doit+40>: push %eax 2: /x $esp = 0xb79feff4 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x080496a7 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496a7 <doit+41>: call 0x8048df0 <_setjmp@plt> 2: /x $esp = 0xb79feff0 3: /x $eax = 0x8074f00 4: /x $ebx = 0x8074000 (gdb) 0x080496ac 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496ac <doit+46>: add $0x10,%esp 2: /x $esp = 0xb79feff0 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x080496af 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496af <doit+49>: test %eax,%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x080496b1 137 if (! setjmp (env_for_exit)) 1: x/i $pc => 0x80496b1 <doit+51>: je 0x80496de <doit+96> 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 140 status = 0; 1: x/i $pc => 0x80496de <doit+96>: mov 0xc(%esp),%eax 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) 0x080496e2 140 status = 0; 1: x/i $pc => 0x80496e2 <doit+100>: movl $0x0,0xee8(%eax) 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) Program received signal SIGSEGV, Segmentation fault. 0x080496e2 in doit () at asmstub.c:140 140 status = 0; 1: x/i $pc => 0x80496e2 <doit+100>: movl $0x0,0xee8(%eax) 2: /x $esp = 0xb79ff000 3: /x $eax = 0x0 4: /x $ebx = 0x8074000 (gdb) disassemble 0x804967e,0x804967e+120 Dump of assembler code from 0x804967e to 0x80496f6: 0x0804967e <doit+0>: push %ebx 0x0804967f <doit+1>: call 0x8049530 <__x86.get_pc_thunk.bx> 0x08049684 <doit+6>: add $0x2a97c,%ebx 0x0804968a <doit+12>: sub $0x18,%esp 0x0804968d <doit+15>: mov (%ecx),%edx 0x0804968f <doit+17>: mov %ebx,0xc(%esp) 0x08049693 <doit+21>: mov %esp,%eax 0x08049695 <doit+23>: mov %edx,%esp 0x08049697 <doit+25>: mov %eax,0xee4(%ebx) 0x0804969d <doit+31>: sub $0xc,%esp 0x080496a0 <doit+34>: lea 0xf00(%ebx),%eax 0x080496a6 <doit+40>: push %eax 0x080496a7 <doit+41>: call 0x8048df0 <_setjmp@plt> 0x080496ac <doit+46>: add $0x10,%esp 0x080496af <doit+49>: test %eax,%eax 0x080496b1 <doit+51>: je 0x80496de <doit+96> 0x080496b3 <doit+53>: mov 0xc(%esp),%edx 0x080496b7 <doit+57>: mov $0x8074fa0,%eax 0x080496bd <doit+63>: mov (%eax),%eax 0x080496bf <doit+65>: test %eax,%eax 0x080496c1 <doit+67>: je 0x80496cd <doit+79> 0x080496c3 <doit+69>: movl $0x1,0xee8(%edx) 0x080496cd <doit+79>: mov 0xc(%esp),%eax 0x080496d1 <doit+83>: mov 0xee4(%eax),%eax 0x080496d7 <doit+89>: mov %eax,%esp 0x080496d9 <doit+91>: add $0x18,%esp 0x080496dc <doit+94>: pop %ebx 0x080496dd <doit+95>: ret 0x080496de <doit+96>: mov 0xc(%esp),%eax => 0x080496e2 <doit+100>: movl $0x0,0xee8(%eax) 0x080496ec <doit+110>: mov %eax,%ebx 0x080496ee <doit+112>: call 0x804c40b <init_bios_info> 0x080496f3 <doit+117>: jmp 0x80496cd <doit+79> 0x080496f5 <nread+0>: push %ebp End of assembler dump. (gdb) kill Kill the program being debugged? (y or n) y (gdb) q Script done on 2018-07-05 17:01:00+02:00 #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### #################################################################################################### gcc-6 push %ebx call 0x80496f0 <__x86.get_pc_thunk.bx> add $0x2a7a8,%ebx sub $0x8,%esp mov (%ecx),%edx mov %esp,%eax mov %edx,%esp mov %eax,0xee4(%ebx) lea 0xf00(%ebx),%eax sub $0xc,%esp push %eax call 0x8048df0 <_setjmp@plt> add $0x10,%esp test %eax,%eax je 0x80498a6 <doit+84> mov $0x8074fa0,%eax mov (%eax),%eax test %eax,%eax je 0x8049899 <doit+71> movl $0x1,0xee8(%ebx) mov 0xee4(%ebx),%eax mov %eax,%esp add $0x8,%esp pop %ebx ret movl $0x0,0xee8(%ebx) call 0x804c52d <init_bios_info> jmp 0x8049899 <doit+71> gcc-7 push %ebx call 0x80496f0 <__x86.get_pc_thunk.bx> add $0x2a7ad,%ebx sub $0x18,%esp mov (%ecx),%edx mov %ebx,0xc(%esp) mov %esp,%eax mov %edx,%esp mov %eax,0xee4(%ebx) lea 0xf00(%ebx),%eax sub $0xc,%esp push %eax call 0x8048df0 <_setjmp@plt> add $0x10,%esp test %eax,%eax je 0x80498ad <doit+96> mov 0xc(%esp),%edx mov $0x8074fa0,%eax mov (%eax),%eax test %eax,%eax je 0x804989c <doit+79> movl $0x1,0xee8(%edx) mov 0xc(%esp),%eax mov 0xee4(%eax),%eax mov %eax,%esp add $0x18,%esp pop %ebx ret mov 0xc(%esp),%eax mov %eax,%ebx movl $0x0,0xee8(%eax) call 0x804c5b7 <init_bios_info> jmp 0x804989c <doit+79> gcc-8 push %ebx call 0x8049530 <__x86.get_pc_thunk.bx> add $0x2a97c,%ebx sub $0x18,%esp mov (%ecx),%edx mov %ebx,0xc(%esp) mov %esp,%eax mov %edx,%esp mov %eax,0xee4(%ebx) sub $0xc,%esp lea 0xf00(%ebx),%eax push %eax call 0x8048df0 <_setjmp@plt> add $0x10,%esp test %eax,%eax je 0x80496de <doit+96> mov 0xc(%esp),%edx mov $0x8074fa0,%eax mov (%eax),%eax test %eax,%eax je 0x80496cd <doit+79> movl $0x1,0xee8(%edx) mov 0xc(%esp),%eax mov 0xee4(%eax),%eax mov %eax,%esp add $0x18,%esp pop %ebx ret mov 0xc(%esp),%eax movl $0x0,0xee8(%eax) mov %eax,%ebx call 0x804c40b <init_bios_info> jmp 0x80496cd <doit+79>