Help: YDL 1.2.1 gcc compiler/linker generates wierd errors


Subject: Help: YDL 1.2.1 gcc compiler/linker generates wierd errors
From: D W (dw9901@yahoo.com)
Date: Sun May 27 2001 - 13:44:49 MDT


Hello,

I'm running YDL v1.2.1 on a PPC.

When I try compiling and linking a test program using gcc,
I'm getting various errors at link time and the link does not
complete. (I also get the same linker errors if I try compiling
using /usr/bin/cc ).

Although the application being compiled consists of many
.c and .h files, I can describe the problem using two small
.c files:

1. file #1 : test1.c

#include <stdio.h>

int test1_fn();
int var1;

main() {
        int i;

        i = test1_fn();
        var1 = 10;
}

int test1_fn() {
        return 5;
}

_________________________
2. file #2 : test2.c

#include <stdio.h>

extern int test1_fn();
extern int var1;

test2_fn() {
        int i;

        i = test1_fn(); /* link error #1 occurs here */
        var1 = 10; /* link error #2 occurs here */
}

_________________________
3. Compile command:

/usr/bin/gcc -o test test1.o test2.o \
        -static /usr/X11R6/lib/libMrm.a /usr/X11R6/lib/libXm.a \
        -L/lib \
        -lm -L/usr/X11R6/lib -lXt -lX11 \

_________________________
4. Link errors:

/home/test2.c:9: undefined reference to `test1_fn'
/home/test2.c:9: relocation truncated to fit: R_PPC_REL24 test1_fn
/home/test2.c:10: test2_fn: undefined reference to `var11'

_________________________
5. Questions:

What errors, if any, exist in the .c files or the compile
command that would result in the errors:

        undefined reference
        relocation truncated to fit

??

The actual app being compiled consists of many .c and .h
files. Is there possibly some symbol table over-run taking
place? If so, is there a way to increase the table size?

Are there additional flags I could be trying in the compile/
link command to resolve the link errors??

Thanks in advance for any help on this.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



This archive was generated by hypermail 2a24 : Sun May 27 2001 - 12:50:48 MDT