(toppers-users 683) コンフィグレーションチェッカーの不具合

Naohide Ogata nogata @ fukushima-iri.go.jp
2002年 12月 20日 (金) 18:25:16 JST


福島県ハイテクプラザの尾形と申します。

 JSP-1.3を使って、SH3用のアプリケーション開発をはじめアところですが
開発環境を Redhat 7.3 から Redhat 8.0 に変えたところ、コンフィグレー
ションチェッカー(sh-hitachi-elf-chk)がセグメンテーション違反で異常
終了してしまうようになってしまいました。
 Redhat 7.3附属のコンパイラがgcc-2.96で、Redhat 8.0の方がgcc-3.2に
上がっているのが原因と思われるのですが、bfd 関連のライブラリで変更が
あったとかの情報をどなたかご存知ないでしょうか。

 症状は以下のようなものです。

 セグメンテーション違反の発生箇所は、fc_bfd.cpp 中のfilecontainer_BFD
クラスのメンバ関数 get_symbol_address(const char * symbol) のリターン
値を返す箇所です。

   return (*scope).second->value + (*scope).second->section->vma;

2項目の(*scope).second->section->vma にアクセスしたところで、セグメ
ンテーション違反を起こしているようです。どうもメンバー変数 section 
がポインタとして有効な値になってないようです。
 cout で、second、value、section、vma をそれぞれ出力させてみた結果
が以下のとおりです。

------

../cfg/sh-hitachi-elf-chk jsp -cs jsp.chk \
                        -cpu sh3 -system kz_sh4 -obj
--- TOPPERS/JSP Configuration Checker (ver 2.0) ---
  Target architecture : elf32-sh
(*scope).second = 0x80e7344
(*scope).second->value = 236
(*scope).second->section = 0x10002
make: *** [jsp] セグメンテーション違反です
make: *** ファイル `jsp' を削除します

------

 vma に関してはセグメンテーション違反のため、出力されませんでした。

 同じクラスのメンバー関数 attach_module(const char * filename) の
中でこのシンボルテーブルを作成していると思われる以下の箇所で同様に
メンバ変数を表示させて見ました。

 for(i=0;i<num_syms;i++)       {
   sym = *(symbols+i);
      if(sym != NULL && sym->name != NULL && *(sym->name) != '\x0')
         symbol_table[string(sym->name)] = sym;
      cout << "sym = " << sym << "\n";
      cout << "sym->value = " << sym->value << "\n";
      cout << "sym->section = " << sym->section << "\n";
      cout << "sym->name = [" << string(sym->name) << "]\n";
      cout << "sym->section->name" << sym->section->name << "\n";
      cout << "sym->section->vma" << sym->section->vma << "\n";

 }

結果は以下のとおりで、やはり、section をポインタとしてその先をアクセス
したところでセグメンテーション違反になるようです。

---------

../cfg/sh-hitachi-elf-chk jsp -cs jsp.chk \
                        -cpu sh3 -system kz_sh4 -obj
--- TOPPERS/JSP Configuration Checker (ver 2.0) ---
sym = 0x80e4000
sym->value = 0
sym->section = 0x109
sym->name = []
make: *** [jsp] セグメンテーション違反です
make: *** ファイル `jsp' を削除します

---------

長々と失礼致しましたが、よろしくお願い致します。


/***************** 福島県ハイテクプラザ  ****************/
 Fukushima Technolgy Centre           Tel 0249-59-1737(直)
 応用技術部 主任研究員  尾形直秀          0249-59-1911(代)
 E-mail : nogata @ fukushima-iri.go.jp  Fax 0249-59-1761