home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / utils / bug / 2340 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.0 KB  |  74 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!sunshine.labs.tek.COM!hahn
  3. From: hahn@sunshine.labs.tek.COM (Doug Hahn)
  4. Subject: bug report, gas 1.38, hack solution
  5. Message-ID: <9301070059.AA01609@sunshine.LABS.TEK.COM>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 7 Jan 1993 00:59:02 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 61
  12.  
  13. Using gas 1.38, I cross assembled this file on sparc2 sunos 4.1 to 68k
  14. target: 
  15.  
  16.         .globl  lcd_init, lcd_pwrup
  17.         .text
  18.         .even
  19. lcd_init:
  20.         movel    #    0x00f00000        ,a1
  21. msg_pu:
  22.         .ascii    "POWER-UP DIAGNOSTICS"
  23.         .byte    0
  24.         .even
  25. lcd_pwrup:
  26.         movel    #    0x00f00000        ,a1
  27.         lea        pc@(msg_pu),a2
  28.         moveb   #        0x42 ,a1@(     1 )
  29.         moveb    a2@+,d0
  30.         .ascii    "garbagegarbagegarbagegarbagegarbagegarbagegarbagegarbage"
  31.         .byte    0
  32.  
  33. and in the resulting object code, the lea offset is off by 2. (actual
  34. offset is msg_pu - 2) ie. (ala gdb)
  35. 0x22 <lcd_init+34>:     lea 0x4 <lcd_init+4>,a2
  36. or for the more exacting:
  37. 0x22 <lcd_init+34>:     0x45faffe4
  38.  
  39. I tried some other insns using pc relative addressing (well, at least
  40. movel) and that didn't  seem to work either.
  41.  
  42. I did this:
  43.  
  44. sunshine /gas-1.38/ diff -c2 ../../Fall92/gas-1.38/write.c write.c
  45. *** ../../Fall92/gas-1.38/write.c       Thu Oct 11 09:26:15 1990
  46. --- write.c     Wed Jan  6 16:10:59 1993
  47. ***************
  48. *** 1089,1094 ****
  49.               add_number += add_symbolP -> sy_value;
  50.               add_number -=
  51. ! #ifndef NS32K
  52.                       size +
  53.   #endif
  54.                       where + fragP -> fr_address;
  55. --- 1089,1096 ----
  56.               add_number += add_symbolP -> sy_value;
  57.               add_number -=
  58. ! #if !defined(NS32K)
  59. ! #if 0
  60.                       size +
  61. + #endif
  62.   #endif
  63.  
  64. because according to the 68k manual, pc relative is calculated from
  65. the beginning of the operand, not the end.  It worked fine.  Does not
  66. seem to affect compiler generated assembly because pc relative does not
  67. seem to be used (except for jump tables where this an absolute
  68. expression is used as an operand).
  69.  
  70. So what machine DOES have to add in size?
  71.  
  72.   -- Doug
  73.  
  74.