Go to Post I think there are a ton of teams that would kill for one let alone three engineering mentors (especially one with the knowledge and experience that Rich Olivera has). - XaulZan11 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 21-02-2013, 17:55
codes02 codes02 is offline
Randolph aka Roxbury aka R_______
AKA: Cody Schafer
no team (Formerly: Team 11, MORT)
 
Join Date: Oct 2007
Rookie Year: 2008
Location: MA, USA
Posts: 57
codes02 is on a distinguished road
Re: How to detect unresolved references at compile time?

Assuming a unix like shell
Code:
powerpc-wrs-vxworks-readelf -s FRC_UserProgram.out
will list all symbols in your program. The ones marked 'UND' are undefined.

A simple filter for them (not exact, you also only need worry about GLOBAL syms, not LOCAL ones).
Code:
powerpc-wrs-vxworks-readelf -s FRC_UserProgram.out | grep UND
A better one (that only prints symbol names):
Code:
powerpc-wrs-vxworks-readelf -s FRC_UserProgram.out \
| awk '{ if ($5 == "GLOBAL" && $7 == "UND") print $8 }'
Of course, vxworks provides some of those unresolved symbols, and what is useful to you is determining whether your program uses symbols that vxworks does not provide.

Potentially you could construct a list of symbols provided by vxworks (adding new ones that your code uses as needed), filter those out, and if any are left produce an error in your build scripts.

The following shows how to filter out known vxworks symbols (assuming you list them, 1 per line, in vxworks_syms.txt):
Code:
powerpc-wrs-vxworks-readelf -s FRC_UserProgram.out \
 | awk '{ if ($5 == "GLOBAL" && $7 == "UND") print $8 }' \
 | grep -vFf vxworks_syms.txt

Edit: also, sorry that this is not quite compile time . I can't help you there (though -Wmissing-prototypes helps)

Last edited by codes02 : 21-02-2013 at 17:58.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi