CW for ColdFire Linker Deadstripping

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW for ColdFire Linker Deadstripping

6,136 Views
Frame
Contributor I
Hi,
 
I'm an experienced embedded developer, but new to CW and ColdFire.  I'm having trouble with the deadstripping feature of the linker.  My application is almost entirely table driven (lots of pointers to functions).  Many functions are only referenced in tables, with no explicit calls.  The linker (in its infinite wisdom) does not recognize these references and strips most of the code from my application, calling it 'dead' (unreferenced) code.  As if this was not bad enough, the table entries for the (now non-existent) functions do not generate link errors (i.e. unresolved external symbol, etc).  Instead, the references are simply assigned a null value and the link completes with no errors.
 
If I disable linker deadstripping, the linker issues 'tons' of errors due to unresolved symbols in the ColdFire libraries.
 
Is there some way to only allow deadstripping of the libraries but not my application code?  I'm sure someone has solved this problem already.  Any advice would be greatly appreciated.
 
Thanks
Labels (1)
0 Kudos
6 Replies

603 Views
marc_paquette
Contributor V
How are you turning off deadstripping? The ColdFire Linker settings panel lets you turn off deadstripping completely. But you can use commands in a linker control file for more fine-grained deadstripping.
 
This command specifies which objects not to deadstrip:
 
FORCE_ACTIVE { symbol1 .. symbolN }
 
Alternately, place all the objects you don't want deadstripped in a section and use this command
 
KEEP_SECTION { section1 .. sectionN }
 
which protects whole sections in object code from being deadstripped by the linker.
 
The Targeting ColdFire manual explains these linker commands in detail.
 
Marc.
0 Kudos

603 Views
Frame
Contributor I

Marc,

Thank you for the quick response.  I am turning off deadstripping by means of the ColdFire Linker settings panel.

My application has dozens of modules and hundreds of table entries.  How can I effectively manage this in the linker command file?  Recall that the linker does not issue any warnings or errors if I miss something.  My code will link fine but crash if I've missed a table entry somewhere.  Is there some way to tell the linker to perform deadstripping on the ColdFire libraries but not on my code?

Thanks

0 Kudos

603 Views
marc_paquette
Contributor V
The FORCE_ACTIVE, KEEP_SECTION, and REF_INCLUDE (which I forgot to mention in my previous post) commands are the only linker commands that manage deadstripping. In other words, the linker always deadstrips so you have to explicitly specify which objects must not be.
 
Are you able to group all the objects you don't want deadstripped in a section to take advantage of a single KEEP_SECTION command? I'll admit such an arrangement might be a false economy.
 
Another alternative: enclose your function definitions with the pragma force_active. Maybe some preprocessor shorthand might ease the task:
 
#define ACTIVE_ON #pragma force_active on
#define ACTIVE_OFF #pragma force_active off
 
ACTIVE_ON
void my_tablefunc(void)
{
 /* ... */
}
ACTIVE_OFF
 
 
Also, take a look at the REF_INCLUDE command in the Targeting manual, which follows closures in your object code. It might save you some work.
 
Marc.
0 Kudos

603 Views
haluong
Contributor I
Dear Marc,

I created the "DSP56800X New Project Wizard"/simulators. And I used smm linker,  Disable  Deadstripping in linker panel setting. I try to change the linker  with  KEEP_SECTION, but  I cannot,  the error is
"Link Error   : Undefined : "F_ExitProcess"
Referenced from "F__exit" in MSL C 56800E.lib

Link Error   : Undefined : "F__ieee754_log"
Referenced from "F__ieee754_acosh" in MSL C 56800E.lib

Link Error   : Undefined : "Ffma"
Referenced from "Ffmal" in MSL C 56800E.lib

Link Error   : Undefined : "Fstrtof"
Referenced from "Fnanf" in MSL C 56800E.lib

Link failed.
"
Could you please help?
Thanks,
haluong
0 Kudos

603 Views
haluong
Contributor I

In addition, I use -force_active for specify a list of symbols as undefined such as F_ExitProcess,  it has the error as the attached file

 

untitled3.zip

Message Edited by t.dowe on 2009-09-04 11:31 AM
0 Kudos

603 Views
CrasyCat
Specialist III
Hello
  Please create a new Thread in the CodeWarrior for DSP56xxx forum for that,
  This question has nothing to do in the Coldfire forum.
 
Thanks for your understanding.
 
CrasyCat
0 Kudos