Subject: undefined symbol "" again
To: None <port-sparc@netbsd.org>
From: Michael Rauch <mrauch@fs.tum.de>
List: port-sparc
Date: 12/29/2000 16:23:13
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi, 

while working on gcc-2.95.2 I have found this quite strange behaviour with 
the standard gcc (egcs-1.1.2) and NetBSD 1.5 on sparc, which seems to be 
some kind of reincarnation of the bug described in 
http://mail-index.netbsd.org/port-sparc/2000/07/30/0000.html

I've created two very simple C-files (one function and one main() calling 
this function ) and left out the -fPIC flag when compiling the function 
into a shared library. I expected to get "RRS text relocations" or 
something similar like on 1.4 but the linker exited happily without saying 
anything and linking the library with the main program also succeeded. But 
when I try to run the program I get the error

./libclass.so: Undefined symbol "" (reloc type = 12, symnum = 4)

I've played a little bit with the debugger but I haven't been able to get 
more useful information what went wrong. If you've got any clues, hints, 
... where I could have a look at or how to debug the dynamic loader 
/etc/ld.elf_so (e.g. how to set a breakpoint at the very beginning start of 
the program) please let me know it. 

Here the recipe for reproducing the error:
> export LD_LIBRARY_PATH=.
> gcc -shared -o libclass.c class.c
> gcc -L. -lclass -o prog prog.c 
> ./prog
The two files are attached. 

Thanks in advance for your help. 


Michael


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="class.c"

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>

extern void testclass(int);

void testclass(int i) {
  printf("%d \n",i);
}

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename="prog.c"

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>

extern void testclass(int);

int main() {
  int i = 5;
  testclass(i);
  exit(0);
}

--azLHFNyN32YCQGCU--