Article View: gnu.utils.bug
Article #1266bug report, gas 1.38, hack solution
From: Doug Hahn
Date: Thu, 07 Jan 1993 00:59
Date: Thu, 07 Jan 1993 00:59
60 lines
2162 bytes
2162 bytes
Using gas 1.38, I cross assembled this file on sparc2 sunos 4.1 to 68k
target:
.globl lcd_init, lcd_pwrup
.text
.even
lcd_init:
movel # 0x00f00000 ,a1
msg_pu:
.ascii "POWER-UP DIAGNOSTICS"
.byte 0
.even
lcd_pwrup:
movel # 0x00f00000 ,a1
lea pc@(msg_pu),a2
moveb # 0x42 ,a1@( 1 )
moveb a2@+,d0
.ascii "garbagegarbagegarbagegarbagegarbagegarbagegarbagegarbage"
.byte 0
and in the resulting object code, the lea offset is off by 2. (actual
offset is msg_pu - 2) ie. (ala gdb)
0x22 <lcd_init+34>: lea 0x4 <lcd_init+4>,a2
or for the more exacting:
0x22 <lcd_init+34>: 0x45faffe4
I tried some other insns using pc relative addressing (well, at least
movel) and that didn't seem to work either.
I did this:
sunshine /gas-1.38/ diff -c2 ../../Fall92/gas-1.38/write.c write.c
*** ../../Fall92/gas-1.38/write.c Thu Oct 11 09:26:15 1990
--- write.c Wed Jan 6 16:10:59 1993
***************
*** 1089,1094 ****
add_number += add_symbolP -> sy_value;
add_number -=
! #ifndef NS32K
size +
#endif
where + fragP -> fr_address;
--- 1089,1096 ----
add_number += add_symbolP -> sy_value;
add_number -=
! #if !defined(NS32K)
! #if 0
size +
+ #endif
#endif
because according to the 68k manual, pc relative is calculated from
the beginning of the operand, not the end. It worked fine. Does not
seem to affect compiler generated assembly because pc relative does not
seem to be used (except for jump tables where this an absolute
expression is used as an operand).
So what machine DOES have to add in size?
-- Doug
Technical Details
Message-ID:
<9301070059.AA01609@sunshine.LABS.TEK.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sunshine.labs.tek.COM!hahnShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sunshine.labs.tek.COM!hahn From: hahn@sunshine.labs.tek.COM (Doug Hahn) Subject: bug report, gas 1.38, hack solution Message-ID: <9301070059.AA01609@sunshine.LABS.TEK.COM> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 7 Jan 1993 00:59:02 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 61