|Help with C++ patcher. email@example.com (Ravikant Iyer) (1998-01-30)|
|From:||"Ravikant Iyer" <firstname.lastname@example.org>|
|Date:||30 Jan 1998 00:38:14 -0500|
|Keywords:||C++, practice, question|
I am trying to write a C++ patcher for the vxWorks platform running on
a 68040 board and we are using the Centerline compiler. We have a
basic patcher working but it has some restrictions.
One of these is that it is not possiable to patch a function that uses
other file scope or local scope static functions and variables. The
reason for this is that the patch is made by linking with the system
symbol table for the original program and these local symbols are not
present in the symbol table..
To solve this I decided to go thru the assembler output produced by
the C++ compiler and find all local static and file static labels and
make them global and also add the file name to the lable so as to make
them unique.. I have a working prototype and it works OK for small
examples.. For the larger cases it causes the prelinker to fail in the
template instanciation step. I have no means of finding out what is
going wrong.. I get an error saying fatal error: wrong argument to
Can someone please help me with this??
Also I would like comments on the whole technique it self.. Right now
my tool is an awk script that makes 2 arrays. One containing a list of
all symbols in the .s file the other containing a list of symbols that
have been declared .globl or defined with a .comm assembly
directive. The difference between these 2 arrays is the list of all
file and function scope statics (except some assembler specific labels
that I leave out)
Then I generate a sed script that adds .globl declerations for all the
remaining symbols and adds the original file name to the labels to
make them unique..
This currently takes a long time to run.. Some times like 5
minutes. Because all inline functions that do not get inlined end up as
static functions.. We use a lot of rogue wave classes and these have
many inline functions..
Is there a way to achieve the same (i.e Making all the local static
and file static symbols global and making the names unique) by
manipulating the .o file?? Will that be more efficient than what I am
doing?? Also will it be better if I wrote the program in C instead of
awk and sed to speed up its operations?? any input on these will be
Thanks and regards..
|NORTEL. Santa Clara CA.
Return to the
Search the comp.compilers archives again.