Main

11.1 EDK - Inline functions give errors during compilation when optimization is turned off

AR# 22525

Search For Another Answer

Topic EDK-GNU
Last Updated 04/25/2009
Status Active
Description

Keywords: GNU, gcc, inline

When compiling code for the PPC using the EDK tools, the code contains some inline functions similar to the following:

extern inline void out_be8(volatile unsigned char *addr, unsigned int val) { ... }

The code works when compiled with optimization turned on, but when the optimization is turned off the compiler does not find some function calls in the header file. The error message is similar to the following:

"/cygdrive/c/edk_projects/simple_test/src/io.h:81: undefined reference to 'out_be8'"

How do I fix this problem?

Solution

Inlining of optimization functions works only if optimization is turned on in the compiler, unless the inline attribute "always_inline" is inserted.

The solution is to add following line as function prototype:

extern inline void out_be8(volatile unsigned char *addr, unsigned int val) __attribute__((always_inline));


 
 
/csi/footer.htm