To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 959
958  |  960
Subject: 
Re: memcpy patch for gcc 2.95.2 wanted
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 26 Mar 2000 17:43:07 GMT
Viewed: 
2282 times
  
On Sun, 26 Mar 2000, Les Smithson wrote:
I think the compiler was generating incorrect code. I'm no gcc expert, but the
asm macros looked OK to me, and besides, why should the macro work in one
compiler version & not the other?

Because there were some decisions made as to what "incorrect" macros were
and weren't by the egcs/gcc teams. For some time, this made compiling the
Linux kernel with the newest egcs a serious problem.

FYI, I fixed it by compiling the source to an assembler file (using -S), then
hacking the assembler file. Just remove memcpy.c from the build tree and leave
memcpy.s in its place. Beware the 'make realclean' will remove all '.s' files.
Here's a copy of the fixed assembler code, memcpy.s:

; GCC For the Hitachi H8/300
; By Hitachi America Ltd and Cygnus Support
; release F-1
; -O2


.file "memcpy.c"
.section .text
.align 1
.global _memcpy
_memcpy:
mov.w r1,r3
add.w r2,r3
; #APP

         0:cmp r1,r3
           beq 1f
            mov.b @r1+,r2l
            mov.b r2l,@r0
            adds #1,r0
           bra 0b
         1:

; #NO_APP
rts
.end

Cool.
-Luis



#######################################################################

     Profanity is the one language that all programmers understand.
                  -Anonymous

#######################################################################



Message has 1 Reply:
  Re: memcpy patch for gcc 2.95.2 wanted
 
(...) IMHO it is better anyway to use pure assembly files when generating code like memcpy (which is completely in assembly here). Call them memcpy.S, and you won't have the problem of accidentially removing them. With this you can use 'c' style (...) (25 years ago, 26-Mar-00, to lugnet.robotics.rcx.legos)  

Message is in Reply To:
  Re: memcpy patch for gcc 2.95.2 wanted
 
(...) I think the compiler was generating incorrect code. I'm no gcc expert, but the asm macros looked OK to me, and besides, why should the macro work in one compiler version & not the other? FYI, I fixed it by compiling the source to an assembler (...) (25 years ago, 26-Mar-00, to lugnet.robotics.rcx.legos)

11 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR