第10章的程序无法正确执行
PragmaTwice opened this issue · 1 comments
PragmaTwice commented
在使用以下命令编译运行第10章时
sudo make
sudo make qemu
objdump 输出:
$ objdump -h hx_kernel
hx_kernel: file format elf32-i386
section:
Idx Name Size VMA LMA File off Algn
0 .init.text 00001000 00100000 00100000 00001000 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .init.data 00001000 00101000 00101000 00002000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .text 00003000 c0102000 00102000 00003000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .text.__x86.get_pc_thunk.ax 00000004 c0105000 00105000 00006000 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .text.__x86.get_pc_thunk.bx 00000004 c0105004 00105004 00006004 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
5 .note.gnu.property 0000001c c0105008 00105008 00006008 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .data 00000fdc c0105024 00105024 00006024 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .got.plt 0000000c c0106000 00106000 00007000 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .bss 00105020 c0107000 00107000 0000700c 2**12
ALLOC
9 .stab 00005fe0 c020c020 0020c020 0010d020 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
10 .stabstr 00002000 c0212000 00212000 00113000 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
环境:
$ gcc --version
gcc (GCC) 8.2.1 20181127
$ ld --version
GNU ld (GNU Binutils) 2.31.1
$ nasm --version
NASM version 2.14 compiled on Nov 15 2018
$ uname -a
Linux TwicesManjaro 4.19.16-1-MANJARO #1 SMP PREEMPT Fri Jan 18 17:03:05 UTC 2019 x86_64 GNU/Linux
PragmaTwice commented
将 GCC 从 8.2 换为 4.9 后问题解决..
目前并不清楚具体原因。