(Here, quoted strings are the official AMD names.)
The amd64 "movsxd" instruction, when invoked
with a 64-bit REX prefix, moves and sign extends
a 32-bit value from register or memory into a
64-bit register. 6.out.h spells this MOVLQSX.
6.out.h also includes MOVLQZX, the zero extending
version, which it implements as "movsxd" without
the REX prefix. Without the REX prefix it's only sign
extending 32 bits to 32 bits (i.e., not doing anything
to the bits) and then storing in a 32-bit register.
Any write to a 32-bit register zeros the top half of the
corresponding 64-bit register, giving the advertised effect.
This particular implementation of the functionality is
non-standard, because an ordinary 32-bit "mov" would
do the same thing.
Because it is non-standard, it is often mishandled or
not handled by binary translation tools like valgrind.
Switching to the standard "mov" makes the binaries
work better with those tools.
It's probably useful in 6c and 6g to have an explicit
instruction, though, so that the intent of the size
change is clear. Thus we leave the concept of MOVLQZX
and just implement it by the standard "mov" instead of
the non-standard 32-bit "movsxd".
Fixes#896.
R=ken2
CC=golang-dev
https://golang.org/cl/1733046
The Makefile and cgo now rewrite / to _ when creating the path.
The .so for gosqlite.googlecode.com/hg/sqlite is named
cgo_gosqlite.googlecode.com_hg_sqlite.so, and then 6l and 8l
both include a default rpath of $GOROOT/pkg/$GOOS_$GOARCH.
This should make it easier to move binaries from one system
to another.
Fixes#857.
R=iant, r
CC=golang-dev
https://golang.org/cl/1700048
This avoids a crash when using cgo where glibc's malloc thinks
that it can use some of the memory following the symbol table.
This fails because the symbol table is mapped read-only, which
affects the whole page.
R=rsc
CC=golang-dev
https://golang.org/cl/1616042
Due to page boundary rounding, the header would have
been loaded as part of the text segment already, but this
change placates the "paxctl" tool on so-called hardened
Linux distributions (as if normal distributions weren't already
hard enough to use).
R=r
CC=golang-dev
https://golang.org/cl/954041
This permits more flexibility with cgo and swig in cases where
the program is run on a machine other than the one on which it
is built. Rather than storing the absolute path to the shared
library in the DT_NEEDED entry, we can store just the name,
and let the dynamic linker find it using DT_RUNPATH or the
LD_LIBRARY_PATH environment variable.
R=rsc
CC=golang-dev
https://golang.org/cl/223068
eliminates spurious multiple initialization errors.
give more information in the multiple init errors that remain.
Fixes#87.
R=r
CC=golang-dev
https://golang.org/cl/194052
5g/6g/8g: add import statements to export metadata, mapping package path to package name.
recognize "" as the path of the package in export metadata.
use "" as the path of the package in object symbol names.
5c/6c/8c, 5a/6a/8a: rewrite leading . to "". so that ·Sin means Sin in this package.
5l/6l/8l: rewrite "" in symbol names as object files are read.
gotest: handle new symbol names.
gopack: handle new import lines in export metadata.
Collectively, these changes eliminate the assumption of a global
name space in the object file formats. Higher level pieces such as
reflect and the computation of type hashes still depend on the
assumption; we're not done yet.
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/186263
* switch to real dot (.) instead of center dot (·) everywhere in object files.
before it was half and half depending on where in the name it appeared.
* in 6c/6a/etc identifiers, · can still be used but turns into . immediately.
* in export metadata, replace package identifiers with quoted strings
(still package names, not paths).
R=ken2, r
CC=golang-dev
https://golang.org/cl/190076
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Fixes#115.
R=rsc, dsymonds1
https://golang.org/cl/157067
cgo/libmach remain unimplemented. However, compilers, runtime,
and packages are 100%. I still need to go through and implement
missing syscalls (at least make sure they're all listed), but
for all shipped functionality, this is done. Ship! ;)
R=rsc, VenkateshSrinivas
https://golang.org/cl/152142
because they are in package runtime.
another step to enforcing package boundaries.
R=r
DELTA=732 (114 added, 93 deleted, 525 changed)
OCL=35811
CL=35824
* in 6l, -K already meant check for stack underflow.
add -KK to mean double-check stack overflows
even in nosplit functions.
* comment out print locks; they deadlock too easily
but are still useful to put back for special occasions.
* let runcgo assembly switch to scheduler stack
without involving scheduler directly. because runcgo
gets called from matchmg, it is too hard to keep it
from being called on other stacks.
R=r
DELTA=94 (65 added, 18 deleted, 11 changed)
OCL=35591
CL=35604
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
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
* 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
* 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
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
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
hope this will work around Mac NFS bug
where writing to an 8.out that has crashed
recently sometimes wedges NFS.
R=r
DELTA=3 (3 added, 0 deleted, 0 changed)
OCL=32906
CL=32908
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
* use new Make.$GOARCH files in gobuild.
* rename 6ar to arch-generic gopack.
* place objects in $GOROOT/pkg/$GOOS_$GOARCH
(makes cross-compiling easier, and no one
ever types these paths by hand anyway).
R=r
DELTA=29 (6 added, 8 deleted, 15 changed)
OCL=29923
CL=29967
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
this allows gotest to find the locally built package when doing
make
gotest
without this option, one would have to say
make install
gotest
which kinda defeats the purpose
based on discussions with rsc.
R=ken,rsc
DELTA=12 (10 added, 1 deleted, 1 changed)
OCL=27606
CL=27606
store only the original import path string (+ .a)
if 6g resolves it to an archive file.
let 6l re-resolve the .a at link time.
this lets libraries build against an archive
in the current directory but get used
against an installed archive.
R=r
OCL=27244
CL=27244
160 - 75 was just barely not enough for deferproc + morestack.
added enum names and bumped to 256 - 128.
added explanation.
changed a few mal() (garbage-collected) to
malloc()/free() (manually collected).
R=ken
OCL=26981
CL=26981
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
move darwin-amd64 specific code into runtime/darwin/amd64/
repeat for linux.
move rt0 into runtime.a instead of keeping a separate .6 file.
6l seems to have no problem with that.
TBR=r
OCL=26680
CL=26680
is not right if the .6 is only for data and
the init function.
instead of that, pick up everything and
let the dead code/data eliminator throw
away the parts that weren't useful.
R=r
DELTA=25 (0 added, 22 deleted, 3 changed)
OCL=24446
CL=24446
throwing away dead code at end of file.
also fix an uninitialized memory error
found by valgrind.
R=r
DELTA=7 (5 added, 2 deleted, 0 changed)
OCL=23991
CL=23994
they end up in the symbol table with type==0
if they are in a library but not pulled in.
also add a few debugging prints.
R=r
DELTA=11 (5 added, 1 deleted, 5 changed)
OCL=23104
CL=23108
unless given -d flag.
the resulting binary doesn't *use* any dynamic libraries,
it just has a reference to the dynamic linker and an
empty list of needed symbols and libraries.
this is enough to make 6.out binaries that can be run
under dtrace / dtruss.
R=r
DELTA=39 (34 added, 0 deleted, 5 changed)
OCL=20476
CL=20482
in favor of using in-memory copy of symbol table.
$ ls -l pretty pretty.big
-rwxr-xr-x 1 rsc eng 439516 Nov 21 16:43 pretty
-rwxr-xr-x 1 rsc eng 580984 Nov 21 16:20 pretty.big
$
R=r
DELTA=446 (238 added, 178 deleted, 30 changed)
OCL=19851
CL=19884
* add gotype string to symbol table
* fill in gotype in 6l for known funcs/vars
* print gotype with nm -t
* load symbol and pc/ln tables into memory at magic address 0x99<<32.
* add sys.symdat() to retrieve raw bytes of symbol table
and pc/ln table.
most of this should be considered experimental
and subject to change.
R=r
DELTA=157 (128 added, 0 deleted, 29 changed)
OCL=19746
CL=19750
if an object in an archive tries to refer
to a file in its original source directory,
ignore it.
* 6ar:
fix bug if archive is empty.
* gobuild:
build archive in current directory.
* math:
use new gobuild Makefile.
* test/math.go:
rename to mathest.go, add // run line, make it run.
R=r
DELTA=494 (277 added, 203 deleted, 14 changed)
OCL=19090
CL=19171
* allow conversion between nil interface and any type.
* mark signatures as DUPOK so that multiple .6 can
contain sigt.*[]byte and only one gets used.
R=ken
OCL=18538
CL=18542
use libbio instead of maintaining own buffer
libbio:
always use vlong offsets; die if off_t is too small
R=r
DELTA=163 (23 added, 63 deleted, 77 changed)
OCL=17508
CL=17512
- .text begins at INITTEXT, not 0
and does not include HEADR
- .shstrtab, .gosymtab, .gopclntab have alignment 1
- .gosymtab, .gopclntab have type SHT_PROGBITS
R=r
DELTA=9 (0 added, 0 deleted, 9 changed)
OCL=15953
CL=15956
if stack is in low memory and frame size is huge, test could wrap around!
fix by omitting test altogether if we know frame is big.
R=gri
OCL=14782
CL=14782
This makes it easy to build with other flags
(like -ggdb) or other compilers (like cc64).
R=r
DELTA=45 (6 added, 22 deleted, 17 changed)
OCL=13790
CL=13793
these guys really really want long to be 32-bits,
so ,s/long/int32/ (and then manual fixup).
still passes all tests.
(i started out looking for just those longs that
needed to be int32 instead, and it was just too hard
to track them down one by one.)
the longs were rare enough that i don't think
it will cause integration problems.
R=ken
OCL=13787
CL=13789
handle archives with __.PKGDEF elements (although we can't create them yet)
introduce a pkg directory
search the pkg directory for packages during compilation
SVN=126574