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

43 Commits

Author SHA1 Message Date
Russ Cox
c1fbe589a9 Make.pkg: use installed runtime.h for cgo
Fixes #1381.

R=r, r2
CC=golang-dev
https://golang.org/cl/3775050
2011-01-06 15:15:22 -05:00
Russ Cox
3832389036 fix cgo build
R=r
CC=golang-dev
https://golang.org/cl/3750041
2010-12-17 13:22:20 -08:00
Russ Cox
6c6d53052e cgo: handle references to symbols in shared libraries
Fixes #1334.

R=r
CC=golang-dev
https://golang.org/cl/3746041
2010-12-17 11:37:11 -08:00
Russ Cox
0cd3475386 misc/cgo/life: fix, add to build
#pragma dynexport is no longer needed for
this use of cgo, since the gcc and gc code are
now linked together into the same binary.
It may still be necessary later.

On the Mac, you cannot use the GOT to resolve
symbols that exist in the current binary, so 6l and 8l
translate the GOT-loading mov instructions into lea
instructions.

On ELF systems, we could use the GOT for those
symbols, but for consistency 6l and 8l apply the
same translation.

The translation is sketchy in the extreme
(depending on the relocation being in a mov
instruction) but it verifies that the instruction
is a mov before rewriting it to lea.

Also makes typedefs global across files.

Fixes #1335.
Fixes #1345.

R=iant, r
CC=golang-dev
https://golang.org/cl/3650042
2010-12-17 09:51:55 -08:00
Russ Cox
14d677ecba cgo: new cgo
Very few changes here: the subtle ones are in Make.pkg.

Note that incredibly (and importantly) there are
no changes necessary to the test programs in misc/cgo.

R=iant
CC=golang-dev
https://golang.org/cl/3504041
2010-12-08 13:56:51 -05:00
Ian Lance Taylor
1fab0cd12a Makefiles: Don't define _64BIT now that 6c does it by default.
R=rsc
CC=golang-dev
https://golang.org/cl/3207041
2010-11-18 12:34:47 -08:00
Wei Guangjing
035696c59a debug/pe, cgo: add windows support
R=rsc, mattn
CC=golang-dev
https://golang.org/cl/1976045
2010-11-01 17:52:26 -04:00
Russ Cox
f481afae53 Make.pkg: remove .so before installing new one
On Linux, overwriting an mmap'ed file causes
all the MAP_PRIVATE pages to get refreshed
with the new content, even ones that have been
modified by the process that did the mmap.

One specific instance of this is that after the
dynamic linker has relocated a page from a .so,
overwriting the .so will un-relocate it, making
the next use of one of the no-longer-relocated
addresses incorrect and probably crash the
program.

Linux must go out of its way to break programs
in this way: the pages have already been copied
on write, so they're not shared with the file system
cache, and it trashes them anyway.  The manual
says the behavior when the file gets overwritten
is "undefined".  Removing before copy avoids the
undefined behavior.

R=iant
CC=golang-dev, msolo
https://golang.org/cl/2333045
2010-10-01 16:02:18 -04:00
Joe Poirier
1d62becbd8 build: generate, clean .exe files on Windows
R=rsc, brainman, vcc
CC=golang-dev
https://golang.org/cl/2165044
2010-09-09 01:42:55 -04:00
Jukka-Pekka Kekkonen
1cec72cff1 build: work with GNU Make 3.82
Fix building on GNU Make 3.82 (caused by mixed implicit and normal
rules).

The issue was introduced in changeset 6110:ca0beac3b543.

R=rsc
CC=golang-dev
https://golang.org/cl/2100044
2010-09-07 15:14:14 -04:00
Russ Cox
9f24d3686f Make.pkg: never use quietgcc
R=iant
CC=golang-dev
https://golang.org/cl/2033041
2010-08-26 20:21:34 -04:00
Russ Cox
d3a2dcf5a8 build: fix cgo with -j2
a b: c expands to multiple rules,
which then run in parallel.

R=r, iant
CC=golang-dev
https://golang.org/cl/2007047
2010-08-26 18:47:34 -04:00
Russ Cox
423e410258 gotest: allow make test of cgo packages (without make install)
R=r
CC=golang-dev, stevvooe
https://golang.org/cl/1995051
2010-08-25 18:00:42 -04:00
Russ Cox
aafe474ec9 build: $GOBIN defaults to $GOROOT/bin
R=r
CC=golang-dev
https://golang.org/cl/1982049
2010-08-24 20:00:33 -04:00
Russ Cox
9867ced972 cgo: use new command line syntax: -- separates cgo flags from gcc flags
Fixes #922.

R=r
CC=golang-dev
https://golang.org/cl/1664051
2010-07-15 09:41:21 -07:00
Russ Cox
489494cac3 cgo: use slash-free relative paths for .so references
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
2010-06-30 23:31:27 -07:00
Ian Lance Taylor
b3901dc1d8 Add _cgo_export.[ch] targets so that make knows how they are
built.  Note that they are only built if a //export comment
appears, so other targets should only use them if there is
such a comment.

Fixes #723.

R=rsc
CC=golang-dev
https://golang.org/cl/1073041
2010-05-03 11:07:22 -07:00
Ian Lance Taylor
12e7ce95c6 Add //export to cgo.
The new //export comment marks a Go function as callable from
C.  The syntax is "//export NAME" where NAME is the name of
the function as seen from C.  If such a comment is seen, cgo
will generate two new files: _cgo_export.h and _cgo_export.c.
The _cgo_export.h file provides declarations which C code may
use to call Go functions.  The _cgo_export.c file contains
wrappers, and is to be compiled with gcc.

The changes to Make.pkg support using this from a Go Makefile,
though it could probably be more convenient.

R=rsc
CC=golang-dev
https://golang.org/cl/853042
2010-04-09 13:31:05 -07:00
Russ Cox
6962e2b754 make: use actual dependency for install
otherwise "make install" runs cp unconditionally

R=r
CC=golang-dev
https://golang.org/cl/802044
2010-03-30 10:44:51 -07:00
Rob Pike
14abacf108 Factor the Makefiles to make writing outside Makefiles easier.
R=rsc
CC=golang-dev
https://golang.org/cl/650042
2010-03-19 15:14:46 -07:00
Ian Lance Taylor
7c99dcbdf9 Install runtime.h and cgocall.h.
This permits cgo generated code to use these header files even
if the Go sources are not around.

R=rsc
CC=golang-dev
https://golang.org/cl/224045
2010-02-24 17:00:25 -08:00
Adam Langley
cbd3b2e8d5 Add 'bench' target to makefiles.
R=rsc, agl, r
CC=golang-dev
https://golang.org/cl/188043
2010-01-12 15:43:20 -08:00
Devon H. O'Dell
2eb9171dfb Fix missing explicit GOBIN in src/pkg/Makefile. Clean up creation of
QUOTED_GOBIN. Re-take of 181077; fixes copy-pasta that broke build.

Fixes #468

R=rsc
CC=golang-dev
https://golang.org/cl/183125
2010-01-06 07:47:56 -08:00
Russ Cox
32594bd43d rollback of https://golang.org/cl/181077
(broke build)

TBR=dho
https://golang.org/cl/181139
2010-01-05 16:54:27 -08:00
Devon H. O'Dell
e032ab9dc8 Fix missing explicit GOBIN in src/pkg/Makefile. Clean up creation of QUOTED_GOBIN
Fixes #468

R=rsc
CC=golang-dev
https://golang.org/cl/181077
2010-01-05 16:22:40 -08:00
Russ Cox
c276d87c6c cgo: interpret $CGOPKGDIR as absolute path if rooted
R=dho
CC=golang-dev
https://golang.org/cl/180099
2009-12-21 08:31:02 -08:00
Russ Cox
10e85dfee4 Make.pkg: fix cgo for TARG=a/b
R=dho, phf
CC=golang-dev
https://golang.org/cl/180082
2009-12-17 17:28:22 -08:00
Devon H. O'Dell
9277b02537 Allow cgo to accept multiple .go inputs for a package
Fixes #342.

R=rsc
CC=golang-dev
https://golang.org/cl/179062
2009-12-17 13:20:56 -08:00
Devon H. O'Dell
857d4cf1a9 Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/src
This change removes the necessity to have GOBIN in $PATH,
and also doesn't assume that the build is being run from
$GOROOT/src. This is a minimal set of necessary changes
to get Go to build happily from the FreeBSD ports
collection.

R=rsc
CC=golang-dev
https://golang.org/cl/171044
2009-12-11 15:14:09 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
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
2009-11-23 17:32:51 -08:00
Russ Cox
9bc6a404d5 cgo: allow .so in subdirectories
R=r
https://golang.org/cl/157103
2009-11-20 00:31:03 -08:00
William Josephson
72e7444ad4 Missing flags for FreeBSD shared link as used by cgo in default build.
R=rsc
https://golang.org/cl/157065
2009-11-18 09:18:51 -08:00
Russ Cox
c0e1ccf3ff Make.pkg: have "make coverage" invoke 6cov with correct binary
Fixes #239.

R=r
https://golang.org/cl/154176
2009-11-17 08:39:26 -08:00
Russ Cox
cc3524fb06 makefiles: use correct gcc order in case --as-needed is in use.
Suggested by eostapets.
Fixes #141.

R=r
https://golang.org/cl/155049
2009-11-15 12:57:28 -08:00
Devon H. O'Dell
553be8427e Build changes to support work on the BSDs.
This does still contain some FreeBSD-specific bits, but
it's a pain to do partial diffs.

R=rsc
https://golang.org/cl/152138
2009-11-14 15:29:09 -08:00
Russ Cox
384932589d work with GNU Make 3.80
Fixes #30.

R=r1, r
https://golang.org/cl/154061
2009-11-11 12:00:50 -08:00
Russ Cox
bf991bb7df Make.pkg: add DEPS= support
allow Makefiles using Make.pkg to specify a
list of directories that should be installed
before trying to build the package.
this is a stopgap for small package trees
maintained outside the standard tree.

R=r
http://go/go-review/1016012
2009-11-01 05:43:26 -08: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
e67a5084b8 cgo working on linux/386
R=r
DELTA=70  (47 added, 4 deleted, 19 changed)
OCL=35167
CL=35171
2009-09-30 13:47:15 -07:00
Russ Cox
cce01111a9 cgo: works on amd64.
integrated into Makefiles (see misc/cgo/gmp/Makefile).

R=r
DELTA=1110  (540 added, 525 deleted, 45 changed)
OCL=35153
CL=35158
2009-09-30 11:51:08 -07:00
Russ Cox
090efde407 makefile fixes; convert runtime to use new makefiles
R=r
DELTA=67  (17 added, 29 deleted, 21 changed)
OCL=33215
CL=33219
2009-08-13 14:41:10 -07:00
Russ Cox
ff5618e2e3 avoid unnecessary installs
R=r
DELTA=6  (4 added, 0 deleted, 2 changed)
OCL=33107
CL=33110
2009-08-12 14:40:29 -07:00
Russ Cox
eda49f331f new included Make.pkg for handwritten package makefiles.
gobuild is obsolete; don't build it (will delete eventually).

revised gotest for whole-package compilation.

R=r
DELTA=102  (68 added, 6 deleted, 28 changed)
OCL=33067
CL=33098
2009-08-12 13:18:46 -07:00