[comp.os.minix] Results of trying to native compile several ls's

rivers@torpid.dg.com (Dave Rivers) (08/18/89)

Well,
	I tried to compile the last two "enhanced" ls's and ran
across the same compiler bug in both.  The dreaded "_label1 = _label2"
problem.  You will see an error message like:

	_label1 multiple defined

(that's right, multiple, not "multiply") from asld, promptly followed
by some unresolved references.

	The solution is:

	for all _labeln where
		_labeln = _labely
		appears in the assembly source
	do
		remove _labeln = _labely
		replace the line 
			_labely:
		with the two lines
			_labeln:
			_labely:
	done

When you then libpack the altered assembly things seem to work.  I have
noticed some problems that look like common sub expression problems with
statics which are initialized to the same thing.  In particular
with the latest ls (used by Bruce Evans).  The procedure longprint
will sometimes mess up the user name.  I solved this problem by
declaring the static pointers "grent" and "pwent" outside of longprint.
This produced more _label1 = _label2 problems, but they were
fixed in the manner "like" above.  To be on the safe side I performed
the following transformations:

	_16 = _10
	_17 = _10
	_20 = _10
	_21 = _10
	  ...		   became- >
	_pwent = _10
	  ...

	_10:                               _16:
	.word 0                            .word 0
                                           _17:
                                           .word 0
                                           _20:
                                           .word 0
                                           _21:
                                           .word 0
                                             ...
                                           _pwent:
                                           .word 0
                                           _10:
                                           .word 0


I did this to ensure the compiler wasn't pulling a tricky common
sub expression elimination and assigning all the addresses for each
static var initialized to 0 to the same address. (i.e. _16, _17, ... _pwent
share the same address since they are initialized to the same thing; which
is obviously not correct.)


When I did this, I linked the newer ls with no problem, and now have
a fantastic ls -Cp that works; even in my lib sources directory!!!


		- Dave Rivers -


+----------------------------------------------------------------------+
| Time Sharing is the use of     | Dave Rivers:                        |
|  many people by the computer.  |  UUCP {Backbones}!rti!dg-rtp!rivers |
|                                | CSNET rivers@dg-rtp.dg.com          |
|                                |  Phone: (919) 248-6137              |
+----------------------------------------------------------------------+