Hi Chunyan, all
Patch applied and GCC inline issue fixed. OpenCSD v0.5.4 released on github.
Thanks and Regards
Mike
On 11 January 2017 at 15:45, Mark Brown broonie@linaro.org wrote:
On 11 January 2017 at 15:17, Mike Leach mike.leach@linaro.org wrote:
Hi Chunyan,
Thanks - I hadn't spotted this. I was building the release and testing that, assuming that the debug would be fine.
Looks like GCC is not correctly (at least as I understand it) compiling/linking the inline functions in debug build. Doesn't error in GCC release build or any build of MSVC.
I'll see if I can figure out something that works in a "standard" way with all the compilers.
A brief sampling suggests that the problem functions are all non-static inlines - in general inline functions should be static. At a guess the compilation of each file doesn't do the inline (it's just a hint, not a command) and assumes a non-static version will be available somewhere (as the symbol has global linkage) but obviously that never happens. If you mark the functions as static then the compiler knows they can't be provided by another compilation unit and has to emit a definition locally.
If the compiler did emit the symbols you'd end up with the linker complaining that there are multiple definitions unless it manages to work out that they're identical.