Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(562)

Side by Side Diff: src/cmd/5l/obj.c

Issue 186263: code review 186263: eliminate the package global name space assumption in o... (Closed)
Patch Set: code review 186263: eliminate the package global name space assumption in o... Created 15 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/5g/gsubr.c ('k') | src/cmd/6g/ggen.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Inferno utils/5l/obj.c 1 // Inferno utils/5l/obj.c
2 // http://code.google.com/p/inferno-os/source/browse/utils/5l/obj.c 2 // http://code.google.com/p/inferno-os/source/browse/utils/5l/obj.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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 dtype = 4; 252 dtype = 4;
253 nuxiinit(); 253 nuxiinit();
254 254
255 version = 0; 255 version = 0;
256 cbp = buf.cbuf; 256 cbp = buf.cbuf;
257 cbc = sizeof(buf.cbuf); 257 cbc = sizeof(buf.cbuf);
258 firstp = prg(); 258 firstp = prg();
259 lastp = firstp; 259 lastp = firstp;
260 260
261 while(*argv) 261 while(*argv)
262 » » objfile(*argv++); 262 » » objfile(*argv++, "main");
263 if(!debug['l']) 263 if(!debug['l'])
264 loadlib(); 264 loadlib();
265 265
266 // mark some functions that are only referenced after linker code editin g 266 // mark some functions that are only referenced after linker code editin g
267 // TODO(kaib): this doesn't work, the prog can't be found in runtime 267 // TODO(kaib): this doesn't work, the prog can't be found in runtime
268 for(i=0; i<nelem(linkername); i++) 268 for(i=0; i<nelem(linkername); i++)
269 mark(lookup(linkername[i], 0)); 269 mark(lookup(linkername[i], 0));
270 deadcode(); 270 deadcode();
271 271
272 firstp = firstp->link; 272 firstp = firstp->link;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 ldobj1(Biobuf *f, int64 len, char *pn) 438 ldobj1(Biobuf *f, int64 len, char *pn)
439 { 439 {
440 int32 ipc; 440 int32 ipc;
441 Prog *p, *t; 441 Prog *p, *t;
442 Sym *h[NSYM], *s, *di; 442 Sym *h[NSYM], *s, *di;
443 int v, o, r, skip; 443 int v, o, r, skip;
444 uint32 sig; 444 uint32 sig;
445 char *name; 445 char *name;
446 int ntext; 446 int ntext;
447 int32 eof; 447 int32 eof;
448 » char src[1024]; 448 » char src[1024], *x;
449 449
450 ntext = 0; 450 ntext = 0;
451 eof = Boffset(f) + len; 451 eof = Boffset(f) + len;
452 di = S; 452 di = S;
453 src[0] = 0; 453 src[0] = 0;
454 454
455 newloop: 455 newloop:
456 memset(h, 0, sizeof(h)); 456 memset(h, 0, sizeof(h));
457 version++; 457 version++;
458 histfrogp = 0; 458 histfrogp = 0;
(...skipping 22 matching lines...) Expand all
481 if(v == D_STATIC) 481 if(v == D_STATIC)
482 r = version; 482 r = version;
483 name = Brdline(f, '\0'); 483 name = Brdline(f, '\0');
484 if(name == nil) { 484 if(name == nil) {
485 if(Blinelen(f) > 0) { 485 if(Blinelen(f) > 0) {
486 fprint(2, "%s: name too long\n", pn); 486 fprint(2, "%s: name too long\n", pn);
487 errorexit(); 487 errorexit();
488 } 488 }
489 goto eof; 489 goto eof;
490 } 490 }
491 » » s = lookup(name, r); 491 » » x = expandpkg(name, pkg);
492 » » s = lookup(x, r);
493 » » if(x != name)
494 » » » free(x);
495 » » name = nil;
492 496
493 if(sig != 0){ 497 if(sig != 0){
494 if(s->sig != 0 && s->sig != sig) 498 if(s->sig != 0 && s->sig != sig)
495 diag("incompatible type signatures %lux(%s) and %lux(%s) for %s", s->sig, s->file, sig, pn, s->name); 499 diag("incompatible type signatures %lux(%s) and %lux(%s) for %s", s->sig, s->file, sig, pn, s->name);
496 s->sig = sig; 500 s->sig = sig;
497 s->file = pn; 501 s->file = pn;
498 } 502 }
499 503
500 if(debug['W']) 504 if(debug['W'])
501 print(" ANAME %s\n", s->name); 505 print(" ANAME %s\n", s->name);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 appendp(Prog *q) 1056 appendp(Prog *q)
1053 { 1057 {
1054 Prog *p; 1058 Prog *p;
1055 1059
1056 p = prg(); 1060 p = prg();
1057 p->link = q->link; 1061 p->link = q->link;
1058 q->link = p; 1062 q->link = p;
1059 p->line = q->line; 1063 p->line = q->line;
1060 return p; 1064 return p;
1061 } 1065 }
OLDNEW
« no previous file with comments | « src/cmd/5g/gsubr.c ('k') | src/cmd/6g/ggen.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b