0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ふつうのコンパイラをつくろう

Last updated at Posted at 2023-04-14

java11

#sudo apt install default-jdk
sudo apt install openjdk-11-jdk-headless

※openjdk version "11.0.18" 2023-01-17

ant

sudo apt install ant

javaCC

sudo apt install javacc

クロスコンパイル用のライブラリをインストール

sudo apt install gcc-multilib

Parser.jjを修正

importをコメントアウト(java8以上でParameterが名前重複)
//import java.lang.reflect.*;

GNULinker.javaを修正

LINKER = "/usr/bin/ld";

LINKER = "gcc";

リンカのパラメタ追加

    cmd.add("-m32");

ライブラリ追加をコメントアウト

// if (! opts.noStartFiles) {
// cmd.add(opts.generatingPIE
// ? C_RUNTIME_START_PIE
// : C_RUNTIME_START);
// cmd.add(C_RUNTIME_INIT);
// }

クリーン

make clean

ビルド

make

テスト

make test

※まだ3つほどエラーが出る
06_variables.........................................................................................................................................................shunit: expected

29_import....shunit[../bin/cbc vardecl.cb]: status 0 expected but was: 1
..shunit[../bin/cbc -fPIC vardecl.cb]: status 0 expected but was: 1

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?