1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:11:22 -06:00
Commit Graph

134 Commits

Author SHA1 Message Date
Kai Backman
98fff8ffb2 dupok, gcc compile fix, sync and syscall asm fix
R=rsc
APPROVED=rsc
DELTA=27  (18 added, 0 deleted, 9 changed)
OCL=35503
CL=35505
2009-10-08 22:16:08 -07:00
Russ Cox
c2874976e4 factor portable object+library bits out of 5l/6l/8l into ld
R=r
DELTA=3214  (904 added, 2260 deleted, 50 changed)
OCL=35425
CL=35427
2009-10-07 00:11:59 -07:00
Russ Cox
133a158bd8 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
2009-10-03 10:37:12 -07:00
Russ Cox
2157025ef0 step toward darwin ffi: factor out macho code
R=r
DELTA=771  (374 added, 287 deleted, 110 changed)
OCL=35187
CL=35187
2009-09-30 17:33:39 -07:00
Russ Cox
0c71ead9e6 convert 8l to new ELF code.
mostly cut and paste from 6l.

R=r
DELTA=930  (525 added, 182 deleted, 223 changed)
OCL=34976
CL=34976
2009-09-24 12:53:35 -07:00
Russ Cox
fda0e78b23 fix line numbers, again.
if first function in file was dead code, it was being
discarded along with the file name information for that file.
leave the functions in the master function list longer:
let xfol take the dead code out of the code list,
and let span skip the unreachable functions during output.

before
	throw: sys·mapaccess1: key not in map

	panic PC=0x2e7b20
	throw+0x33 /Users/rsc/go/src/pkg/runtime/runtime.c:65
		throw(0x5834f, 0x0)
	sys·mapaccess1+0x73 /Users/rsc/go/src/pkg/runtime/hashmap.c:769
		sys·mapaccess1(0x2b9bd0, 0x0)
	gob·*Encoder·Encode+0x16b /Users/rsc/go/src/pkg/fmt/print.go:2926
		gob·*Encoder·Encode(0x2bb440, 0x0, 0x558b0, 0x0, 0x2e4be0, ...)
	main·walk+0x331 :1603
		main·walk(0x33a480, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300640, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300520, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300240, 0x0)
	main·walk+0x271 :1596
		main·walk(0x678f8, 0x0)
	main·main+0x22 :1610
		main·main()

after
	throw: sys·mapaccess1: key not in map

	panic PC=0x2e7b20
	throw+0x33 /Users/rsc/go/src/pkg/runtime/runtime.c:65
		throw(0x5834f, 0x0)
	sys·mapaccess1+0x73 /Users/rsc/go/src/pkg/runtime/hashmap.c:769
		sys·mapaccess1(0x2b9bd0, 0x0)
	gob·*Encoder·Encode+0x16b /Users/rsc/go/src/pkg/gob/encoder.go:319
		gob·*Encoder·Encode(0x2bb3c0, 0x0, 0x558b0, 0x0, 0x2e4be0, ...)
	main·walk+0x331 /Users/rsc/dir.go:121
		main·walk(0x2f6ab0, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301640, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301520, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301240, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x678f8, 0x0)
	main·main+0x22 /Users/rsc/dir.go:128
		main·main()
	mainstart+0xe /Users/rsc/go/src/pkg/runtime/amd64/asm.s:55
		mainstart()
	goexit /Users/rsc/go/src/pkg/runtime/proc.c:133
		goexit()

R=r
DELTA=46  (20 added, 25 deleted, 1 changed)
OCL=34094
CL=34103
2009-08-30 19:21:48 -07:00
Russ Cox
165a99038f ffi -> dynld.
move out of export data into its own section

R=r
DELTA=222  (71 added, 99 deleted, 52 changed)
OCL=33801
CL=33808
2009-08-24 17:27:55 -07:00
Russ Cox
8c253bcae5 first attempt at real FFI support.
in a .6 file, an export line

	//ffi T localfib remotefib remote.so

means the dynamic linker should initialize
localfib, always a pointer, to the address of
remotefib, either text (T) or data (D) after
loading remote.so.

the C compiler will generate an export section
when given the pragmas

	#pragma package fib
	#pragma ffi T localfib remotefib remote.so

needing #pragma package is a bit of a kludge
and hopefully could go away later.

this is just the 6 tool chain support.
other architectures will happen once 6 settles down.

code using this to do FFI is in a later CL.

R=r
DELTA=161  (141 added, 14 deleted, 6 changed)
OCL=33783
CL=33795
2009-08-24 16:15:21 -07:00
Russ Cox
1f177cd8b2 linker work
* use //ffi comments in package import data
    to generate relocation entries and library loads.
  * call initffi in rt0.s if present

R=r
DELTA=117  (91 added, 3 deleted, 23 changed)
OCL=33739
CL=33750
2009-08-24 10:19:31 -07:00
Russ Cox
fd6cdbd807 linker work
* more elf constants from FreeBSD
  * simple relocation demo

R=r
DELTA=410  (354 added, 49 deleted, 7 changed)
OCL=33689
CL=33729
2009-08-23 18:03:14 -07:00
Russ Cox
0e25c1dc6d linker work
* remove now-unused D_SBIG (was for typestrings)
 * rename elf64.[ch] to elf.[ch]
 * pull in elf headers from FreeBSD instead of writing our own
 * emit non-header ELF data in data section
 * stub out a few more ELF sections needed for dynamic loading

R=r
DELTA=1928  (1237 added, 635 deleted, 56 changed)
OCL=33642
CL=33658
2009-08-21 13:08:11 -07:00
Russ Cox
7b29dbb866 symbol bugs.
do not emit unreachable data symbols.

R=austin
DELTA=103  (71 added, 4 deleted, 28 changed)
OCL=33325
CL=33622
2009-08-20 17:33:28 -07:00
Russ Cox
bd4161fcba FFI step 2: can ask for libc.so.6.
introduced explicit "data" symbol instead of etext
to mark beginning of data, so that using larger
alignment (i.e. 4MB like GNU loader) doesn't
confuse garbage collector.

split dodata into dodata and dobss in preparation
for putting the dynamic data + headers in the data
segment instead of stuffed at the beginning of the binary.

R=r
DELTA=52  (37 added, 3 deleted, 12 changed)
OCL=33610
CL=33618
2009-08-20 16:09:38 -07:00
Russ Cox
45ce825544 debugging symbols for 8g.
backtraces don't work,
but they didn't work when i started either.

R=ken
OCL=33230
CL=33230
2009-08-13 15:45:58 -07:00
Russ Cox
311c0b4807 6g/6l: add go type information to symbol table.
archive size +70%
  binary size +30%

old

wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x  1 rsc  eng  1487922 Aug 13 13:21 /Users/rsc/bin/godoc
-rwxr-xr-x  1 rsc  eng   995995 Aug 13 13:21 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg/
9.5M	/home/rsc/go/pkg/
wreck.mtv=;

new

wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x  1 rsc  eng  2014390 Aug 13 14:25 /Users/rsc/bin/godoc
-rwxr-xr-x  1 rsc  eng  1268705 Aug 13 14:25 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg
 16M	/home/rsc/go/pkg
wreck.mtv=;

R=ken
OCL=33217
CL=33220
2009-08-13 14:41:42 -07:00
Russ Cox
57a9bd0ee3 change gotype in symbol table from
character string to machine address.
not filled in, just carved out.

R=austin
DELTA=77  (11 added, 34 deleted, 32 changed)
OCL=33122
CL=33124
2009-08-12 16:14:53 -07:00
Rob Pike
3d42e691b9 make 6l produce dynamically linked binaries (although they are fully statically linked as far
as go is concerned).  the -d flag is now flipped; as on the mac, -d disables dynamic.

much remains to be improved to move the output closer to the gcc format.

R=rsc
DELTA=366  (310 added, 30 deleted, 26 changed)
OCL=31929
CL=31951
2009-07-21 15:10:47 -07:00
Rob Pike
f687fb7e73 6l cleanup: last set of magic numbers for elf64 moved to ld/elf64*.
R=rsc
DELTA=68  (21 added, 28 deleted, 19 changed)
OCL=31857
CL=31864
2009-07-20 13:19:47 -07:00
Rob Pike
fe734d8630 clean up generation of exec header.
make endianness explicit when writing values.

R=rsc
DELTA=129  (37 added, 7 deleted, 85 changed)
OCL=31826
CL=31854
2009-07-20 10:08:48 -07:00
Rob Pike
94d89ede1c take care of a few more magic numbers
R=rsc
DELTA=51  (41 added, 0 deleted, 10 changed)
OCL=31815
CL=31818
2009-07-17 17:32:34 -07:00
Rob Pike
b63d40a53e count SHdrs and PHdrs and write them out as a unit
R=rsc
DELTA=181  (93 added, 63 deleted, 25 changed)
OCL=31802
CL=31812
2009-07-17 16:34:58 -07:00
Rob Pike
e86dcf1603 more elf64 support: phdrs, constants
R=rsc
DELTA=130  (68 added, 6 deleted, 56 changed)
OCL=31798
CL=31798
2009-07-17 15:09:17 -07:00
Rob Pike
1593b1fc23 First steps towards cleaner support for ELF64 in 6l.
R=rsc
DELTA=337  (165 added, 119 deleted, 53 changed)
OCL=31786
CL=31794
2009-07-17 14:32:37 -07:00
Russ Cox
10e995fba8 dead code
R=r
DELTA=20  (0 added, 20 deleted, 0 changed)
OCL=31584
CL=31598
2009-07-14 09:28:42 -07:00
Russ Cox
7c534e1bd2 the ld-supplied typestrings are now obsolete
R=r
DELTA=167  (0 added, 167 deleted, 0 changed)
OCL=31304
CL=31316
2009-07-07 17:35:45 -07:00
Russ Cox
a1b64821f8 bug167
R=ken
OCL=31295
CL=31295
2009-07-07 11:48:22 -07:00
Russ Cox
9435dc2bdf allow forward declaration of struct in another file
(in the same package).

allow forward method declaration to be satisfied
by implementation in another file (in the same package).
all methods must be declared in the same file
as the receiver type.

R=ken
OCL=30864
CL=30869
2009-06-29 15:13:37 -07:00
Russ Cox
6609d2f88d restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.

R=r,gri
DELTA=123  (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
2009-06-05 10:59:55 -07:00
Russ Cox
f0e6a3caac dangling pointer bug (thanks valgrind)
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29881
CL=29885
2009-06-04 13:33:29 -07:00
Russ Cox
07393f8706 8l fixes, cut and paste from 6l.
move PtrSize value into 6l/8l files.

R=r
DELTA=78  (47 added, 15 deleted, 16 changed)
OCL=29729
CL=29798
2009-06-02 22:33:21 -07:00
Russ Cox
9cba9c8890 6l: eliminate dead code, not just the symbols
editing the firstp list was ineffective,
because follow rebuilds it from the textp list.

the symbols for dead code were being dropped
from the binary but the code was all still there.

text for fmt.Printf("hello, world\n") drops
from 143945 to 128650.

R=r,ken
DELTA=22  (20 added, 0 deleted, 2 changed)
OCL=28255
CL=28290
2009-05-05 12:43:00 -07:00
Ken Thompson
5963f59067 more morestack fiddling
R=r
OCL=28204
CL=28204
2009-05-03 19:09:14 -07:00
Russ Cox
8d8225d529 turn gc of unused data/code back on in loaders.
turned it off while debugging 8 runtime problem,
checked in the change accidentally.

R=r
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=27040
CL=27046
2009-04-02 17:56:23 -07:00
Russ Cox
b87e3e8b7f * move go-specific loader code
into gc directory, where it gets included as ../gc/ldbody
this is similar to the assemblers including ../cc/lexbody
and ../cc/macbody.

* hook go-specific loader code into 8l.

* make current 8.out.h and 6.out.h backward compatible
with plan 9's versions.  i had added some constants in
the middle of enums and have now moved them to the end.
this keeps us from invalidating old .8 and .6 files.
not sure how much it really matters, but easy to do.

R=r
DELTA=1314  (667 added, 623 deleted, 24 changed)
OCL=26938
CL=26941
2009-03-31 00:20:07 -07:00