Subject: Re: -current libc not working
To: Peter Seebach <seebs@plethora.net>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-alpha
Date: 05/31/2000 10:57:34
On Tue, May 30, 2000 at 10:02:57PM -0500, Peter Seebach wrote:
> Okay, I'm sure this is me.  But I'm not sure what I'm doing.
> 
> I'm running -current on a couple of boxes.  Among them, i386 and alpha.
> 
> My i386 is working beautifully.
> 
> My alpha experiences a tragic death of all dynamically linked executables
> if I use libc.so.12.61.  It works fine with my fairly old libc.so.12.54.
> The problem is a symbol called __mainprog_obj.  The symbol is defined in
> crt0.o.  It is defined in all the dynamically linked executables.  However,
> when they try to link to libc (which needs an external symbol named
> __mainprog_obj), they fail, and I get:
> 
> /usr/lib/libc.so.12: Undefined symbol "__mainprog_obj" (reloc type = 25, symnum = 1024)
> 
> Here's the nm output of a sample program ("main(){}"):
> 
> 0000000120100c90 A _DYNAMIC
> 0000000120100be8 A _GLOBAL_OFFSET_TABLE_
> 0000000120100ba0 A _PROCEDURE_LINKAGE_TABLE_
> 0000000120100da0 A __bss_start
> 0000000120100da0 B __mainprog_obj
> 0000000120100b58 D __progname
> 0000000120100b60 D __ps_strings
> 00000001200005a0 T __start
>                  U __syscall
> 0000000120000900 T _dladdr
> 0000000120000840 T _dlclose
> 00000001200008c0 T _dlerror
> 0000000120000800 T _dlopen
> 0000000120000880 T _dlsym
> 0000000120100da0 A _edata
> 0000000120100db0 A _end
> 0000000120000aa0 A _etext
> 0000000120000aa0 ? _fini
> 0000000120000540 ? _init
> 0000000120000700 T _rtld_setup
>                  U atexit
> 0000000120000900 W dladdr
> 0000000120000840 W dlclose
> 00000001200008c0 W dlerror
> 0000000120000800 W dlopen
> 0000000120000880 W dlsym
> 0000000120100da8 B environ
>                  U exit
> 0000000120000a60 T main
> 
> Now, __mainprog_obj looks fine to me.  It looks pretty much the same as it
> does in a similar binary on i386, except that the address is larger.  :)
> 
> I've rebuilt:
> 	* gcc, gas, ld
> 	* crt0.o
> 	* my test program
> 	* libc
> and this still happens.
> 
> Anyone else got this?

No, sorry:
disco:/usr/lib#uname -a
NetBSD disco 1.4Y NetBSD 1.4Y (DS20-siop) #0: Wed May 31 09:35:57 MEST 2000     bouyer@disco:/home/src/sys/arch/alpha/compile/DS20-siop alpha
disco:/usr/lib#ls -l /usr/lib/libc.so*
lrwxr-xr-x  1 root  wheel       13 May 24 00:43 /usr/lib/libc.so -> libc.so.12.61
lrwxr-xr-x  1 root  wheel       13 May 24 00:43 /usr/lib/libc.so.12 -> libc.so.12.61
-r--r--r--  1 root  wheel  1256496 May 24 00:43 /usr/lib/libc.so.12.61
disco:/usr/lib#ls -l /usr/lib/*crt*
-r--r--r--  1 root  wheel  7169 May 24 00:42 /usr/lib/crt0.o
-r--r--r--  2 root  wheel  4157 May 24 00:42 /usr/lib/crtbegin.o
-r--r--r--  2 root  wheel  4157 May 24 00:42 /usr/lib/crtbeginS.o
-r--r--r--  2 root  wheel  1905 May 24 00:42 /usr/lib/crtend.o
-r--r--r--  2 root  wheel  1905 May 24 00:42 /usr/lib/crtendS.o
-r--r--r--  1 root  wheel  7717 May 24 00:42 /usr/lib/gcrt0.o
disco:/usr/lib#nm crt0.o libc.so | fgrep __mainprog_obj
0000000000000008 C __mainprog_obj
                 U __mainprog_obj

With your simple test program I get:
0000000120100ee0 B __mainprog_obj

Are you sure your ld.so is ok ?

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--