Reputation: 3443
The product I work on is structured as several DKM projects referenced by my VIP project.
though, there is one "Unknown" function implementation, one that will be loaded later on in the init phase.
In order to load it:
1. I declare a function pointer (funcPtr).
2. after I call LoadModule()
aka. ld()
3. call symFind()
to get the address of the newly loaded symbol
4. assign the funcPtr
the address.
I have problems with this solution as I must not have the symbol-table in my release build.
Its treated as sensitive organizational data, but without it I couldn't use symFind()
Any of the following question can mitigate or resolve my problem, so i'd appreciate any answer :)
When calling loadModule(myModule.o)
, is there a function in myModule that is called right after it is loaded?
Can I compile a VIP project with a missing extern symbol, like in linux. that will be relocated later on when i use ld() for my module?
Can I limit the Symbol-Table to dispense the sym-tbl except for the few symbols I need, How?
Upvotes: 1
Views: 917
Reputation: 3443
Answering my Questions:
When calling loadModule(myModule.o), is there a function in myModule that is called right after it is loaded?
Answer: Didn't use it.
Can I compile a VIP project with a missing extern symbol, like in linux. that will be relocated later on when i use ld() for my module?
Answer: No, a VIP is fully-linked and cannot have undefined symbols.
You can have Pointer to Functions, and assign their addresses when they become available.
Can I limit the Symbol-Table to dispense the sym-tbl except for the few symbols I need, How?
Answer: Yes, I used stripppc -K <symbol_to_keep> ...
command in the make-file to achieve that.
Upvotes: 1
Reputation: 329
I faced the same problem a while back. I have implemented the dynamic linking facility as the following (on VxWorks 6.8), assuming there exists a function with the signiture void* callMeDynamic()
:
use loadModule()
to load needed object files.
Get the address(es) of the function.
I could not find an easy way to achieve this step. I found a work around as the following.
2.1. Create a pipe and divert the stdout as described in Using a VxWorks Pipe
2.2. Call lkup(callMeDynamic)
and save the output using said pipe.
2.3. Parse the output of the lkup dump and get the address of your entry function.
Hope this helps.
Upvotes: 1