Undefined symbol in inline assembly

Technical Note 47972



2/5/2015 11:27 AM


After migration to IAR Embedded Workbench for AVR32 version 4.2x, the error...

Error[As011]: Undefined symbol: XXXXXX

.. is triggered for source code that uses inline assembly.

(There is no error for the same source in IAR Embedded Workbench for AVR32 version 4.10 or older).


There is 3rd party source code that relies on a corrected bug in IAR Embedded Workbench for AVR32 version 4.2x.

The bug...

...was that a label in one inline assembly statement, could be used for a jump for another inline assembly statement.
The IAR C/C++ Compiler for AVR32 is not made to handle registers etc. for such a jump.

The correction...

...was to block jumps between different inline assembly statements.

Correction breaks 3rd party...

...source code that uses the described type of jump.


Primary solution...

...is to rewrite the source so it doesn't need jumps between different inline assembly statements.

An a workaround...

...is to use the following construction. Please Note - IMPORTANT: This workaround Breaks the security system in the Compiler, i.e. You take responsibility for the effects of using this workaround.

The workaround is to use --disable_inline_asm_label_replacement which is documented in <installation directory>\avr32\doc\infocenter\iccavr32.ENU.html

The following option has been added:

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: 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". 


All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.