summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/cgo/doc.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-02-08 15:30:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-02-08 15:30:22 +0000
commit9adab5dd169afd191efd1dcbf50dae0f726a0a42 (patch)
tree55e1207fb22e51fd55c08d7f337c1822acf46f7b /libgo/go/cmd/cgo/doc.go
parentb5ec4de777870e2d4ff2a5de604eafd1bf0e50df (diff)
downloadgcc-9adab5dd169afd191efd1dcbf50dae0f726a0a42.tar.gz
libgo: update to Go1.10rc2
Reviewed-on: https://go-review.googlesource.com/92736 From-SVN: r257493
Diffstat (limited to 'libgo/go/cmd/cgo/doc.go')
-rw-r--r--libgo/go/cmd/cgo/doc.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/libgo/go/cmd/cgo/doc.go b/libgo/go/cmd/cgo/doc.go
index 8e4cd88b37c..c16b63a313b 100644
--- a/libgo/go/cmd/cgo/doc.go
+++ b/libgo/go/cmd/cgo/doc.go
@@ -45,8 +45,8 @@ For example:
// #include <png.h>
import "C"
-Alternatively, CPPFLAGS and LDFLAGS may be obtained via the pkg-config
-tool using a '#cgo pkg-config:' directive followed by the package names.
+Alternatively, CPPFLAGS and LDFLAGS may be obtained via the pkg-config tool
+using a '#cgo pkg-config:' directive followed by the package names.
For example:
// #cgo pkg-config: png cairo
@@ -55,11 +55,21 @@ For example:
The default pkg-config tool may be changed by setting the PKG_CONFIG environment variable.
+For security reasons, only a limited set of flags are allowed, notably -D, -I, and -l.
+To allow additional flags, set CGO_CFLAGS_ALLOW to a regular expression
+matching the new flags. To disallow flags that would otherwise be allowed,
+set CGO_CFLAGS_DISALLOW to a regular expression matching arguments
+that must be disallowed. In both cases the regular expression must match
+a full argument: to allow -mfoo=bar, use CGO_CFLAGS_ALLOW='-mfoo.*',
+not just CGO_CFLAGS_ALLOW='-mfoo'. Similarly named variables control
+the allowed CPPFLAGS, CXXFLAGS, FFLAGS, and LDFLAGS.
+
When building, the CGO_CFLAGS, CGO_CPPFLAGS, CGO_CXXFLAGS, CGO_FFLAGS and
CGO_LDFLAGS environment variables are added to the flags derived from
these directives. Package-specific flags should be set using the
directives, not the environment variables, so that builds work in
-unmodified environments.
+unmodified environments. Flags obtained from environment variables
+are not subject to the security limitations described above.
All the cgo CPPFLAGS and CFLAGS directives in a package are concatenated and
used to compile C files in that package. All the CPPFLAGS and CXXFLAGS