Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!amdahl!key!sjc From: sjc@key.COM (Steve Correll) Newsgroups: comp.sys.mips Subject: Re: Mips assembler question Message-ID: <1947@key.COM> Date: 12 Jun 90 16:09:50 GMT References: <1380@quintus.UUCP> <1990Jun11.213554.15606@imax.com> Organization: Key Computer Labs, Fremont, CA Lines: 24 In article <1380@quintus.UUCP> mark@quintus.UUCP (Mark Spotswood) writes: | a: | .word b-c | | If the assembler can figure out what b and b-2 will be, why can't it figure | out what b-c will be? Is there a way to do what I want in Mips assember? In article <1990Jun11.213554.15606@imax.com>, dave@imax.com (Dave Martindale) writes: > Initializing a location in memory with the difference between two external > addresses requires some way for the assembler to tell the linker that it > should calculate the difference between two external symbols and store > the result in this location. Some object file formats simply have > no way of specifying this computation. Indeed, the MIPS COFF object format does not provide relocation for b-c. However, the assembler can't even subtract non-relocatable labels, because it tries to process the operand of .word long before it performs instruction scheduling and reordering, and therefore it doesn't know how many nops it's going to insert, etc. If you need the subtraction to figure out the offset to a field in a data structure, the .struct directive may well help; but if you need the difference of two labels in an instruction stream, sorry about that. -- ...{sun,pyramid}!pacbell!key!sjc Steve Correll