LEFT | RIGHT |
1 // Inferno utils/5l/asm.c | 1 // Inferno utils/5l/asm.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5l/asm.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5l/asm.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 elfstr[ElfStrEmpty] = addstring(shstrtab, ""); | 499 elfstr[ElfStrEmpty] = addstring(shstrtab, ""); |
500 elfstr[ElfStrText] = addstring(shstrtab, ".text"); | 500 elfstr[ElfStrText] = addstring(shstrtab, ".text"); |
501 elfstr[ElfStrNoPtrData] = addstring(shstrtab, ".noptrdata"); | 501 elfstr[ElfStrNoPtrData] = addstring(shstrtab, ".noptrdata"); |
502 elfstr[ElfStrData] = addstring(shstrtab, ".data"); | 502 elfstr[ElfStrData] = addstring(shstrtab, ".data"); |
503 elfstr[ElfStrBss] = addstring(shstrtab, ".bss"); | 503 elfstr[ElfStrBss] = addstring(shstrtab, ".bss"); |
504 elfstr[ElfStrNoPtrBss] = addstring(shstrtab, ".noptrbss"); | 504 elfstr[ElfStrNoPtrBss] = addstring(shstrtab, ".noptrbss"); |
505 if(HEADTYPE == Hnetbsd) | 505 if(HEADTYPE == Hnetbsd) |
506 elfstr[ElfStrNoteNetbsdIdent] = addstring(shstrtab, ".note.netbs
d.ident"); | 506 elfstr[ElfStrNoteNetbsdIdent] = addstring(shstrtab, ".note.netbs
d.ident"); |
507 addstring(shstrtab, ".rodata"); | 507 addstring(shstrtab, ".rodata"); |
| 508 addstring(shstrtab, ".gcdata"); |
| 509 addstring(shstrtab, ".gcbss"); |
508 addstring(shstrtab, ".gosymtab"); | 510 addstring(shstrtab, ".gosymtab"); |
509 addstring(shstrtab, ".gopclntab"); | 511 addstring(shstrtab, ".gopclntab"); |
510 if(!debug['s']) { | 512 if(!debug['s']) { |
511 elfstr[ElfStrSymtab] = addstring(shstrtab, ".symtab"); | 513 elfstr[ElfStrSymtab] = addstring(shstrtab, ".symtab"); |
512 elfstr[ElfStrStrtab] = addstring(shstrtab, ".strtab"); | 514 elfstr[ElfStrStrtab] = addstring(shstrtab, ".strtab"); |
513 dwarfaddshstrings(shstrtab); | 515 dwarfaddshstrings(shstrtab); |
514 } | 516 } |
515 elfstr[ElfStrShstrtab] = addstring(shstrtab, ".shstrtab"); | 517 elfstr[ElfStrShstrtab] = addstring(shstrtab, ".shstrtab"); |
516 | 518 |
517 if(!debug['d']) { /* -d suppresses dynamic loader format */ | 519 if(!debug['d']) { /* -d suppresses dynamic loader format */ |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 int o; | 656 int o; |
655 | 657 |
656 if(debug['v']) | 658 if(debug['v']) |
657 Bprint(&bso, "%5.2f asmb\n", cputime()); | 659 Bprint(&bso, "%5.2f asmb\n", cputime()); |
658 Bflush(&bso); | 660 Bflush(&bso); |
659 | 661 |
660 sect = segtext.sect; | 662 sect = segtext.sect; |
661 cseek(sect->vaddr - segtext.vaddr + segtext.fileoff); | 663 cseek(sect->vaddr - segtext.vaddr + segtext.fileoff); |
662 codeblk(sect->vaddr, sect->len); | 664 codeblk(sect->vaddr, sect->len); |
663 | 665 |
664 » /* output read-only data in text segment (rodata, gosymtab and pclntab)
*/ | 666 » /* output read-only data in text segment (rodata, gosymtab, pclntab, ...
) */ |
665 for(sect = sect->next; sect != nil; sect = sect->next) { | 667 for(sect = sect->next; sect != nil; sect = sect->next) { |
666 cseek(sect->vaddr - segtext.vaddr + segtext.fileoff); | 668 cseek(sect->vaddr - segtext.vaddr + segtext.fileoff); |
667 datblk(sect->vaddr, sect->len); | 669 datblk(sect->vaddr, sect->len); |
668 } | 670 } |
669 | 671 |
670 if(debug['v']) | 672 if(debug['v']) |
671 Bprint(&bso, "%5.2f datblk\n", cputime()); | 673 Bprint(&bso, "%5.2f datblk\n", cputime()); |
672 Bflush(&bso); | 674 Bflush(&bso); |
673 | 675 |
674 cseek(segdata.fileoff); | 676 cseek(segdata.fileoff); |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 } else { | 2206 } else { |
2205 v = p->cond->pc - p->pc - 8; | 2207 v = p->cond->pc - p->pc - 8; |
2206 o1 = olr(v, REGPC, dr, p->scond&C_SCOND); | 2208 o1 = olr(v, REGPC, dr, p->scond&C_SCOND); |
2207 } | 2209 } |
2208 return o1; | 2210 return o1; |
2209 } | 2211 } |
2210 | 2212 |
2211 int | 2213 int |
2212 chipzero(Ieee *e) | 2214 chipzero(Ieee *e) |
2213 { | 2215 { |
2214 » // if this procedure returns 0, then 5l will use the "vmov (imm)" | 2216 » // We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions. |
2215 » // instruction which only exists on VFPv3. We use GOARM=7 to gate it. | |
2216 if(goarm < 7 || e->l != 0 || e->h != 0) | 2217 if(goarm < 7 || e->l != 0 || e->h != 0) |
2217 return -1; | 2218 return -1; |
2218 return 0; | 2219 return 0; |
2219 } | 2220 } |
2220 | 2221 |
2221 int | 2222 int |
2222 chipfloat(Ieee *e) | 2223 chipfloat(Ieee *e) |
2223 { | 2224 { |
2224 int n; | 2225 int n; |
2225 ulong h; | 2226 ulong h; |
2226 | 2227 |
2227 » // if this procedure returns non-negative number 5l will use the "vmov (
imm)" | 2228 » // We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions. |
2228 » // instruction which only exists on VFPv3. We use GOARM=7 to gate it. | |
2229 if(goarm < 7) | 2229 if(goarm < 7) |
2230 goto no; | 2230 goto no; |
2231 | 2231 |
2232 if(e->l != 0 || (e->h&0xffff) != 0) | 2232 if(e->l != 0 || (e->h&0xffff) != 0) |
2233 goto no; | 2233 goto no; |
2234 h = e->h & 0x7fc00000; | 2234 h = e->h & 0x7fc00000; |
2235 if(h != 0x40000000 && h != 0x3fc00000) | 2235 if(h != 0x40000000 && h != 0x3fc00000) |
2236 goto no; | 2236 goto no; |
2237 n = 0; | 2237 n = 0; |
2238 | 2238 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 case SCONST: | 2274 case SCONST: |
2275 case SRODATA: | 2275 case SRODATA: |
2276 case SDATA: | 2276 case SDATA: |
2277 case SELFROSECT: | 2277 case SELFROSECT: |
2278 case STYPE: | 2278 case STYPE: |
2279 case SSTRING: | 2279 case SSTRING: |
2280 case SGOSTRING: | 2280 case SGOSTRING: |
2281 case SNOPTRDATA: | 2281 case SNOPTRDATA: |
2282 case SSYMTAB: | 2282 case SSYMTAB: |
2283 case SPCLNTAB: | 2283 case SPCLNTAB: |
| 2284 case SGCDATA: |
| 2285 case SGCBSS: |
2284 if(!s->reachable) | 2286 if(!s->reachable) |
2285 continue; | 2287 continue; |
2286 put(s, s->name, 'D', s->value, s->size, s->versi
on, s->gotype); | 2288 put(s, s->name, 'D', s->value, s->size, s->versi
on, s->gotype); |
2287 continue; | 2289 continue; |
2288 | 2290 |
2289 case SBSS: | 2291 case SBSS: |
2290 case SNOPTRBSS: | 2292 case SNOPTRBSS: |
2291 if(!s->reachable) | 2293 if(!s->reachable) |
2292 continue; | 2294 continue; |
2293 if(s->np > 0) | 2295 if(s->np > 0) |
(...skipping 29 matching lines...) Expand all Loading... |
2323 if(a->type == D_AUTO) | 2325 if(a->type == D_AUTO) |
2324 put(nil, a->asym->name, 'a', -a->aoffset, 0, 0,
a->gotype); | 2326 put(nil, a->asym->name, 'a', -a->aoffset, 0, 0,
a->gotype); |
2325 else | 2327 else |
2326 if(a->type == D_PARAM) | 2328 if(a->type == D_PARAM) |
2327 put(nil, a->asym->name, 'p', a->aoffset, 0, 0, a
->gotype); | 2329 put(nil, a->asym->name, 'p', a->aoffset, 0, 0, a
->gotype); |
2328 } | 2330 } |
2329 if(debug['v'] || debug['n']) | 2331 if(debug['v'] || debug['n']) |
2330 Bprint(&bso, "symsize = %ud\n", symsize); | 2332 Bprint(&bso, "symsize = %ud\n", symsize); |
2331 Bflush(&bso); | 2333 Bflush(&bso); |
2332 } | 2334 } |
LEFT | RIGHT |