インラインアセンブラでの未定義シンボル

テクニカル・ノート 47972

アーキテクチャ:

AVR32

コンポーネント:

compiler

更新日:

2018/09/04 7:15

はじめに

IAR Embedded Workbench for AVR32バージョン4.2xに移行後、インラインアセンブラ命令を使用するソースコードで以下のエラーが表示される。

Error[As011]: Undefined symbol: XXXXXX

 

(IAR Embedded Workbench for AVR32バージョン4.10以前では、同じソースコードを使用してもエラーは表示されません。)

背景

サードパーティのソースコードの中には、IAR Embedded Workbench for AVR32バージョン4.2xで修正されたバグに依存するものがあります。

バグ

バグの内容は、あるインラインアセンブラ文で使用されているラベルが、別のインラインアセンブラ文のジャンプで使用される場合があるというものでした。
IAR C/C++ Compiler for AVR32は、そのようなジャンプで使用されるレジスタ等を扱うようには設計されていません。

修正方法

異なるインラインアセンブラ文の間でジャンプが行われるのをブロックします。

修正による影響

この修正によって、上記のジャンプを行うサードパーティ製のソースコードが影響を受けます。

解決方法

第1の解決方法

異なるインラインアセンブラ文の間でジャンプする必要がないように、ソースコードを書き直します。

次善策

以下の構造を使用します。重要: この次善策を使用すると、コンパイラのセキュリティシステムが影響を受けます。この次善策は、ユーザの責任において行ってください。

この次善策は、--disable_inline_asm_label_replacementを使用します。詳細は、<インストールディレクトリ>\avr32\doc\infocenter\iccavr32.ENU.htmlに記載されています。

The following option has been added:
--disable_inline_asm_label_replacement

Explanation:
Use this option to disable label replacement in
inline assembler statements.Disabling label
replacement will make labels shared between inline
assembler statements within a function meaning
that one inline assembler statement may refer to a
label in another inline assembler statement.

IMPORTANT:
IMPORTANT: The compiler leaves no guarantees on
the content of any register nor of the layout of
the stack frame upon entry of an inline assembler
statement unless explicitly requested through the
use of the extended inline assembler.Branching
between two inline assembler statement results in
"undefined behavior". 

 

全ての製品名は、それぞれの所有者の商標または登録商標です。

申し訳ございませんが、弊社サイトではInternet Explorerをサポートしていません。サイトをより快適にご利用いただくために、Chrome、Edge、Firefoxなどの最新ブラウザをお使いいただきますようお願いいたします。