Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Source code that uses the __asm instruction cannot be compiled with the /GL - Enable Link-Time Code Generation option. Unlike other target architectures, the SH4 treats the __asm instruction as a special function call; the string containing the instruction is treated as an argument to the function.
Furthermore, the SH-4 front-end treats any function that begins with the __asm string in this way. For example, the following code examples both define inline-asm functions that follow the standard SH4 call conventions.
int asm_int(const char *);
float asm_float(const char *);
In the preceding examples, the SH-4 assumes that any return value of __asm_int() is an integer in R0. Similarly, SH-4 assumes the return value for __asm_float() is a floating point number in fr0. Thus, the SH-4 user can have multiple __asm functions that interface with any other code in a predictable manner.
This strategy causes difficulties for Link-time Code Generation (LTCG), because the compiler back-end, which processes the __asm calls, is invoked after the linker is invoked.
The linker treats all the __asm calls as simply another function call and attempts to resolve all __asm function calls to their definitions.
However, because __asm is not a conventional function, it has no definition: the compiler back-end replaces an __asm function call with SH-4 instructions. Thus, if the user attempts LTCG, the linker generates a linker error that indicates the symbol __asm is not defined.
See Also
Elements of the SH-4 __asm Block | __asm
Send Feedback on this topic to the authors