Anyhow, I made up a simple program to see what actually happens. You might want to save this email to a file, load it up into emacs or some other editor where you can get more than one view of the text at a time. Here's the C-code #include char str[] = "hey"; int main() { int i = 0; for ( ; i < strlen(str) ; i++) putchar(str[i]); return 0; } I then generated some code by doing MIPSgcc -S: .file 1 "test.c" gcc2_compiled.: __gnu_compiled_c: .globl str .sdata .align 2 str: .ascii "hey\000" .text .align 2 .globl main .ent main main: .frame $fp,32,$31 # vars= 8, regs= 2/0, args= 16, extra= \ 0 .mask 0xc0000000,-4 .fmask 0x00000000,0 subu $sp,$sp,32 sw $31,28($sp) sw $fp,24($sp) move $fp,$sp jal __main sw $0,16($fp) $L3: la $4,str jal strlen lw $3,16($fp) sltu $2,$3,$2 bne $2,$0,$L6 j $L4 $L6: lw $3,_iob+20 addu $2,$3,-1 move $3,$2 sw $3,_iob+20 bltz $3,$L7 la $2,_iob+24 lw $3,0($2) la $4,str lw $5,16($fp) addu $4,$4,$5 lbu $5,0($4) sb $5,0($3) addu $3,$3,1 sw $3,0($2) j $L5 $L7: la $2,str lw $3,16($fp) addu $2,$2,$3 lbu $3,0($2) move $4,$3 la $5,_iob+20 jal _flsbuf $L8: $L5: lw $2,16($fp) addu $3,$2,1 sw $3,16($fp) j $L3 $L4: move $2,$0 j $L2 $L2: move $sp,$fp lw $31,28($sp) lw $fp,24($sp) addu $sp,$sp,32 j $31 .end main Which shows that it leaves instructions like la in pseudo-instruction format when making simple assembly. An import note here is that there would be no easy way to represent the above C code as real assembly. We need the pseudo-instructions to hold together things like la. Luckily though, the compiler avoid this problem, by generating the relocation table as it places the instructions. It knows that it has to do something like this for an la $t0, address: 1. Create the following lines of assembly code (probably made into machine code right away or shortly after): lui $t0, [high bits of address] ori $t0, $t0, [low bits of address] 2. Add the corresponding REFHI and REFLO entries to the relocation table. This is what happens when you do MIPSgcc -c test.c (see next step). Now, I then did MIPSgcc -c test.c, which generates the object file. MIPSobjdump -d test.o gives the actual stuff that's in the object file: test.o: file format ecoff-littlemips Disassembly of section .text: 00000000
: 0: 27bdffe0 addiu $sp,$sp,-32 4: afbf001c sw $ra,28($sp) 8: afbe0018 sw $s8,24($sp) c: 0c000000 jal 0
10: 03a0f021 move $s8,$sp 14: afc00010 sw $zero,16($s8) 18: 2784c000 addiu $a0,$gp,-16384 1c: 0c000000 jal 0
20: 00000000 nop 24: 8fc30010 lw $v1,16($s8) 28: 00000000 nop 2c: 0062102b sltu $v0,$v1,$v0 30: 14400003 bnez $v0,40 34: 00000000 nop 38: 08000036 j d8 3c: 00000000 nop 40: 3c030000 lui $v1,0x0 44: 8c630014 lw $v1,20($v1) 48: 00000000 nop 4c: 2462ffff addiu $v0,$v1,-1 50: 00401821 move $v1,$v0 54: 3c010000 lui $at,0x0 58: ac230014 sw $v1,20($at) 5c: 0460000e bltz $v1,98 60: 00000000 nop 64: 3c020000 lui $v0,0x0 68: 24420018 addiu $v0,$v0,24 6c: 8c430000 lw $v1,0($v0) 70: 2784c000 addiu $a0,$gp,-16384 74: 8fc50010 lw $a1,16($s8) 78: 00000000 nop 7c: 00852021 addu $a0,$a0,$a1 80: 90850000 lbu $a1,0($a0) 84: 00000000 nop 88: a0650000 sb $a1,0($v1) 8c: 24630001 addiu $v1,$v1,1 90: 08000031 j c4 94: ac430000 sw $v1,0($v0) 98: 2782c000 addiu $v0,$gp,-16384 9c: 8fc30010 lw $v1,16($s8) a0: 00000000 nop a4: 00431021 addu $v0,$v0,$v1 a8: 90430000 lbu $v1,0($v0) ac: 00000000 nop b0: 00602021 move $a0,$v1 b4: 3c050000 lui $a1,0x0 b8: 24a50014 addiu $a1,$a1,20 bc: 0c000000 jal 0
c0: 00000000 nop c4: 8fc20010 lw $v0,16($s8) c8: 00000000 nop cc: 24430001 addiu $v1,$v0,1 d0: 08000006 j 18 d4: afc30010 sw $v1,16($s8) d8: 08000038 j e0 dc: 00001021 move $v0,$zero e0: 03c0e821 move $sp,$s8 e4: 8fbf001c lw $ra,28($sp) e8: 8fbe0018 lw $s8,24($sp) ec: 03e00008 jr $ra f0: 27bd0020 addiu $sp,$sp,32 If you look through this code, there are no more pseudo-instructions (how could there be, this is machine code). I then did MIPSobjdump --reloc test.o, which produced the following relocation table: test.o: file format ecoff-littlemips RELOCATION RECORDS FOR [.text]: OFFSET TYPE VALUE 0000000c JMPADDR __main 00000018 GPREL .sdata+0x00004000 0000001c JMPADDR strlen 00000038 JMPADDR .text 00000040 REFHI _iob 00000044 REFLO _iob 00000054 REFHI _iob 00000058 REFLO _iob 00000064 REFHI _iob 00000068 REFLO _iob 00000070 GPREL .sdata+0x00004000 00000090 JMPADDR .text 00000098 GPREL .sdata+0x00004000 000000b4 REFHI _iob 000000b8 REFLO _iob 000000bc JMPADDR _flsbuf 000000d0 JMPADDR .text 000000d8 JMPADDR .text You can see here that the object file also contains seperate information on which lui/lw pairs (and similar other pairs) need memory location. This data was put here as the compiler made the accompanying machine code. I then compiled the binary and ran MIPSobjdump -d again. 00400190
: 400190: 27bdffe0 addiu $sp,$sp,-32 400194: afbf001c sw $ra,28($sp) 400198: afbe0018 sw $s8,24($sp) 40019c: 0c1000e5 jal 400394 <__main> 4001a0: 03a0f021 move $s8,$sp 4001a4: afc00010 sw $zero,16($s8) 4001a8: 27848000 addiu $a0,$gp,-32768 4001ac: 0c10015c jal 400570 4001b0: 00000000 nop 4001b4: 8fc30010 lw $v1,16($s8) 4001b8: 00000000 nop 4001bc: 0062102b sltu $v0,$v1,$v0 4001c0: 14400003 bnez $v0,4001d0 4001c4: 00000000 nop 4001c8: 0810009a j 400268 4001cc: 00000000 nop 4001d0: 3c031000 lui $v1,0x1000 4001d4: 8c630074 lw $v1,116($v1) 4001d8: 00000000 nop 4001dc: 2462ffff addiu $v0,$v1,-1 4001e0: 00401821 move $v1,$v0 4001e4: 3c011000 lui $at,0x1000 4001e8: ac230074 sw $v1,116($at) 4001ec: 0460000e bltz $v1,400228 4001f0: 00000000 nop 4001f4: 3c021000 lui $v0,0x1000 4001f8: 24420078 addiu $v0,$v0,120 4001fc: 8c430000 lw $v1,0($v0) 400200: 27848000 addiu $a0,$gp,-32768 400204: 8fc50010 lw $a1,16($s8) 400208: 00000000 nop 40020c: 00852021 addu $a0,$a0,$a1 400210: 90850000 lbu $a1,0($a0) 400214: 00000000 nop 400218: a0650000 sb $a1,0($v1) 40021c: 24630001 addiu $v1,$v1,1 400220: 08100095 j 400254 400224: ac430000 sw $v1,0($v0) 400228: 27828000 addiu $v0,$gp,-32768 40022c: 8fc30010 lw $v1,16($s8) 400230: 00000000 nop 400234: 00431021 addu $v0,$v0,$v1 400238: 90430000 lbu $v1,0($v0) 40023c: 00000000 nop 400240: 00602021 move $a0,$v1 400244: 3c051000 lui $a1,0x1000 400248: 24a50074 addiu $a1,$a1,116 40024c: 0c1001a4 jal 400690 <_flsbuf> 400250: 00000000 nop 400254: 8fc20010 lw $v0,16($s8) 400258: 00000000 nop 40025c: 24430001 addiu $v1,$v0,1 400260: 0810006a j 4001a8 400264: afc30010 sw $v1,16($s8) 400268: 0810009c j 400270 40026c: 00001021 move $v0,$zero 400270: 03c0e821 move $sp,$s8 400274: 8fbf001c lw $ra,28($sp) 400278: 8fbe0018 lw $s8,24($sp) 40027c: 03e00008 jr $ra 400280: 27bd0020 addiu $sp,$sp,32 If you compare these you'll see that all the addresses have been fully resolved. It puts in stuff like or to show what it's connected to, but the values have actually been fully resolved. Here's some further proof, an empty relocation table. rhombus [11] MIPSobjdump --reloc test test: file format ecoff-littlemips If you look at the 17th instruction (for example) in the last two code listings (the object file and the binary), you'll see that it translated a memory load (an lui followed by an lw). So, everything is working like planned.