>Does Solaris and/Or Sun Studio have any linker/compiler flags to warn
>users if a library or other code defines a symbol which is already used
>by libc ?
>For example MacOSX seems to create the following output when you define
>|strtol| in an application library (this is from
>https://mailman.research.att.com/pipermail/ast-developers/2006q3/000138.html):
>-- snip --
>ld: warning multiple definitions of symbol _strtol
>/home/pdragosh/src/pads-1.1/ast-ast/arch/darwin7.ppc/lib/libast.a(strtol.o) 
>definition of _strtol in section (__TEXT,__text)
>/usr/lib/libSystem.dylib(strtol.So) definition of _strtol
>ld: warning multiple definitions of symbol _strtoul
>/home/pdragosh/src/pads-1.1/ast-ast/arch/darwin7.ppc/lib/libast.a(strtoul.o) 
>definition of _strtoul in section (__TEXT,__text)
>/usr/lib/libSystem.dylib(strtoul.So) definition of _strtoul
>-- snip --
>
>I'd like to get similar output in Solaris - is that somehow possible ?


Multiple definitions within dynamic objects is allowed, hence there
are no error/warning messages given.   But you can get the information.

 % man ld
 .....
      -m

         Produces a memory map or  listing  of  the  input/output
         sections,  together  with any non-fatal multiply-defined
         symbols, on the standard output.
 .....
 
 % cat main.c
 long strtol()
 {
        return (0);
 }

 void main(){}
 
 % cc -Wl,-m -o main main.c | tail -20
 
                 MULTIPLY DEFINED SYMBOLS


 symbol                            definition used     also defined in

 __environ_lock                      /SUNWspro/lib/crt1.o
                                                        /lib/libc.so
 ___Argv                             /SUNWspro/lib/crt1.o
                                                        /lib/libc.so
 strtol                              main.o
                                                        /lib/libc.so
 environ                             /SUNWspro/lib/crt1.o
                                                        /lib/libc.so
 _environ                            /SUNWspro/lib/crt1.o
                                                        /lib/libc.so


--
Rod.

_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to