Subject: -current libc not working
To: None <port-alpha@netbsd.org, current-users@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: port-alpha
Date: 05/30/2000 22:02:57
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?

I'd be particularly interested in a binary from a system using a recent libc,
so I can see if it links okay.  I figure, either the programs are wrong, or
libc is wrong.

BTW, crt0.o's nm output:

                 U _DYNAMIC
0000000000000008 C __mainprog_obj
0000000000000000 D __progname
0000000000000008 D __ps_strings
0000000000000000 T __start
                 U __syscall
0000000000000360 T _dladdr
00000000000002a0 T _dlclose
0000000000000320 T _dlerror
0000000000000260 T _dlopen
00000000000002e0 T _dlsym
                 U _fini
                 U _init
0000000000000160 T _rtld_setup
                 U atexit
0000000000000360 W dladdr
00000000000002a0 W dlclose
0000000000000320 W dlerror
0000000000000260 W dlopen
00000000000002e0 W dlsym
0000000000000008 C environ
                 U exit
                 U main

Looks boring enough to me.

-s