* relocatable link problem
@ 2006-06-15 14:30 Yvan Castilloux
2006-06-22 15:39 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Yvan Castilloux @ 2006-06-15 14:30 UTC (permalink / raw)
To: binutils
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: relocatable link problem
2006-06-15 14:30 relocatable link problem Yvan Castilloux
@ 2006-06-22 15:39 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-06-22 15:39 UTC (permalink / raw)
To: Yvan Castilloux; +Cc: binutils
Hi Yvan,
> 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
I suspect that the problem here is that the "-r" switch is not being
interpreted by the msp430-gcc program as a switch for the linker. Try
using "-Wl,-r" instead.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-22 15:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-15 14:30 relocatable link problem Yvan Castilloux
2006-06-22 15:39 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).