* * * * * * * *
$ cat foo.c
int gbl_common[1800];
int func_not_called(void)
{
return gbl_common[0];
}
int foo(void) {
return 42;
}
$ cat main.c
extern int foo(void);
int main(void){
return foo();
}
$ mips-unknown-linux-dev-gcc -ffunction-sections -fdata-sections -Wl,-gc-sections -o test foo.c main.c
(executing on MIPS target)
# ./test
./test: symbol lookup error: ./test: undefined symbol: gbl_common
* * * * * * * *
Looking symbols by readelf gives
$ mips-unknown-linux-dev-readelf -s test | grep gbl_common
4: 00000000 7200 OBJECT GLOBAL DEFAULT ABS gbl_common
and does not belong to any section... gbl_common symbol should be
removed, or at least have its entry in .bss section.
Any hints, comments are appreciated!
Thanks in Advance,
----
(Hiroki Kaminaga)
t