OS自作入門3日目のコンパイルで`_GLOBAL_OFFSET_TABLE_' に対する定義されていない参照ですエラー出てしまう #osdevjp
ここ参考にlinker scriptとMakefile書いた。
30日でできる!OS自作入門(3日目)[Ubuntu16.04/NASM] - Qiita
makeすると以下のようなエラーが
% make make img make[1]: ディレクトリ '/home/sei/src/github.com/hanachin/os' に入ります make -r haribote.img make[2]: ディレクトリ '/home/sei/src/github.com/hanachin/os' に入ります nasm asmhead.nas -o asmhead.sys -l asmhead.lst asmhead.nas:15: warning: byte value exceeds bounds gcc -march=i486 -m32 -nostdlib -T har.ld bootpack.c -o bootpack.hrb /tmp/ccga5UWv.o: 関数 `HariMain' 内: bootpack.c:(.text+0x9): `_GLOBAL_OFFSET_TABLE_' に対する定義されていない参照です collect2: error: ld returned 1 exit status Makefile:11: ターゲット 'bootpack.hrb' のレシピで失敗しました make[2]: *** [bootpack.hrb] エラー 1 make[2]: ディレクトリ '/home/sei/src/github.com/hanachin/os' から出ます Makefile:24: ターゲット 'img' のレシピで失敗しました make[1]: *** [img] エラー 2 make[1]: ディレクトリ '/home/sei/src/github.com/hanachin/os' から出ます Makefile:27: ターゲット 'run' のレシピで失敗しました make: *** [run] エラー 2
ググった結果ここを参考に-fno-pic
つけてやりすごした。
haribote/harib00i.md at master · harrybotter30/haribote
ただ、このページ自体みつけるのが結構検索のコツがいる感じだったので情報を複製して見つけやすいようにしておこう、ということではてなブログにも記録しておく。
Qiitaには編集リクエストでも送るか。