relocatable link problem

Yvan Castilloux kayoux@hotmail.com
Thu Jun 15 14:30:00 GMT 2006


Hi,

We are trying to achieve the following:

1)Our main goal is to have our code stripped of all symbols that are not 
used by the user when he links his application code to ours.

2)I'm using mspgcc that I believe uses gcc 3.3 or something. Because of its 
limitations (as opposed to 4.1), I was told to first pre-link my code with 
the -r option and then strip the resulting file, only keeping the symbols 
that will be used by the user. Then the user would link its application code 
with this pre-linked file. I was told by the mspgcc group to come here for 
questions.

The problems, for now, comes with pre-linking our code. There are some 
functions that are called in our code but defined in the user's code. I then 
decided to declare these functions as extern, otherwise there's an undefined 
error. Then I added the -r option in the linkage. The command was as 
follows:

msp430-gcc -mmcu=${CPU} -r -olibdevice.a -Tldscript1612.x -L$(LIBDIR) 
$(DEVICE_OBJS) -ldevice

DEVICE_OBJS is the list of compiled .0 objects that are to be linked.

They're compiled with the following command:

msp430-gcc  -c -mmcu=${CPU} -Wall -fshort-enums -mno-stack-init -Os 
-I$(INCLDIR) -I$(CC_INC_DIR) $< -o $@

When doing so, I get almost all the globals and some functions as:

obj/Messages.o: In function `DecodeRequestTS128Msg':
/cc/Messages.c:788: undefined reference to `gtMasterDevicesVector'
/cc/Messages.c:792: undefined reference to `gtMasterDevicesVector'
obj/Messages.o: In function `ReceiveSystemMsg':
/cc/Messages.c:983: undefined reference to `gtDeviceType'
/cc/Messages.c:967: undefined reference to `gtModem'
/cc/Messages.c:967: undefined reference to `gtModem'
/cc/Messages.c:952: undefined reference to `ReceiveNetMsg'
..........

What am I doing wrong??

Thank you,

Yvan




More information about the Binutils mailing list