Hi, I have tried another way:
ar rcs libsysdeputil.a sysdeputil.o
gccld seems to recognize the file type. However, it stills find unresoved
symbols
which are actually the functions in sysdeputil.o (can be find out with `nm
libsysdeputil.a`)
The problem disappears if native gcc/ld tool chain is used.
As another test, main.c:
-----------------
extern void foo();
int main()
{
foo();
return 0;
}
----------------
foo.c
---------------
#include <stdio.h.
void foo()
{
printf("hello\n");
return;
}
----------------
And the command lines:
llvm-gcc -c -o main.o main.c
gcc -o foo.o foo.c
ar rcs libfoo.a foo.o
llvm-gcc -Wl,-native main.o -L. -lfoo
It's *OK*
Thanks in advance for solving my problem. :)
And I personally think it may possiblely puzzle other users,
maybe it deserves its place in FAQ or in man page for LLVM.
On Friday 02 June 2006 13:13, Chris Lattner wrote:> On Fri, 2 Jun 2006, Nai Xia wrote:
> > The Makefile is sth like this:
> >
> > vsftpd: $(OBJS)
> > gccld -r -native -o vsftpd.o $(OBJS)
-L/home/xianai/my_projects/llvm/cfrontend/x86/llvm-gcc/lib/ -lcrtend
> > gcc -o vsftpd vsftpd.o sysdeputil.o `./vsf_findlibs.sh`
> >
> >
> > But the gcc/ld still cannot find the reference to __main.
> > Do I have to compile crtend to native to solve this problem?
>
> gccld -r doesn't work with -native. Also, you do need to link in
crtend,
> which doesn't happen with -r, only "producing an executable
mode" links in
> libraries.
>
> -Chris
>
--
Regards,
Nai