Having problem linking with libm.so on OpenSUSE 10.2, x86_64

Hi,

I am able to perform all these things:

gcc a.c -lm

gcc a.c -lm -m32

CC a.c -lm -m32

However, linking with 64 bit lib fails.

CC a.c -lm -v

###command line files and options (expanded):

### a.c -lm -v

### CC: Note: NLSPATH = /opt/sun/sunstudio12/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/sun/suns tudio12/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat

/opt/sun/sunstudio12/prod/bin/ccfe -y-o -ya.o -y-fbe -y/opt/sun/sunstudio12/prod/bin/fbe -y-xarch=amd64 -xarch=amd64 -y-xtab -y-verbose -O0 -ptf /tmp/05261%1.%2 -ptx /opt/sun/sunstudio12/prod/bin/CC -ptk "-v -xs " -D__SUNPRO_CC=0x590 -Dunix -D__x86_64 -D__x86_64__ -D__amd64 -D__amd64__ -D__unix -D__unix__ -D__BUILTIN_VA_STRUCT -D__linux -D__linux__ -Dlinux -D__gnu__linux__ -D__SUNPRO_CC_COMPAT=5 -xdbggen=no%stabs+dwarf2 -y-s -xdbggen=incl -I-xbuiltin -xldscope=global -instlib=/opt/sun/sunstudio12/prod/lib/amd64/libCstd.a -I/opt/sun/sunstudio12/prod/include/CC/Cstd -I/opt/sun/sunstudio12/prod/include/CC -I/opt/sun/sunstudio12/prod/include/CC/rw7 -I/opt/sun/sunstudio12/prod/include/cc -y-comdat a.c -s /tmp/ccfe.05261.0.s >&/tmp/ccfe.05261.1.err

rm /tmp/ccfe.05261.0.s

### CC: Note: LD_LIBRARY_PATH = (null)

### CC: Note: LD_LIBRARY_PATH_64 = (null)

### CC: Note: LD_RUN_PATH= (null)

### CC: Note: LD_OPTIONS = (null)

/opt/sun/sunstudio12/prod/lib/amd64/ld -u __1cH__CimplKcplus_init6F_v_ --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -R/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/su nstudio12/rtlibs/amd64:/opt/sun/lib/rtlibs/amd64:/opt/SUNWspro/lib/amd64:/lib64: /usr/lib64 -o a.out /opt/sun/sunstudio12/prod/lib/amd64/crti.o /opt/sun/sunstudio12/prod/lib/amd64/CCrti.o /opt/sun/sunstudio12/prod/lib/amd64/crt1x.o -Y P,/opt/sun/sunstudio12/lib/rw7/amd64:/opt/sun/sunstudio12/lib/amd64:/opt/sun/su nstudio12/rtlibs/amd64:/opt/sun/sunstudio12/prod/lib/rw7/amd64:/opt/sun/sunstudi o12/prod/lib/amd64:/lib64:/usr/lib64 a.o -lm -lCstd -lCrun -lm -lc /opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a /opt/sun/sunstudio12/prod/lib/amd64/CCrtn.o /opt/sun/sunstudio12/prod/lib/amd64/crtn.o >&/tmp/ld.05261.2.err

/opt/sun/sunstudio12/prod/bin/c++filt -filt=no%stdlib </tmp/ld.05261.2.err >>&/tmp/ccfe.05261.1.err

rm /tmp/ld.05261.2.err

/opt/sun/sunstudio12/prod/bin/stdlibfilt -stderr </tmp/ccfe.05261.1.err

/opt/sun/sunstudio12/prod/bin/fbe -s -o a.o -xarch=amd64 -xmodel=small -warn=%none -Qy /tmp/yabedn9Kv8

rm /tmp/yabedn9Kv8

/usr/lib64/libm.so: file not recognized: File format not recognized

rm /tmp/ccfe.05261.1.err

Please look into this. :)

Thanks in advance.>

[2779 byte] By [libma] at [2007-11-26 21:21:04]
# 1
I have also tested the combination:CC -c a.cgcc a.o -lmApparently, the problem I see is in the studio linker... Awaiting a reply. Would be glad to provide more info if required.
libma at 2007-7-10 3:00:32 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
Maybe sun should update it's ld. The current version used is some 2005 version. My system's default linker is:karthik@zeus:~> ld -vGNU ld version 2.17.50.0.5 20060927 (SUSE Linux)I believe any newer version should fix linking to elf64 so files properly...
libma at 2007-7-10 3:00:32 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Thats right, gnu ld introduced a new section .gnu.hash in binutils 2.17, which is not understood

properly by older linkers.

Please, note that 10.2 is not our officially supported platform. We initially target SLES 10, which uses binutils 2.16.

There was a bug in linker that messed up with C++ exceptions handling, so we had to provide an "updated" linker, one you see in our prod/lib/amd64/.

Looks like its no longer "updated" :)

Obvious workaround for this problem is to use system ld:

CC a.c -lm -Qpath /usr/bin

We will try to think out a better way around.

Thanks for reporting this problem to us.

regards,

__Fedor.

SFVa at 2007-7-10 3:00:32 > top of Java-index,Development Tools,Solaris and Linux Development Tools...