diff options
| author | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 | 
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-10-03 10:37:12 -0700 | 
| commit | 1bb8f19f5e9016a9eb118b8aba2b5689b4505812 (patch) | |
| tree | 7b69b0974f4999bac76d11abed2071a2dc9e97aa /src/cmd/8l/obj.c | |
| parent | 6b7539d607f26a1b1cd3eda71fc123ad4d52a133 (diff) | |
| download | golang-1bb8f19f5e9016a9eb118b8aba2b5689b4505812.tar.gz | |
8c, 8l dynamic loading support.
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.
on snow leopard:
  - non-cgo binaries work; all tests pass.
  - cgo binaries work on amd64 but not 386.
R=r
DELTA=2031  (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304
Diffstat (limited to 'src/cmd/8l/obj.c')
| -rw-r--r-- | src/cmd/8l/obj.c | 21 | 
1 files changed, 19 insertions, 2 deletions
| diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c index 4b6532568..aa197be53 100644 --- a/src/cmd/8l/obj.c +++ b/src/cmd/8l/obj.c @@ -213,6 +213,11 @@ main(int argc, char *argv[])  			Bprint(&bso, "HEADR = 0x%ld\n", HEADR);  		break;  	case 6:	/* apple MACH */ +		/* +		 * OS X system constant - offset from %gs to our TLS. +		 * Explained in ../../libcgo/darwin_386.c. +		 */ +		tlsoffset = 0x468;  		machoinit();  		HEADR = MACHORESERVE;  		if(INITTEXT == -1) @@ -223,6 +228,13 @@ main(int argc, char *argv[])  			INITRND = 4096;  		break;  	case 7:	/* elf32 executable */ +		/* +		 * Linux ELF uses TLS offsets negative from %gs. +		 * Translate 0(GS) and 4(GS) into -8(GS) and -4(GS). +		 * Also known to ../../pkg/runtime/linux/386/sys.s +		 * and ../../libcgo/linux_386.c. +		 */ +		tlsoffset = -8;  		elfinit();  		HEADR = ELFRESERVE;  		if(INITTEXT == -1) @@ -373,6 +385,8 @@ main(int argc, char *argv[])  	patch();  	follow();  	doelf(); +	if(HEADTYPE == 6) +		domacho();  	dodata();  	dostkoff();  	if(debug['p']) @@ -592,11 +606,14 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])  		a->type = Bgetc(f);  	if(t & T_GOTYPE)  		a->gotype = h[Bgetc(f)]; + +	t = a->type; +	if(t == D_INDIR+D_GS) +		a->offset += tlsoffset; +  	s = a->sym;  	if(s == S)  		return; - -	t = a->type;  	if(t != D_AUTO && t != D_PARAM) {  		if(a->gotype)  			s->gotype = a->gotype; | 
