Skip to content

Commit 62e51c5

Browse files
doc: add notes about cgo to go1.8.html
TBR=See https://golang.org/cl/33244 Updates #17929 Change-Id: I0215a7873977be81f2f84374f0b628abaf0e57c1 Reviewed-on: https://go-review.googlesource.com/33667 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 4822e76 commit 62e51c5

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

doc/go1.8.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,36 @@ <h3 id="compiler">Compiler Toolchain</h3>
244244

245245
<h3 id="cmd_cgo">Cgo</h3>
246246

247-
<p>TODO</p>
247+
<p> <!-- CL 29991 -->
248+
The environment variable <code>PKG_CONFIG</code> may now be used to
249+
set the program to run to handle <code>#cgo pkg-config</code>
250+
directives. The default is <code>pkg-config</code>, the program
251+
always used by earlier releases. This is intended to make it easier
252+
to cross-compile
253+
<a href="/cmd/cgo/">cgo</a> code.
254+
</p>
255+
256+
<p> <!-- CL 32354 -->
257+
The <a href="/cmd/cgo/">cgo</a> tool now supports a <code>-srcdir</code>
258+
option, which is used by the <a href="/cmd/go/">go</a> command.
259+
</p>
260+
261+
<p> <!-- CL 31768, 31811 -->
262+
If <a href="/cmd/cgo/">cgo</a> code calls <code>C.malloc</code>, and
263+
<code>malloc</code> returns <code>NULL</code>, the program will now
264+
crash with an out of memory error.
265+
<code>C.malloc</code> will never return <code>nil</code>.
266+
Unlike most C functions, <code>C.malloc</code> may not be used in a
267+
two-result form returning an errno value.
268+
</p>
269+
270+
<p> <!-- CL 33237 -->
271+
If <a href="/cmd/cgo/">cgo</a> is used to call a C function passing a
272+
pointer to a C union, and if the C union can contain any pointer
273+
values, and if <a href="/cmd/cgo/#hdr-Passing_pointers">cgo pointer
274+
checking</a> is enabled (as it is by default), the union value is now
275+
checked for Go pointers.
276+
</p>
248277

249278
<h3 id="gccgo">Gccgo</h3>
250279

doc/go1.8.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ go: can set secure/insecure GIT schemes using GIT_ALLOW_PROTOCOL env var (CL 301
1313

1414
API additions and behavior changes:
1515

16-
cmd/cgo: add #line directives to avoid printing bogus references to Go source files (CL 32613)
17-
cmd/cgo: add -srcdir option (CL 32354)
18-
cmd/cgo: don't ignore qualifiers, don't cast to void* (CL 33097)
19-
cmd/cgo: fix line info in _cgo_gotypes.go (CL 29713)
20-
cmd/cgo: throw if C.malloc returns nil (CL 31768)
21-
2216
cmd/compile, runtime, etc: get rid of constant FP registers (CL 28095)
2317
cmd/compile, runtime: add go:yeswritebarrierrec pragma (CL 30938)
2418
cmd/compile/internal/gc: add runtime/trace support (CL 25354)
@@ -50,7 +44,6 @@ cmd/go: make bug subcommand open the browser (CL 29210)
5044
cmd/go: make go test -i -o x.test actually write x.test (CL 31352)
5145
cmd/go: print more env variables in "go env" (CL 31330)
5246
cmd/go: referee another vendor vs symlink fight (CL 31665)
53-
cmd/go: use cgo -srcdir when using SWIG (CL 32485)
5447

5548
cmd/internal/obj, cmd/link: darwin dynlink support (CL 29393)
5649
cmd/internal/objfile: add ppc64/ppc64le disassembler support (CL 9682)

0 commit comments

Comments
 (0)