Subject: ld.so_elf section relocation
To: None <tech-kern@netbsd.org>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 02/12/2003 13:52:42
I'm trying to use gcc3.2.2 on ultrasparcs and for that i'm running
through gcc's testsuite. Plenty of errors came from libstd++, they
manifest as runtime linker error

Undefined symbol "" (symnum = 19)

Failed relocation was: 
000000000017b011 R_SPARC_UA64      .gcc_except_table+0x0000000000183c50

And symbol it refered was indeed STT_SECTION type which seems
need to have special processing in _rtld_find_symdef.

So here is a patch for your review which made a failed test to run,
i'm going to test and look more around this meanwile...
And this area is somewhat new for me, so I appreciate comments.

	Andrey

Index: symbol.c
===================================================================
RCS file: /cvsroot/src/libexec/ld.elf_so/symbol.c,v
retrieving revision 1.25
diff -u -p -r1.25 symbol.c
--- symbol.c    2002/10/05 11:59:04     1.25
+++ symbol.c    2003/02/12 21:35:07
@@ -188,6 +188,11 @@ _rtld_find_symdef(symnum, refobj, defobj
        def = NULL;
        defobj = NULL;
        
+       if (ELF_ST_TYPE(ref->st_info) == STT_SECTION) {
+               *defobj_out = refobj;
+               return ref;
+       }
+
        if (refobj->symbolic) { /* Look first in the referencing object */
                symp = _rtld_symlook_obj(name, hash, refobj, in_plt);
                if (symp != NULL) {