Hi,

I'm sending another email.... I'm enjoying this newsgroup...

Anyhow, I went back to my incremental link problem, which I enjoy.

I initialized everything to 0 or to {} if it's a structure or array.

Now it doesn't seem like the option -r works at all or requires some modifications. Any function that is declared as extern is still said to be an "undefined reference", although I believe I use the right command (see previous email)

Even the symbols that are defined the libraries or in the .x require to link them with them. Otherwise it is undefined. When I look at Grant's dummy code, it seems that his extern foo function worked well....

Do I have to initialize the function to {} even if it's extern. I tried for one function and it worked but for others that are used in more than one file, it mentioned multiple definition. But I still don't know if it would link probably with the application.

Any comments? I keep working on it.

Thanx a lot!

Yvan


From: Grant Edwards <[email protected]>
Reply-To: "GCC for MSP430 - http://mspgcc.sf.net"; <[email protected]>
To: [email protected]
Subject: Re: [Mspgcc-users] Incremental link update
Date: Thu, 15 Jun 2006 17:53:07 +0000 (UTC)

On 2006-06-15, Yvan Castilloux <[email protected]> wrote:

> I've made quite amount of research on how to do this.... people tellme to
> invoke the ld command as the following:
>
> msp430-ld -r -o lib.o $(OBJECTS)

That looks right.  I've done that for other targets, but I've
never tried it for MSP430.

> However my problem is that all global variables that are not
> initialized in the declaration statement cause the classic
> error "undefined reference".

Bummer. :)

> I just wonder if it would be an error specific to msp430-ld.

It sure looks like it is.

I compiled and incrementally linked the following two files:

---------file1.c---------------
extern int i;

int foo(void)
{
  return i+1;
}
------------------------------

---------file2.c---------------
extern int foo(void);

int i;

int bar(void)
{
  return i + foo();
}
------------------------------

It worked fine using gcc for IA32, ARM, H8, and AVR.

But it fails for MSP430:

  $ msp430-ld -r -o foo.o file1.o file2.o
  file1.o: In function foo':file1.c:(.text+0x6): undefined reference to i'
  file2.o: In function bar':file2.c:(.text+0xa): undefined reference to i'

Like you said, it's only a problem for uninitialized variables.
If I add an initializer to the declaration of "i", then it's
OK.

> I sent an email to the binutils mailing list and I'm still
> waiting for an answer.

--
Grant Edwards                   grante             Yow!  I'll show you MY
at telex number if you show
                               visi.com            me YOURS...



_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users



Reply via email to