xmap error ".LLNK18" is undefined.

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
monk_is_batman
Active Member
Posts: 38
Joined: Wed Jun 09, 2010 3:20 am
Location: Maine, USA

xmap error ".LLNK18" is undefined.

Post by monk_is_batman »

I'm working on a project and encountered this strange error. At first I was able to get rid of it by rearranging placements in my main par block but with the expansion of my code this no longer works. The error looks something like below, sometimes the LLNK numbers vary.

xmap: Error: Symbol "<not-found>" for resolution of resource expression for ".LLNK15" is undefined.
xmap: Error: Symbol for resolution of resource expression for ".LLNK18" is undefined.
xmap: Error: Symbol for resolution of resource expression for ".LLNK20" is undefined.
xmap: Error: Symbol for resolution of resource expression for ".LLNK23" is undefined.
...The previous three lines continue with different LLNK.

My knowledge of compilers/linkers seems to be pretty limited in this regard. Anyone seen anything like this or have ideas on what might help?

Thanks,
-Monk


m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post by m_y »

The nature of the error message is a known bug in xmap.

Last time it happened was due to: a C function being called from XC where a coersion was required (i.e. passing an arrray, resource type etc), and that C function (or its callees) uses a pointer to a function. The solution was to us a "#pragma stackfunction X" on the culprit.

Does this sound likely?

Unfortunately the error is almost no help at all in tracking down the function in question.
User avatar
monk_is_batman
Active Member
Posts: 38
Joined: Wed Jun 09, 2010 3:20 am
Location: Maine, USA

Post by monk_is_batman »

I appreciate your rapid response on this. I added #pragma stackfunction to all of my c functions that get called from xc and that seemed to solve the problem and I was able to compile fine after that.

Is this a bug that is likely to be fixed by the next release? If not is there any way to detect/predict that it may be the culprit and spit out some sort of warning for users that this might be the problem?
m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post by m_y »

Yes. It should be fixed in the next release of the tools. When it's fixed you'll get an error message of the form "Unable to determine stack size for function <foo>".

Prior to that tracking down the specific culprit is probably best tracked down by a binary search, removing and adding the pragmas as required.

For a more directed approach, the ultimate culprit is likely to be using functions pointers. If you pragma any C functions which call through function pointers you should be able to remove all the pragmas on the called-from-XC functions.