🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Doug Hahn Thu, 07 Jan 1993 00:59
bug report, gas 1.38, hack solution
#1266
Author: Doug Hahn
Date: Thu, 07 Jan 1993 00:59
60 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads