I suspect that the wrong version of libgcc.a is being used during the
linking stage. I'm probably not using the correct compile/link time
flags, but as far as I know everything is as it should be.

My program consists of a simple 32x32->64 multiply but the wrong code
is being linked for muldi3. Here is the relevant dissassembly:

000011e2 <__muldi3>:
    11e2:       04 12           push    r4              ;
    11e4:       05 12           push    r5              ;
    11e6:       06 12           push    r6              ;
    11e8:       07 12           push    r7              ;
    11ea:       08 12           push    r8              ;
    11ec:       09 12           push    r9              ;
    11ee:       0a 12           push    r10             ;
    11f0:       0b 12           push    r11             ;
    11f2:       14 41 12 00     mov     18(r1), r4      ;
    11f6:       15 41 14 00     mov     20(r1), r5      ;
    11fa:       16 41 16 00     mov     22(r1), r6      ;
    11fe:       17 41 18 00     mov     24(r1), r7      ;
    1202:       0b 43           clr     r11             ;
    1204:       0a 43           clr     r10             ;
    1206:       09 43           clr     r9              ;
    1208:       08 43           clr     r8              ;
    120a:       12 c3           clrc
    120c:       07 10           rrc     r7              ;
    120e:       06 10           rrc     r6              ;
    1210:       05 10           rrc     r5              ;
    1212:       04 10           rrc     r4              ;
    1214:       04 28           jnc     $+10            ;abs 0x121e
    1216:       08 5c           add     r12,    r8      ;
    1218:       09 6d           addc    r13,    r9      ;
    121a:       0a 6e           addc    r14,    r10     ;
    121c:       0b 6f           addc    r15,    r11     ;
    121e:       0c 5c           rla     r12             ;
    1220:       0d 6d           rlc     r13             ;
    1222:       0e 6e           rlc     r14             ;
    1224:       0f 6f           rlc     r15             ;
    1226:       04 93           cmp     #0,     r4      ;r3 As==00
    1228:       f0 23           jnz     $-30            ;abs 0x120a
    122a:       05 93           cmp     #0,     r5      ;r3 As==00
    122c:       ee 23           jnz     $-34            ;abs 0x120a
    122e:       06 93           cmp     #0,     r6      ;r3 As==00
    1230:       ec 23           jnz     $-38            ;abs 0x120a
    1232:       07 93           cmp     #0,     r7      ;r3 As==00
    1234:       ea 23           jnz     $-42            ;abs 0x120a
    1236:       0c 48           mov     r8,     r12     ;
    1238:       0d 49           mov     r9,     r13     ;
    123a:       0e 4a           mov     r10,    r14     ;
    123c:       0f 4b           mov     r11,    r15     ;
    123e:       3b 41           pop     r11             ;
    1240:       3a 41           pop     r10             ;
    1242:       39 41           pop     r9              ;
    1244:       38 41           pop     r8              ;
    1246:       37 41           pop     r7              ;
    1248:       36 41           pop     r6              ;
    124a:       35 41           pop     r5              ;
    124c:       34 41           pop     r4              ;
    124e:       30 41           ret

as you can see, this is the code from the section of libgcc.S that
*doesn't* use the hw multiplier.
So, based on my command line, in which you can see the correct flags
for enabling the hw multiplier, I believe that the wrong library is
being referenced. Here is a capture of the entire compilation:

msp430-gcc -g -mmcu=msp430x149 -v -c irap.c
Reading specs from /usr/local/msp430/lib/gcc-lib/msp430/3.2.3/specs
Configured with: ./configure --target msp430 --prefix=/usr/local/msp430
Thread model: single
gcc version 3.2.3
 /usr/local/msp430/lib/gcc-lib/msp430/3.2.3/cc1 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102
-DMSP430 -D__MSP430__ -D__MSP430 -D__NO_INLINE__ -D__STDC_HOSTED__=1
-DMSP430_HAS_HW_MUL -D__MSP430_149__ -DMSP430_HAS_HWMUL
-D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__INT_MAX__=32767
irap.c -quiet -dumpbase irap.c -mmcu=msp430x149 -g -version -o
/tmp/ccMU1ndI.s
GNU CPP version 3.2.3 (cpplib) (GNU assembler syntax)
GNU C version 3.2.3 (msp430)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux
3.2.2-5).
ignoring nonexistent directory "/usr/local/msp430/msp430/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/msp430/include
 /usr/local/msp430/lib/gcc-lib/msp430/3.2.3/include
 /usr/local/msp430/msp430/include
End of search list.
 /usr/local/msp430/lib/gcc-lib/msp430/3.2.3/../../../../msp430/bin/as
-o irap.o
/tmp/ccMU1ndI.s
msp430-gcc -g -m msp430x149  irap.o -o irap

I could hardcode the makefile to link in the correct lib from
/usr/local/msp430/lib/gcc-lib/msp430/3.2.3/msp2/libgcc.a, but in my
opinion the linker should do that based on the fact that I specify a
mmcu that contains a hw multiplier.

Any ideas?

-A







                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

Reply via email to