LEFT | RIGHT |
(no file at all) | |
1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c | 1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c |
3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c | 3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c |
4 // | 4 // |
5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
7 // Portions Copyright © 1997-1999 Vita Nuova Limited | 7 // Portions Copyright © 1997-1999 Vita Nuova Limited |
8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
9 // Portions Copyright © 2004,2006 Bruce Ellis | 9 // Portions Copyright © 2004,2006 Bruce Ellis |
10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if(cout < 0) { | 97 if(cout < 0) { |
98 diag("cannot create %s", outfile); | 98 diag("cannot create %s", outfile); |
99 errorexit(); | 99 errorexit(); |
100 } | 100 } |
101 | 101 |
102 if(INITENTRY == nil) { | 102 if(INITENTRY == nil) { |
103 INITENTRY = mal(strlen(goarch)+strlen(goos)+10); | 103 INITENTRY = mal(strlen(goarch)+strlen(goos)+10); |
104 sprint(INITENTRY, "_rt0_%s_%s", goarch, goos); | 104 sprint(INITENTRY, "_rt0_%s_%s", goarch, goos); |
105 } | 105 } |
106 lookup(INITENTRY, 0)->type = SXREF; | 106 lookup(INITENTRY, 0)->type = SXREF; |
| 107 if(flag_shared) { |
| 108 if(LIBINITENTRY == nil) { |
| 109 LIBINITENTRY = mal(strlen(goarch)+strlen(goos)+20); |
| 110 sprint(LIBINITENTRY, "_rt0_%s_%s_lib", goarch, goos); |
| 111 } |
| 112 lookup(LIBINITENTRY, 0)->type = SXREF; |
| 113 } |
107 } | 114 } |
108 | 115 |
109 void | 116 void |
110 errorexit(void) | 117 errorexit(void) |
111 { | 118 { |
112 if(nerrors) { | 119 if(nerrors) { |
113 if(cout >= 0) | 120 if(cout >= 0) |
114 remove(outfile); | 121 remove(outfile); |
115 exits("error"); | 122 exits("error"); |
116 } | 123 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 ········ | 305 ········ |
299 // We've loaded all the code now. | 306 // We've loaded all the code now. |
300 // If there are no dynamic libraries needed, gcc disables dynamic linkin
g. | 307 // If there are no dynamic libraries needed, gcc disables dynamic linkin
g. |
301 // Because of this, glibc's dynamic ELF loader occasionally (like in ver
sion 2.13) | 308 // Because of this, glibc's dynamic ELF loader occasionally (like in ver
sion 2.13) |
302 // assumes that a dynamic binary always refers to at least one dynamic l
ibrary. | 309 // assumes that a dynamic binary always refers to at least one dynamic l
ibrary. |
303 // Rather than be a source of test cases for glibc, disable dynamic link
ing | 310 // Rather than be a source of test cases for glibc, disable dynamic link
ing |
304 // the same way that gcc would. | 311 // the same way that gcc would. |
305 // | 312 // |
306 // Exception: on OS X, programs such as Shark only work with dynamic | 313 // Exception: on OS X, programs such as Shark only work with dynamic |
307 // binaries, so leave it enabled on OS X (Mach-O) binaries. | 314 // binaries, so leave it enabled on OS X (Mach-O) binaries. |
308 » if(!havedynamic && HEADTYPE != Hdarwin) | 315 » if(!flag_shared && !havedynamic && HEADTYPE != Hdarwin) |
309 debug['d'] = 1; | 316 debug['d'] = 1; |
310 ········ | 317 ········ |
311 importcycles(); | 318 importcycles(); |
312 sortdynexp(); | 319 sortdynexp(); |
313 } | 320 } |
314 | 321 |
315 /* | 322 /* |
316 * look for the next file in an archive. | 323 * look for the next file in an archive. |
317 * adapted from libmach. | 324 * adapted from libmach. |
318 */ | 325 */ |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 if(a->type == D_AUTO) | 1611 if(a->type == D_AUTO) |
1605 put(nil, a->asym->name, 'a', -a->aoffset, 0, 0,
a->gotype); | 1612 put(nil, a->asym->name, 'a', -a->aoffset, 0, 0,
a->gotype); |
1606 else | 1613 else |
1607 if(a->type == D_PARAM) | 1614 if(a->type == D_PARAM) |
1608 put(nil, a->asym->name, 'p', a->aoffset, 0, 0, a
->gotype); | 1615 put(nil, a->asym->name, 'p', a->aoffset, 0, 0, a
->gotype); |
1609 } | 1616 } |
1610 if(debug['v'] || debug['n']) | 1617 if(debug['v'] || debug['n']) |
1611 Bprint(&bso, "symsize = %ud\n", symsize); | 1618 Bprint(&bso, "symsize = %ud\n", symsize); |
1612 Bflush(&bso); | 1619 Bflush(&bso); |
1613 } | 1620 } |
LEFT | RIGHT |