[dev.regabi] merge master 4481ad6eb6 into dev.regabi

Change-Id: Ia2c251d3809a538c16d05e5dcef59932049b3913
This commit is contained in:
Russ Cox 2020-11-25 16:48:25 -05:00
commit 40f5bc4d55
21 changed files with 736 additions and 260 deletions

View file

@ -33,7 +33,7 @@ Do not send CLs removing the interior tags from such phrases.
<h3 id="darwin">Darwin</h3> <h3 id="darwin">Darwin</h3>
<p><!-- golang.org/issue/38485, golang.org/issue/41385, many CLs --> <p><!-- golang.org/issue/38485, golang.org/issue/41385, CL 266373, more CLs -->
Go 1.16 adds support of 64-bit ARM architecture on macOS (also known as Go 1.16 adds support of 64-bit ARM architecture on macOS (also known as
Apple Silicon) with <code>GOOS=darwin</code>, <code>GOARCH=arm64</code>. Apple Silicon) with <code>GOOS=darwin</code>, <code>GOARCH=arm64</code>.
Like the <code>darwin/amd64</code> port, the <code>darwin/arm64</code> Like the <code>darwin/amd64</code> port, the <code>darwin/arm64</code>
@ -42,7 +42,7 @@ Do not send CLs removing the interior tags from such phrases.
detector. detector.
</p> </p>
<p> <p><!-- CL 254740 -->
The iOS port, which was previously <code>darwin/arm64</code>, is now The iOS port, which was previously <code>darwin/arm64</code>, is now
moved to <code>ios/arm64</code>. <code>GOOS=ios</code> implies the moved to <code>ios/arm64</code>. <code>GOOS=ios</code> implies the
<code>darwin</code> build tag, just as <code>GOOS=android</code> <code>darwin</code> build tag, just as <code>GOOS=android</code>
@ -80,6 +80,15 @@ Do not send CLs removing the interior tags from such phrases.
<h3 id="go-command">Go command</h3> <h3 id="go-command">Go command</h3>
<p>
TODO
<!-- CL 237697: https://golang.org/cl/237697: cmd/go: error when -c or -i are used with unknown flags -->
<!-- CL 255052: https://golang.org/cl/255052: cmd/go: default to GO111MODULE=on -->
<!-- CL 266420: https://golang.org/cl/266420: yes (mention go help vcs): cmd/go: add GOVCS setting to control version control usage -->
<!-- CL 244773: https://golang.org/cl/244773: cmd/go/internal/modload: drop requirements on excluded versions -->
</p>
<h4 id="modules">Modules</h4> <h4 id="modules">Modules</h4>
<p><!-- golang.org/issue/40728 --> <p><!-- golang.org/issue/40728 -->
@ -207,7 +216,7 @@ Do not send CLs removing the interior tags from such phrases.
<h3 id="cgo">Cgo</h3> <h3 id="cgo">Cgo</h3>
<p> <!-- CL 252378 --> <p><!-- CL 252378 -->
The <a href="/cmd/cgo">cgo</a> tool will no longer try to translate The <a href="/cmd/cgo">cgo</a> tool will no longer try to translate
C struct bitfields into Go struct fields, even if their size can be C struct bitfields into Go struct fields, even if their size can be
represented in Go. The order in which C bitfields appear in memory represented in Go. The order in which C bitfields appear in memory
@ -215,8 +224,12 @@ Do not send CLs removing the interior tags from such phrases.
results that were silently incorrect. results that were silently incorrect.
</p> </p>
<h3 id="vet">Vet</h3>
<p> <p>
TODO TODO
<!-- CL 235677: https://golang.org/cl/235677: cmd/vet: bring in pass to catch invalid uses of testing.T in goroutines -->
</p> </p>
<h2 id="runtime">Runtime</h2> <h2 id="runtime">Runtime</h2>
@ -245,7 +258,7 @@ Do not send CLs removing the interior tags from such phrases.
<h2 id="linker">Linker</h2> <h2 id="linker">Linker</h2>
<p> <p><!-- CL 248197 -->
This release includes additional improvements to the Go linker, This release includes additional improvements to the Go linker,
reducing linker resource usage (both time and memory) and improving reducing linker resource usage (both time and memory) and improving
code robustness/maintainability. These changes form the second half code robustness/maintainability. These changes form the second half
@ -268,7 +281,7 @@ Do not send CLs removing the interior tags from such phrases.
TODO: update with final numbers later in the release. TODO: update with final numbers later in the release.
</p> </p>
<p> <!-- CL 255259 --> <p><!-- CL 255259 -->
On Windows, <code>go build -buildmode=c-shared</code> now generates Windows On Windows, <code>go build -buildmode=c-shared</code> now generates Windows
ASLR DLLs by default. ASLR can be disabled with <code>--ldflags=-aslr=false</code>. ASLR DLLs by default. ASLR can be disabled with <code>--ldflags=-aslr=false</code>.
</p> </p>
@ -276,135 +289,13 @@ Do not send CLs removing the interior tags from such phrases.
<h2 id="library">Core library</h2> <h2 id="library">Core library</h2>
<p> <p>
TODO TODO: mention significant additions like new packages (<code>io/fs</code>),
new proposal-scoped features (<code>//go:embed</code>), and so on
</p> </p>
<h3 id="crypto/hmac"><a href="/pkg/crypto/hmac">crypto/hmac</a></h3> <p>
TODO: when the "Minor changes to the library" section is close to completion,
<p><!-- CL 261960 --> decide if any changes are worth factoring out and highlighting in "Core library"
<a href="/pkg/crypto/hmac/#New">New</a> will now panic if separate calls to
the hash generation function fail to return new values. Previously, the
behavior was undefined and invalid outputs were sometimes generated.
</p>
<h3 id="crypto/tls"><a href="/pkg/crypto/tls">crypto/tls</a></h3>
<p><!-- CL 256897 -->
I/O operations on closing or closed TLS connections can now be detected using
the new <a href="/pkg/net/#ErrClosed">ErrClosed</a> error. A typical use
would be <code>errors.Is(err, net.ErrClosed)</code>. In earlier releases
the only way to reliably detect this case was to match the string returned
by the <code>Error</code> method with <code>"tls: use of closed connection"</code>.
</p>
<p><!-- CL 266037 -->
A default deadline is set in <a href="/pkg/crypto/tls/#Conn.Close">Close</a>
before sending the close notify alert, in order to prevent blocking
indefinitely.
</p>
<p><!-- CL 246338 -->
<a href="/pkg/crypto/tls#Conn.HandshakeContext">(*Conn).HandshakeContext</a> was added to
allow the user to control cancellation of an in-progress TLS Handshake.
The context provided is propagated into the
<a href="/pkg/crypto/tls#ClientHelloInfo">ClientHelloInfo</a>
and <a href="/pkg/crypto/tls#CertificateRequestInfo">CertificateRequestInfo</a>
structs and accessible through the new
<a href="/pkg/crypto/tls#ClientHelloInfo.Context">(*ClientHelloInfo).Context</a>
and
<a href="/pkg/crypto/tls#CertificateRequestInfo.Context">
(*CertificateRequestInfo).Context
</a> methods respectively. Canceling the context after the handshake has finished
has no effect.
</p>
<p><!-- CL 239748 -->
Clients now ensure that the server selects
<a href="/pkg/crypto/tls/#ConnectionState.NegotiatedProtocol">
an ALPN protocol</a> from
<a href="/pkg/crypto/tls/#Config.NextProtos">
the list advertised by the client</a>.
</p>
<p><!-- CL 262857 -->
TLS servers will now prefer other AEAD cipher suites (such as ChaCha20Poly1305)
over AES-GCM cipher suites if either the client or server doesn't have AES hardware
support, unless the application set both
<a href="/pkg/crypto/tls/#Config.PreferServerCipherSuites"><code>Config.PreferServerCipherSuites</code></a>
and <a href="/pkg/crypto/tls/#Config.CipherSuites"><code>Config.CipherSuites</code></a>
or there are no other AEAD cipher suites supported.
The client is assumed not to have AES hardware support if it does not signal a
preference for AES-GCM cipher suites.
</p>
<h3 id="crypto/x509"><a href="/pkg/crypto/x509">crypto/x509</a></h3>
<p><!-- CL 235078 -->
<a href="/pkg/crypto/x509/#ParseCertificate">ParseCertificate</a> and
<a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> both
now enforce string encoding restrictions for the fields <code>DNSNames</code>,
<code>EmailAddresses</code>, and <code>URIs</code>. These fields can only
contain strings with characters within the ASCII range.
</p>
<p><!-- CL 259697 -->
<a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> now
verifies the generated certificate's signature using the signer's
public key. If the signature is invalid, an error is returned, instead
of a malformed certificate.
</p>
<p><!-- CL 233163 -->
A number of additional fields have been added to the
<a href="/pkg/crypto/x509/#CertificateRequest">CertificateRequest</a> type.
These fields are now parsed in <a href="/pkg/crypto/x509/#ParseCertificateRequest">ParseCertificateRequest</a>
and marshalled in <a href="/pkg/crypto/x509/#CreateCertificateRequest">CreateCertificateRequest</a>.
</p>
<h3 id="encoding/json"><a href="/pkg/encoding/json">encoding/json</a></h3>
<p><!-- CL 263619 -->
The error message for
<a href="/pkg/encoding/json/#SyntaxError">SyntaxError</a>
now begins with "json: ", matching the other errors in the package.
</p>
<h3 id="net"><a href="/pkg/net/">net</a></h3>
<p><!-- CL 250357 -->
The case of I/O on a closed network connection, or I/O on a network
connection that is closed before any of the I/O completes, can now
be detected using the new <a href="/pkg/net/#ErrClosed">ErrClosed</a> error.
A typical use would be <code>errors.Is(err, net.ErrClosed)</code>.
In earlier releases the only way to reliably detect this case was to
match the string returned by the <code>Error</code> method
with <code>"use of closed network connection"</code>.
</p>
<p><!-- CL 255898 -->
In previous Go releases the default TCP listener backlog size on Linux systems,
set by <code>/proc/sys/net/core/somaxconn</code>, was limited to a maximum of <code>65535</code>.
On Linux kernel version 4.1 and above, the maximum is now <code>4294967295</code>.
</p>
<h3 id="text/template/parse"><a href="/pkg/text/template/parse/">text/template/parse</a></h3>
<p><!-- CL 229398, golang.org/issue/34652 -->
A new <a href="/pkg/text/template/parse/#CommentNode"><code>CommentNode</code></a>
was added to the parse tree. The <a href="/pkg/text/template/parse/#Mode"><code>Mode</code></a>
field in the <code>parse.Tree</code> enables access to it.
</p>
<!-- text/template/parse -->
<h3 id="unicode"><a href="/pkg/unicode/">unicode</a></h3>
<p><!-- CL 248765 -->
The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
support throughout the system has been upgraded from Unicode 12.0.0 to
<a href="https://www.unicode.org/versions/Unicode13.0.0/">Unicode 13.0.0</a>,
which adds 5,930 new characters, including four new scripts, and 55 new emoji.
Unicode 13.0.0 also designates plane 3 (U+30000-U+3FFFF) as the tertiary
ideographic plane.
</p> </p>
<h3 id="minor_library_changes">Minor changes to the library</h3> <h3 id="minor_library_changes">Minor changes to the library</h3>
@ -416,7 +307,7 @@ Do not send CLs removing the interior tags from such phrases.
</p> </p>
<p> <p>
TODO TODO: complete this section, resolve TODOs below, add missing entries
</p> </p>
<dl id="crypto/dsa"><dt><a href="/pkg/crypto/dsa/">crypto/dsa</a></dt> <dl id="crypto/dsa"><dt><a href="/pkg/crypto/dsa/">crypto/dsa</a></dt>
@ -428,16 +319,126 @@ Do not send CLs removing the interior tags from such phrases.
</dd> </dd>
</dl><!-- crypto/dsa --> </dl><!-- crypto/dsa -->
<dl id="crypto/hmac"><dt><a href="/pkg/crypto/hmac/">crypto/hmac</a></dt>
<dd>
<p><!-- CL 261960 -->
<a href="/pkg/crypto/hmac/#New">New</a> will now panic if separate calls to
the hash generation function fail to return new values. Previously, the
behavior was undefined and invalid outputs were sometimes generated.
</p>
</dd>
</dl><!-- crypto/hmac -->
<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
<dd>
<p><!-- CL 256897 -->
I/O operations on closing or closed TLS connections can now be detected using
the new <a href="/pkg/net/#ErrClosed">ErrClosed</a> error. A typical use
would be <code>errors.Is(err, net.ErrClosed)</code>. In earlier releases
the only way to reliably detect this case was to match the string returned
by the <code>Error</code> method with <code>"tls: use of closed connection"</code>.
</p>
<p><!-- CL 266037 -->
A default deadline is set in <a href="/pkg/crypto/tls/#Conn.Close">Close</a>
before sending the close notify alert, in order to prevent blocking
indefinitely.
</p>
<p><!-- CL 246338 -->
<a href="/pkg/crypto/tls#Conn.HandshakeContext">(*Conn).HandshakeContext</a> was added to
allow the user to control cancellation of an in-progress TLS Handshake.
The context provided is propagated into the
<a href="/pkg/crypto/tls#ClientHelloInfo">ClientHelloInfo</a>
and <a href="/pkg/crypto/tls#CertificateRequestInfo">CertificateRequestInfo</a>
structs and accessible through the new
<a href="/pkg/crypto/tls#ClientHelloInfo.Context">(*ClientHelloInfo).Context</a>
and
<a href="/pkg/crypto/tls#CertificateRequestInfo.Context">
(*CertificateRequestInfo).Context
</a> methods respectively. Canceling the context after the handshake has finished
has no effect.
</p>
<p><!-- CL 239748 -->
Clients now ensure that the server selects
<a href="/pkg/crypto/tls/#ConnectionState.NegotiatedProtocol">
an ALPN protocol</a> from
<a href="/pkg/crypto/tls/#Config.NextProtos">
the list advertised by the client</a>.
</p>
<p><!-- CL 262857 -->
TLS servers will now prefer other AEAD cipher suites (such as ChaCha20Poly1305)
over AES-GCM cipher suites if either the client or server doesn't have AES hardware
support, unless the application set both
<a href="/pkg/crypto/tls/#Config.PreferServerCipherSuites"><code>Config.PreferServerCipherSuites</code></a>
and <a href="/pkg/crypto/tls/#Config.CipherSuites"><code>Config.CipherSuites</code></a>
or there are no other AEAD cipher suites supported.
The client is assumed not to have AES hardware support if it does not signal a
preference for AES-GCM cipher suites.
</p>
<p><!-- CL 246637 -->
TODO: <a href="https://golang.org/cl/246637">https://golang.org/cl/246637</a>: make config.Clone return nil if the source is nil
</p>
</dd>
</dl><!-- crypto/tls -->
<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt> <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
<dd> <dd>
<p><!-- CL 235078 -->
<a href="/pkg/crypto/x509/#ParseCertificate">ParseCertificate</a> and
<a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> both
now enforce string encoding restrictions for the fields <code>DNSNames</code>,
<code>EmailAddresses</code>, and <code>URIs</code>. These fields can only
contain strings with characters within the ASCII range.
</p>
<p><!-- CL 259697 -->
<a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> now
verifies the generated certificate's signature using the signer's
public key. If the signature is invalid, an error is returned, instead
of a malformed certificate.
</p>
<p><!-- CL 233163 -->
A number of additional fields have been added to the
<a href="/pkg/crypto/x509/#CertificateRequest">CertificateRequest</a> type.
These fields are now parsed in <a href="/pkg/crypto/x509/#ParseCertificateRequest">ParseCertificateRequest</a>
and marshalled in <a href="/pkg/crypto/x509/#CreateCertificateRequest">CreateCertificateRequest</a>.
</p>
<p><!-- CL 257939 --> <p><!-- CL 257939 -->
DSA signature verification is no longer supported. Note that DSA signature DSA signature verification is no longer supported. Note that DSA signature
generation was never supported. generation was never supported.
See <a href="https://golang.org/issue/40337">issue #40337</a>. See <a href="https://golang.org/issue/40337">issue #40337</a>.
</p> </p>
<p><!-- CL 257257 -->
TODO: <a href="https://golang.org/cl/257257">https://golang.org/cl/257257</a>: return additional chains from Verify on Windows
</p>
<p><!-- CL 262343 -->
TODO: <a href="https://golang.org/cl/262343">https://golang.org/cl/262343</a>: add Unwrap to SystemRootsError
</p>
</dd> </dd>
</dl><!-- crypto/x509 --> </dl><!-- crypto/x509 -->
<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
<dd>
<p><!-- CL 263619 -->
The error message for
<a href="/pkg/encoding/json/#SyntaxError">SyntaxError</a>
now begins with "json: ", matching the other errors in the package.
</p>
<p><!-- CL 234818 -->
TODO: <a href="https://golang.org/cl/234818">https://golang.org/cl/234818</a>: allow semicolon in field key / struct tag
</p>
</dd>
</dl><!-- encoding/json -->
<dl id="encoding/xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt> <dl id="encoding/xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt>
<dd> <dd>
<p><!-- CL 264024 --> <p><!-- CL 264024 -->
@ -452,6 +453,70 @@ Do not send CLs removing the interior tags from such phrases.
</dd> </dd>
</dl><!-- encoding/xml --> </dl><!-- encoding/xml -->
<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
<dd>
<p><!-- CL 240014 -->
TODO: <a href="https://golang.org/cl/240014">https://golang.org/cl/240014</a>: add Func
</p>
</dd>
</dl><!-- flag -->
<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
<dd>
<p><!-- CL 261577 -->
TODO: <a href="https://golang.org/cl/261577">https://golang.org/cl/261577</a>: add a new ReadSeekCloser interface
</p>
</dd>
</dl><!-- io -->
<dl id="log"><dt><a href="/pkg/log/">log</a></dt>
<dd>
<p><!-- CL 264460 -->
TODO: <a href="https://golang.org/cl/264460">https://golang.org/cl/264460</a>: expose std via new Default function
</p>
</dd>
</dl><!-- log -->
<dl id="log/syslog"><dt><a href="/pkg/log/syslog/">log/syslog</a></dt>
<dd>
<p><!-- CL 264297 -->
TODO: <a href="https://golang.org/cl/264297">https://golang.org/cl/264297</a>: set local to true if network is any of &#34;unix&#34;, or &#34;unixgram&#34;
</p>
</dd>
</dl><!-- log/syslog -->
<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
<dd>
<p><!-- CL 247477 -->
TODO: <a href="https://golang.org/cl/247477">https://golang.org/cl/247477</a>: return overflow errors in Reader.ReadForm
</p>
</dd>
</dl><!-- mime/multipart -->
<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
<dd>
<p><!-- CL 250357 -->
The case of I/O on a closed network connection, or I/O on a network
connection that is closed before any of the I/O completes, can now
be detected using the new <a href="/pkg/net/#ErrClosed">ErrClosed</a> error.
A typical use would be <code>errors.Is(err, net.ErrClosed)</code>.
In earlier releases the only way to reliably detect this case was to
match the string returned by the <code>Error</code> method
with <code>"use of closed network connection"</code>.
</p>
<p><!-- CL 255898 -->
In previous Go releases the default TCP listener backlog size on Linux systems,
set by <code>/proc/sys/net/core/somaxconn</code>, was limited to a maximum of <code>65535</code>.
On Linux kernel version 4.1 and above, the maximum is now <code>4294967295</code>.
</p>
<p><!-- CL 238629 -->
TODO: <a href="https://golang.org/cl/238629">https://golang.org/cl/238629</a>: prefer /etc/hosts over DNS when no /etc/nsswitch.conf is present
</p>
</dd>
</dl><!-- net -->
<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt> <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
<dd> <dd>
<p><!-- CL 233637 --> <p><!-- CL 233637 -->
@ -469,14 +534,14 @@ Do not send CLs removing the interior tags from such phrases.
</p> </p>
<p><!-- CL 252497 --> <p><!-- CL 252497 -->
The <a href="/pkg/net/http/"><code>net/http</code></a> package now rejects HTTP range requests The <a href="/pkg/net/http/"><code>net/http</code></a> package now rejects HTTP range requests
of the form <code>"Range": "bytes=--N"</code> where <code>"-N"</code> is a negative suffix length, for of the form <code>"Range": "bytes=--N"</code> where <code>"-N"</code> is a negative suffix length, for
example <code>"Range": "bytes=--2"</code>. It now replies with a <code>416 "Range Not Satisfiable"</code> response. example <code>"Range": "bytes=--2"</code>. It now replies with a <code>416 "Range Not Satisfiable"</code> response.
</p> </p>
<p><!-- CL 256498, golang.org/issue/36990 --> <p><!-- CL 256498, golang.org/issue/36990 -->
Cookies set with <code>SameSiteDefaultMode</code> now behave according to the current Cookies set with <code>SameSiteDefaultMode</code> now behave according to the current
spec (no attribute is set) instead of generating a SameSite key without a value. spec (no attribute is set) instead of generating a SameSite key without a value.
</p> </p>
<p><!-- CL 246338 --> <p><!-- CL 246338 -->
@ -485,9 +550,89 @@ Do not send CLs removing the interior tags from such phrases.
with the <a href="/pkg/net/http/#Request"><code>Request</code></a> context with the <a href="/pkg/net/http/#Request"><code>Request</code></a> context
when performing TLS handshakes in the client or server. when performing TLS handshakes in the client or server.
</p> </p>
<p><!-- CL 250039 -->
TODO: <a href="https://golang.org/cl/250039">https://golang.org/cl/250039</a>: set Content-Length:0 for empty PATCH requests as with POST, PATCH
</p>
<p><!-- CL 249440 -->
TODO: <a href="https://golang.org/cl/249440">https://golang.org/cl/249440</a>: match http scheme when selecting http_proxy
</p>
</dd> </dd>
</dl><!-- net/http --> </dl><!-- net/http -->
<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
<dd>
<p><!-- CL 260637 -->
TODO: <a href="https://golang.org/cl/260637">https://golang.org/cl/260637</a>: flush ReverseProxy immediately if Content-Length is -1
</p>
</dd>
</dl><!-- net/http/httputil -->
<dl id="net/smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
<dd>
<p><!-- CL 247257 -->
TODO: <a href="https://golang.org/cl/247257">https://golang.org/cl/247257</a>: adds support for the SMTPUTF8 extension
</p>
</dd>
</dl><!-- net/smtp -->
<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
<dd>
<p><!-- CL 242998 -->
TODO: <a href="https://golang.org/cl/242998">https://golang.org/cl/242998</a>: export errFinished as ErrProcessDone
</p>
</dd>
</dl><!-- os -->
<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
<dd>
<p><!-- CL 219640 -->
TODO: <a href="https://golang.org/cl/219640">https://golang.org/cl/219640</a>: add NotifyContext to cancel context using system signals
</p>
</dd>
</dl><!-- os/signal -->
<dl id="path"><dt><a href="/pkg/path/">path</a></dt>
<dd>
<p><!-- CL 264397 -->
TODO: <a href="https://golang.org/cl/264397">https://golang.org/cl/264397</a>: validate patterns in Match, Glob
</p>
</dd>
</dl><!-- path -->
<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
<dd>
<p><!-- CL 264397 -->
TODO: <a href="https://golang.org/cl/264397">https://golang.org/cl/264397</a>: validate patterns in Match, Glob
</p>
</dd>
</dl><!-- path/filepath -->
<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
<dd>
<p><!-- CL 248341 -->
TODO: <a href="https://golang.org/cl/248341">https://golang.org/cl/248341</a>: support multiple keys in struct tags
</p>
</dd>
</dl><!-- reflect -->
<dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
<dd>
<p><!-- CL 37222 -->
TODO: <a href="https://golang.org/cl/37222">https://golang.org/cl/37222</a>: make stack traces of endless recursion print only top and bottom 50
</p>
<p><!-- CL 242258 -->
TODO: <a href="https://golang.org/cl/242258">https://golang.org/cl/242258</a>: add 24 byte allocation size class
</p>
<p><!-- CL 254659 -->
TODO: <a href="https://golang.org/cl/254659">https://golang.org/cl/254659</a>: implement GODEBUG=inittrace=1 support
</p>
</dd>
</dl><!-- runtime -->
<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt> <dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
<dd> <dd>
<p><!-- CL 249677 --> <p><!-- CL 249677 -->
@ -496,18 +641,6 @@ Do not send CLs removing the interior tags from such phrases.
</dd> </dd>
</dl><!-- runtime/debug --> </dl><!-- runtime/debug -->
<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
<dd>
<p><!-- CL 261917 -->
<a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> on Windows has a new NoInheritHandles field that disables inheriting handles when creating a new process.
</p>
<p><!-- CL 269761, golang.org/issue/42584 -->
<a href="/pkg/syscall/#DLLError"><code>DLLError</code></a> on Windows now has an Unwrap function for unwrapping its underlying error.
</p>
</dd>
</dl><!-- syscall -->
<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt> <dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
<dd> <dd>
<p><!-- CL 260858 --> <p><!-- CL 260858 -->
@ -520,3 +653,60 @@ Do not send CLs removing the interior tags from such phrases.
</p> </p>
</dd> </dd>
</dl><!-- strconv --> </dl><!-- strconv -->
<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
<dd>
<p><!-- CL 261917 -->
<a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> on Windows has a new NoInheritHandles field that disables inheriting handles when creating a new process.
</p>
<p><!-- CL 269761, golang.org/issue/42584 -->
<a href="/pkg/syscall/#DLLError"><code>DLLError</code></a> on Windows now has an Unwrap function for unwrapping its underlying error.
</p>
<p><!-- CL 210639 -->
TODO: <a href="https://golang.org/cl/210639">https://golang.org/cl/210639</a>: support POSIX semantics for Linux syscalls
</p>
</dd>
</dl><!-- syscall -->
<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
<dd>
<p><!-- CL 254257 -->
TODO: <a href="https://golang.org/cl/254257">https://golang.org/cl/254257</a>: allow newlines inside action delimiters
</p>
</dd>
</dl><!-- text/template -->
<dl id="text/template/parse"><dt><a href="/pkg/text/template/parse/">text/template/parse</a></dt>
<dd>
<p><!-- CL 229398, golang.org/issue/34652 -->
A new <a href="/pkg/text/template/parse/#CommentNode"><code>CommentNode</code></a>
was added to the parse tree. The <a href="/pkg/text/template/parse/#Mode"><code>Mode</code></a>
field in the <code>parse.Tree</code> enables access to it.
</p>
</dd>
</dl><!-- text/template/parse -->
<dl id="time/tzdata"><dt><a href="/pkg/time/tzdata/">time/tzdata</a></dt>
<dd>
<p><!-- CL 261877 -->
The slim timezone data format is now used for the timezone database in
<code>$GOROOT/lib/time/zoneinfo.zip</code> and the embedded copy in this
package. This reduces the size of the timezone database by about 350 KB.
</p>
</dd>
</dl><!-- time/tzdata -->
<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
<dd>
<p><!-- CL 248765 -->
The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
support throughout the system has been upgraded from Unicode 12.0.0 to
<a href="https://www.unicode.org/versions/Unicode13.0.0/">Unicode 13.0.0</a>,
which adds 5,930 new characters, including four new scripts, and 55 new emoji.
Unicode 13.0.0 also designates plane 3 (U+30000-U+3FFFF) as the tertiary
ideographic plane.
</p>
</dd>
</dl><!-- unicode -->

View file

@ -250,6 +250,9 @@ func expandCalls(f *Func) {
if leafType != selector.Type && !selector.Type.IsEmptyInterface() { // empty interface for #42727 if leafType != selector.Type && !selector.Type.IsEmptyInterface() { // empty interface for #42727
f.Fatalf("Unexpected Load as selector, leaf=%s, selector=%s\n", leaf.LongString(), selector.LongString()) f.Fatalf("Unexpected Load as selector, leaf=%s, selector=%s\n", leaf.LongString(), selector.LongString())
} }
if selector.Type.IsEmptyInterface() {
selector.Type = typ.BytePtr
}
leaf.copyOf(selector) leaf.copyOf(selector)
for _, s := range namedSelects[selector] { for _, s := range namedSelects[selector] {
locs = append(locs, f.Names[s.locIndex]) locs = append(locs, f.Names[s.locIndex])

View file

@ -156,6 +156,9 @@ const (
// R_ARM64_LDST8 sets a LD/ST immediate value to bits [11:0] of a local address. // R_ARM64_LDST8 sets a LD/ST immediate value to bits [11:0] of a local address.
R_ARM64_LDST8 R_ARM64_LDST8
// R_ARM64_LDST16 sets a LD/ST immediate value to bits [11:1] of a local address.
R_ARM64_LDST16
// R_ARM64_LDST32 sets a LD/ST immediate value to bits [11:2] of a local address. // R_ARM64_LDST32 sets a LD/ST immediate value to bits [11:2] of a local address.
R_ARM64_LDST32 R_ARM64_LDST32

View file

@ -46,32 +46,33 @@ func _() {
_ = x[R_ARM64_GOT-36] _ = x[R_ARM64_GOT-36]
_ = x[R_ARM64_PCREL-37] _ = x[R_ARM64_PCREL-37]
_ = x[R_ARM64_LDST8-38] _ = x[R_ARM64_LDST8-38]
_ = x[R_ARM64_LDST32-39] _ = x[R_ARM64_LDST16-39]
_ = x[R_ARM64_LDST64-40] _ = x[R_ARM64_LDST32-40]
_ = x[R_ARM64_LDST128-41] _ = x[R_ARM64_LDST64-41]
_ = x[R_POWER_TLS_LE-42] _ = x[R_ARM64_LDST128-42]
_ = x[R_POWER_TLS_IE-43] _ = x[R_POWER_TLS_LE-43]
_ = x[R_POWER_TLS-44] _ = x[R_POWER_TLS_IE-44]
_ = x[R_ADDRPOWER_DS-45] _ = x[R_POWER_TLS-45]
_ = x[R_ADDRPOWER_GOT-46] _ = x[R_ADDRPOWER_DS-46]
_ = x[R_ADDRPOWER_PCREL-47] _ = x[R_ADDRPOWER_GOT-47]
_ = x[R_ADDRPOWER_TOCREL-48] _ = x[R_ADDRPOWER_PCREL-48]
_ = x[R_ADDRPOWER_TOCREL_DS-49] _ = x[R_ADDRPOWER_TOCREL-49]
_ = x[R_RISCV_PCREL_ITYPE-50] _ = x[R_ADDRPOWER_TOCREL_DS-50]
_ = x[R_RISCV_PCREL_STYPE-51] _ = x[R_RISCV_PCREL_ITYPE-51]
_ = x[R_RISCV_TLS_IE_ITYPE-52] _ = x[R_RISCV_PCREL_STYPE-52]
_ = x[R_RISCV_TLS_IE_STYPE-53] _ = x[R_RISCV_TLS_IE_ITYPE-53]
_ = x[R_PCRELDBL-54] _ = x[R_RISCV_TLS_IE_STYPE-54]
_ = x[R_ADDRMIPSU-55] _ = x[R_PCRELDBL-55]
_ = x[R_ADDRMIPSTLS-56] _ = x[R_ADDRMIPSU-56]
_ = x[R_ADDRCUOFF-57] _ = x[R_ADDRMIPSTLS-57]
_ = x[R_WASMIMPORT-58] _ = x[R_ADDRCUOFF-58]
_ = x[R_XCOFFREF-59] _ = x[R_WASMIMPORT-59]
_ = x[R_XCOFFREF-60]
} }
const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CALLRISCVR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF" const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CALLRISCVR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 133, 140, 147, 155, 163, 171, 177, 183, 189, 199, 208, 218, 234, 245, 256, 266, 275, 288, 302, 316, 330, 346, 357, 370, 383, 397, 411, 426, 440, 454, 465, 479, 494, 511, 529, 550, 569, 588, 608, 628, 638, 649, 662, 673, 685, 695} var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 133, 140, 147, 155, 163, 171, 177, 183, 189, 199, 208, 218, 234, 245, 256, 266, 275, 288, 302, 316, 330, 346, 357, 370, 383, 397, 411, 425, 440, 454, 468, 479, 493, 508, 525, 543, 564, 583, 602, 622, 642, 652, 663, 676, 687, 699, 709}
func (i RelocType) String() string { func (i RelocType) String() string {
i -= 1 i -= 1

View file

@ -40,7 +40,12 @@ const (
) )
func goarm() int { func goarm() int {
switch v := envOr("GOARM", defaultGOARM); v { def := defaultGOARM
if GOOS == "android" && GOARCH == "arm" {
// Android arm devices always support GOARM=7.
def = "7"
}
switch v := envOr("GOARM", def); v {
case "5": case "5":
return 5 return 5
case "6": case "6":

View file

@ -177,6 +177,14 @@ func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loade
su.SetRelocType(rIdx, objabi.R_ARM64_LDST8) su.SetRelocType(rIdx, objabi.R_ARM64_LDST8)
return true return true
case objabi.ElfRelocOffset + objabi.RelocType(elf.R_AARCH64_LDST16_ABS_LO12_NC):
if targType == sym.SDYNIMPORT {
ldr.Errorf(s, "unexpected relocation for dynamic symbol %s", ldr.SymName(targ))
}
su := ldr.MakeSymbolUpdater(s)
su.SetRelocType(rIdx, objabi.R_ARM64_LDST16)
return true
case objabi.ElfRelocOffset + objabi.RelocType(elf.R_AARCH64_LDST32_ABS_LO12_NC): case objabi.ElfRelocOffset + objabi.RelocType(elf.R_AARCH64_LDST32_ABS_LO12_NC):
if targType == sym.SDYNIMPORT { if targType == sym.SDYNIMPORT {
ldr.Errorf(s, "unexpected relocation for dynamic symbol %s", ldr.SymName(targ)) ldr.Errorf(s, "unexpected relocation for dynamic symbol %s", ldr.SymName(targ))
@ -769,6 +777,14 @@ func archreloc(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r loade
o0 := uint32(t&0xfff) << 10 o0 := uint32(t&0xfff) << 10
return val | int64(o0), noExtReloc, true return val | int64(o0), noExtReloc, true
case objabi.R_ARM64_LDST16:
t := ldr.SymAddr(rs) + r.Add() - ((ldr.SymValue(s) + int64(r.Off())) &^ 0xfff)
if t&1 != 0 {
ldr.Errorf(s, "invalid address: %x for relocation type: R_AARCH64_LDST16_ABS_LO12_NC", t)
}
o0 := (uint32(t&0xfff) >> 1) << 10
return val | int64(o0), noExtReloc, true
case objabi.R_ARM64_LDST32: case objabi.R_ARM64_LDST32:
t := ldr.SymAddr(rs) + r.Add() - ((ldr.SymValue(s) + int64(r.Off())) &^ 0xfff) t := ldr.SymAddr(rs) + r.Add() - ((ldr.SymValue(s) + int64(r.Off())) &^ 0xfff)
if t&3 != 0 { if t&3 != 0 {

View file

@ -1019,6 +1019,7 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, error) {
ARM64 | uint32(elf.R_AARCH64_ADR_PREL_PG_HI21)<<16, ARM64 | uint32(elf.R_AARCH64_ADR_PREL_PG_HI21)<<16,
ARM64 | uint32(elf.R_AARCH64_ADD_ABS_LO12_NC)<<16, ARM64 | uint32(elf.R_AARCH64_ADD_ABS_LO12_NC)<<16,
ARM64 | uint32(elf.R_AARCH64_LDST8_ABS_LO12_NC)<<16, ARM64 | uint32(elf.R_AARCH64_LDST8_ABS_LO12_NC)<<16,
ARM64 | uint32(elf.R_AARCH64_LDST16_ABS_LO12_NC)<<16,
ARM64 | uint32(elf.R_AARCH64_LDST32_ABS_LO12_NC)<<16, ARM64 | uint32(elf.R_AARCH64_LDST32_ABS_LO12_NC)<<16,
ARM64 | uint32(elf.R_AARCH64_LDST64_ABS_LO12_NC)<<16, ARM64 | uint32(elf.R_AARCH64_LDST64_ABS_LO12_NC)<<16,
ARM64 | uint32(elf.R_AARCH64_LDST128_ABS_LO12_NC)<<16, ARM64 | uint32(elf.R_AARCH64_LDST128_ABS_LO12_NC)<<16,

View file

@ -371,16 +371,13 @@ func MakeUint64(x uint64) Value {
} }
// MakeFloat64 returns the Float value for x. // MakeFloat64 returns the Float value for x.
// If x is -0.0, the result is 0.0.
// If x is not finite, the result is an Unknown. // If x is not finite, the result is an Unknown.
func MakeFloat64(x float64) Value { func MakeFloat64(x float64) Value {
if math.IsInf(x, 0) || math.IsNaN(x) { if math.IsInf(x, 0) || math.IsNaN(x) {
return unknownVal{} return unknownVal{}
} }
// convert -0 to 0 return ratVal{newRat().SetFloat64(x + 0)} // convert -0 to 0
if x == 0 {
return int64Val(0)
}
return ratVal{newRat().SetFloat64(x)}
} }
// MakeFromLiteral returns the corresponding integer, floating-point, // MakeFromLiteral returns the corresponding integer, floating-point,
@ -595,11 +592,11 @@ func Make(x interface{}) Value {
case int64: case int64:
return int64Val(x) return int64Val(x)
case *big.Int: case *big.Int:
return intVal{x} return makeInt(x)
case *big.Rat: case *big.Rat:
return ratVal{x} return makeRat(x)
case *big.Float: case *big.Float:
return floatVal{x} return makeFloat(x)
default: default:
return unknownVal{} return unknownVal{}
} }

View file

@ -7,6 +7,7 @@ package constant
import ( import (
"fmt" "fmt"
"go/token" "go/token"
"math"
"math/big" "math/big"
"strings" "strings"
"testing" "testing"
@ -620,18 +621,68 @@ func TestUnknown(t *testing.T) {
} }
} }
func TestMake(t *testing.T) { func TestMakeFloat64(t *testing.T) {
for _, want := range []interface{}{ var zero float64
false, for _, arg := range []float64{
"hello", -math.MaxFloat32,
int64(1), -10,
big.NewInt(10), -0.5,
big.NewFloat(2.0), -zero,
big.NewRat(1, 3), zero,
1,
10,
123456789.87654321e-23,
1e10,
math.MaxFloat64,
} { } {
got := Val(Make(want)) val := MakeFloat64(arg)
if got != want { if val.Kind() != Float {
t.Errorf("got %v; want %v", got, want) t.Errorf("%v: got kind = %d; want %d", arg, val.Kind(), Float)
}
// -0.0 is mapped to 0.0
got, exact := Float64Val(val)
if !exact || math.Float64bits(got) != math.Float64bits(arg+0) {
t.Errorf("%v: got %v (exact = %v)", arg, got, exact)
}
}
// infinity
for sign := range []int{-1, 1} {
arg := math.Inf(sign)
val := MakeFloat64(arg)
if val.Kind() != Unknown {
t.Errorf("%v: got kind = %d; want %d", arg, val.Kind(), Unknown)
}
}
}
type makeTestCase struct {
kind Kind
arg, want interface{}
}
func dup(k Kind, x interface{}) makeTestCase { return makeTestCase{k, x, x} }
func TestMake(t *testing.T) {
for _, test := range []makeTestCase{
{Bool, false, false},
{String, "hello", "hello"},
{Int, int64(1), int64(1)},
{Int, big.NewInt(10), int64(10)},
{Int, new(big.Int).Lsh(big.NewInt(1), 62), int64(1 << 62)},
dup(Int, new(big.Int).Lsh(big.NewInt(1), 63)),
{Float, big.NewFloat(0), floatVal0.val},
dup(Float, big.NewFloat(2.0)),
dup(Float, big.NewRat(1, 3)),
} {
val := Make(test.arg)
got := Val(val)
if val.Kind() != test.kind || got != test.want {
t.Errorf("got %v (%T, kind = %d); want %v (%T, kind = %d)",
got, got, val.Kind(), test.want, test.want, test.kind)
} }
} }
} }

View file

@ -66,7 +66,7 @@ Grouping:
Empty strings: Empty strings:
^ at beginning of text or line (flag m=true) ^ at beginning of text or line (flag m=true)
$ at end of text (like \z not Perl's \Z) or line (flag m=true) $ at end of text (like \z not \Z) or line (flag m=true)
\A at beginning of text \A at beginning of text
\b at ASCII word boundary (\w on one side and \W, \A, or \z on the other) \b at ASCII word boundary (\w on one side and \W, \A, or \z on the other)
\B not at ASCII word boundary \B not at ASCII word boundary
@ -127,5 +127,6 @@ ASCII character classes:
[[:word:]] word characters (== [0-9A-Za-z_]) [[:word:]] word characters (== [0-9A-Za-z_])
[[:xdigit:]] hex digit (== [0-9A-Fa-f]) [[:xdigit:]] hex digit (== [0-9A-Fa-f])
Unicode character classes are those in unicode.Categories and unicode.Scripts.
*/ */
package syntax package syntax

View file

@ -215,7 +215,7 @@ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool {
// Space is available in the channel buffer. Enqueue the element to send. // Space is available in the channel buffer. Enqueue the element to send.
qp := chanbuf(c, c.sendx) qp := chanbuf(c, c.sendx)
if raceenabled { if raceenabled {
racereleaseacquire(qp) racenotify(c, c.sendx, nil)
} }
typedmemmove(c.elemtype, qp, ep) typedmemmove(c.elemtype, qp, ep)
c.sendx++ c.sendx++
@ -297,9 +297,8 @@ func send(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) {
// Pretend we go through the buffer, even though // Pretend we go through the buffer, even though
// we copy directly. Note that we need to increment // we copy directly. Note that we need to increment
// the head/tail locations only when raceenabled. // the head/tail locations only when raceenabled.
qp := chanbuf(c, c.recvx) racenotify(c, c.recvx, nil)
racereleaseacquire(qp) racenotify(c, c.recvx, sg)
racereleaseacquireg(sg.g, qp)
c.recvx++ c.recvx++
if c.recvx == c.dataqsiz { if c.recvx == c.dataqsiz {
c.recvx = 0 c.recvx = 0
@ -532,7 +531,7 @@ func chanrecv(c *hchan, ep unsafe.Pointer, block bool) (selected, received bool)
// Receive directly from queue // Receive directly from queue
qp := chanbuf(c, c.recvx) qp := chanbuf(c, c.recvx)
if raceenabled { if raceenabled {
racereleaseacquire(qp) racenotify(c, c.recvx, nil)
} }
if ep != nil { if ep != nil {
typedmemmove(c.elemtype, ep, qp) typedmemmove(c.elemtype, ep, qp)
@ -621,8 +620,8 @@ func recv(c *hchan, sg *sudog, ep unsafe.Pointer, unlockf func(), skip int) {
// queue is full, those are both the same slot. // queue is full, those are both the same slot.
qp := chanbuf(c, c.recvx) qp := chanbuf(c, c.recvx)
if raceenabled { if raceenabled {
racereleaseacquire(qp) racenotify(c, c.recvx, nil)
racereleaseacquireg(sg.g, qp) racenotify(c, c.recvx, sg)
} }
// copy data from queue to receiver // copy data from queue to receiver
if ep != nil { if ep != nil {
@ -833,3 +832,38 @@ func racesync(c *hchan, sg *sudog) {
racereleaseg(sg.g, chanbuf(c, 0)) racereleaseg(sg.g, chanbuf(c, 0))
raceacquire(chanbuf(c, 0)) raceacquire(chanbuf(c, 0))
} }
// Notify the race detector of a send or receive involving buffer entry idx
// and a channel c or its communicating partner sg.
// This function handles the special case of c.elemsize==0.
func racenotify(c *hchan, idx uint, sg *sudog) {
// We could have passed the unsafe.Pointer corresponding to entry idx
// instead of idx itself. However, in a future version of this function,
// we can use idx to better handle the case of elemsize==0.
// A future improvement to the detector is to call TSan with c and idx:
// this way, Go will continue to not allocating buffer entries for channels
// of elemsize==0, yet the race detector can be made to handle multiple
// sync objects underneath the hood (one sync object per idx)
qp := chanbuf(c, idx)
// When elemsize==0, we don't allocate a full buffer for the channel.
// Instead of individual buffer entries, the race detector uses the
// c.buf as the only buffer entry. This simplification prevents us from
// following the memory model's happens-before rules (rules that are
// implemented in racereleaseacquire). Instead, we accumulate happens-before
// information in the synchronization object associated with c.buf.
if c.elemsize == 0 {
if sg == nil {
raceacquire(qp)
racerelease(qp)
} else {
raceacquireg(sg.g, qp)
racereleaseg(sg.g, qp)
}
} else {
if sg == nil {
racereleaseacquire(qp)
} else {
racereleaseacquireg(sg.g, qp)
}
}
}

View file

@ -254,6 +254,24 @@ func TestCgoCrashTraceback(t *testing.T) {
} }
} }
func TestCgoCrashTracebackGo(t *testing.T) {
t.Parallel()
switch platform := runtime.GOOS + "/" + runtime.GOARCH; platform {
case "darwin/amd64":
case "linux/amd64":
case "linux/ppc64le":
default:
t.Skipf("not yet supported on %s", platform)
}
got := runTestProg(t, "testprogcgo", "CrashTracebackGo")
for i := 1; i <= 3; i++ {
want := fmt.Sprintf("main.h%d", i)
if !strings.Contains(got, want) {
t.Errorf("missing %s", want)
}
}
}
func TestCgoTracebackContext(t *testing.T) { func TestCgoTracebackContext(t *testing.T) {
t.Parallel() t.Parallel()
got := runTestProg(t, "testprogcgo", "TracebackContext") got := runTestProg(t, "testprogcgo", "TracebackContext")

View file

@ -763,3 +763,25 @@ func TestNoRaceCloseHappensBeforeRead(t *testing.T) {
<-read <-read
} }
} }
// Test that we call the proper race detector function when c.elemsize==0.
// See https://github.com/golang/go/issues/42598
func TestNoRaceElemetSize0(t *testing.T) {
var x, y int
var c = make(chan struct{}, 2)
c <- struct{}{}
c <- struct{}{}
go func() {
x += 1
<-c
}()
go func() {
y += 1
<-c
}()
time.Sleep(10 * time.Millisecond)
c <- struct{}{}
c <- struct{}{}
x += 1
y += 1
}

View file

@ -415,7 +415,7 @@ bufrecv:
if cas.elem != nil { if cas.elem != nil {
raceWriteObjectPC(c.elemtype, cas.elem, casePC(casi), chanrecvpc) raceWriteObjectPC(c.elemtype, cas.elem, casePC(casi), chanrecvpc)
} }
racereleaseacquire(chanbuf(c, c.recvx)) racenotify(c, c.recvx, nil)
} }
if msanenabled && cas.elem != nil { if msanenabled && cas.elem != nil {
msanwrite(cas.elem, c.elemtype.size) msanwrite(cas.elem, c.elemtype.size)
@ -437,7 +437,7 @@ bufrecv:
bufsend: bufsend:
// can send to buffer // can send to buffer
if raceenabled { if raceenabled {
racereleaseacquire(chanbuf(c, c.sendx)) racenotify(c, c.sendx, nil)
raceReadObjectPC(c.elemtype, cas.elem, casePC(casi), chansendpc) raceReadObjectPC(c.elemtype, cas.elem, casePC(casi), chansendpc)
} }
if msanenabled { if msanenabled {

View file

@ -17,6 +17,7 @@ import (
"sync/atomic" "sync/atomic"
"testing" "testing"
"time" "time"
_ "unsafe" // for go:linkname
) )
// TestStackMem measures per-thread stack segment cache behavior. // TestStackMem measures per-thread stack segment cache behavior.
@ -851,3 +852,43 @@ func deferHeapAndStack(n int) (r int) {
// Pass a value to escapeMe to force it to escape. // Pass a value to escapeMe to force it to escape.
var escapeMe = func(x interface{}) {} var escapeMe = func(x interface{}) {}
// Test that when F -> G is inlined and F is excluded from stack
// traces, G still appears.
func TestTracebackInlineExcluded(t *testing.T) {
defer func() {
recover()
buf := make([]byte, 4<<10)
stk := string(buf[:Stack(buf, false)])
t.Log(stk)
if not := "tracebackExcluded"; strings.Contains(stk, not) {
t.Errorf("found but did not expect %q", not)
}
if want := "tracebackNotExcluded"; !strings.Contains(stk, want) {
t.Errorf("expected %q in stack", want)
}
}()
tracebackExcluded()
}
// tracebackExcluded should be excluded from tracebacks. There are
// various ways this could come up. Linking it to a "runtime." name is
// rather synthetic, but it's easy and reliable. See issue #42754 for
// one way this happened in real code.
//
//go:linkname tracebackExcluded runtime.tracebackExcluded
//go:noinline
func tracebackExcluded() {
// Call an inlined function that should not itself be excluded
// from tracebacks.
tracebackNotExcluded()
}
// tracebackNotExcluded should be inlined into tracebackExcluded, but
// should not itself be excluded from the traceback.
func tracebackNotExcluded() {
var x *int
*x = 0
}

View file

@ -415,12 +415,15 @@ TEXT runtime·usleep2(SB),NOSPLIT,$20
// Runs on OS stack. duration (in 100ns units) is in BX. // Runs on OS stack. duration (in 100ns units) is in BX.
TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36 TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
get_tls(CX)
CMPL CX, $0
JE gisnotset
// Want negative 100ns units. // Want negative 100ns units.
NEGL BX NEGL BX
MOVL $-1, hi-4(SP) MOVL $-1, hi-4(SP)
MOVL BX, lo-8(SP) MOVL BX, lo-8(SP)
get_tls(CX)
MOVL g(CX), CX MOVL g(CX), CX
MOVL g_m(CX), CX MOVL g_m(CX), CX
MOVL (m_mOS+mOS_highResTimer)(CX), CX MOVL (m_mOS+mOS_highResTimer)(CX), CX
@ -449,6 +452,12 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
RET RET
gisnotset:
// TLS is not configured. Call usleep2 instead.
MOVL $runtime·usleep2(SB), AX
CALL AX
RET
// Runs on OS stack. // Runs on OS stack.
TEXT runtime·switchtothread(SB),NOSPLIT,$0 TEXT runtime·switchtothread(SB),NOSPLIT,$0
MOVL SP, BP MOVL SP, BP

View file

@ -454,11 +454,14 @@ TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48
// Runs on OS stack. duration (in 100ns units) is in BX. // Runs on OS stack. duration (in 100ns units) is in BX.
TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72 TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72
get_tls(CX)
CMPQ CX, $0
JE gisnotset
MOVQ SP, AX MOVQ SP, AX
ANDQ $~15, SP // alignment as per Windows requirement ANDQ $~15, SP // alignment as per Windows requirement
MOVQ AX, 64(SP) MOVQ AX, 64(SP)
get_tls(CX)
MOVQ g(CX), CX MOVQ g(CX), CX
MOVQ g_m(CX), CX MOVQ g_m(CX), CX
MOVQ (m_mOS+mOS_highResTimer)(CX), CX // hTimer MOVQ (m_mOS+mOS_highResTimer)(CX), CX // hTimer
@ -484,6 +487,12 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72
MOVQ 64(SP), SP MOVQ 64(SP), SP
RET RET
gisnotset:
// TLS is not configured. Call usleep2 instead.
MOVQ $runtime·usleep2(SB), AX
CALL AX
RET
// Runs on OS stack. // Runs on OS stack.
TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0
MOVQ SP, AX MOVQ SP, AX

View file

@ -11,58 +11,11 @@ package main
/* /*
#cgo CFLAGS: -g -O0 #cgo CFLAGS: -g -O0
#include <stdint.h> // Defined in traceback_c.c.
extern int crashInGo;
char *p; int tracebackF1(void);
void cgoTraceback(void* parg);
static int f3(void) { void cgoSymbolizer(void* parg);
*p = 0;
return 0;
}
static int f2(void) {
return f3();
}
static int f1(void) {
return f2();
}
struct cgoTracebackArg {
uintptr_t context;
uintptr_t sigContext;
uintptr_t* buf;
uintptr_t max;
};
struct cgoSymbolizerArg {
uintptr_t pc;
const char* file;
uintptr_t lineno;
const char* func;
uintptr_t entry;
uintptr_t more;
uintptr_t data;
};
void cgoTraceback(void* parg) {
struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg);
arg->buf[0] = 1;
arg->buf[1] = 2;
arg->buf[2] = 3;
arg->buf[3] = 0;
}
void cgoSymbolizer(void* parg) {
struct cgoSymbolizerArg* arg = (struct cgoSymbolizerArg*)(parg);
if (arg->pc != arg->data + 1) {
arg->file = "unexpected data";
} else {
arg->file = "cgo symbolizer";
}
arg->lineno = arg->data + 1;
arg->data++;
}
*/ */
import "C" import "C"
@ -73,9 +26,29 @@ import (
func init() { func init() {
register("CrashTraceback", CrashTraceback) register("CrashTraceback", CrashTraceback)
register("CrashTracebackGo", CrashTracebackGo)
} }
func CrashTraceback() { func CrashTraceback() {
runtime.SetCgoTraceback(0, unsafe.Pointer(C.cgoTraceback), nil, unsafe.Pointer(C.cgoSymbolizer)) runtime.SetCgoTraceback(0, unsafe.Pointer(C.cgoTraceback), nil, unsafe.Pointer(C.cgoSymbolizer))
C.f1() C.tracebackF1()
}
func CrashTracebackGo() {
C.crashInGo = 1
CrashTraceback()
}
//export h1
func h1() {
h2()
}
func h2() {
h3()
}
func h3() {
var x *int
*x = 0
} }

View file

@ -0,0 +1,65 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The C definitions for traceback.go. That file uses //export so
// it can't put function definitions in the "C" import comment.
#include <stdint.h>
char *p;
int crashInGo;
extern void h1(void);
int tracebackF3(void) {
if (crashInGo)
h1();
else
*p = 0;
return 0;
}
int tracebackF2(void) {
return tracebackF3();
}
int tracebackF1(void) {
return tracebackF2();
}
struct cgoTracebackArg {
uintptr_t context;
uintptr_t sigContext;
uintptr_t* buf;
uintptr_t max;
};
struct cgoSymbolizerArg {
uintptr_t pc;
const char* file;
uintptr_t lineno;
const char* func;
uintptr_t entry;
uintptr_t more;
uintptr_t data;
};
void cgoTraceback(void* parg) {
struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg);
arg->buf[0] = 1;
arg->buf[1] = 2;
arg->buf[2] = 3;
arg->buf[3] = 0;
}
void cgoSymbolizer(void* parg) {
struct cgoSymbolizerArg* arg = (struct cgoSymbolizerArg*)(parg);
if (arg->pc != arg->data + 1) {
arg->file = "unexpected data";
} else {
arg->file = "cgo symbolizer";
}
arg->lineno = arg->data + 1;
arg->data++;
}

View file

@ -396,13 +396,21 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// If there is inlining info, print the inner frames. // If there is inlining info, print the inner frames.
if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil { if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil {
inltree := (*[1 << 20]inlinedCall)(inldata) inltree := (*[1 << 20]inlinedCall)(inldata)
var inlFunc _func
inlFuncInfo := funcInfo{&inlFunc, f.datap}
for { for {
ix := pcdatavalue(f, _PCDATA_InlTreeIndex, tracepc, nil) ix := pcdatavalue(f, _PCDATA_InlTreeIndex, tracepc, nil)
if ix < 0 { if ix < 0 {
break break
} }
if (flags&_TraceRuntimeFrames) != 0 || showframe(f, gp, nprint == 0, inltree[ix].funcID, lastFuncID) {
name := funcnameFromNameoff(f, inltree[ix].func_) // Create a fake _func for the
// inlined function.
inlFunc.nameoff = inltree[ix].func_
inlFunc.funcID = inltree[ix].funcID
if (flags&_TraceRuntimeFrames) != 0 || showframe(inlFuncInfo, gp, nprint == 0, inlFuncInfo.funcID, lastFuncID) {
name := funcname(inlFuncInfo)
file, line := funcline(f, tracepc) file, line := funcline(f, tracepc)
print(name, "(...)\n") print(name, "(...)\n")
print("\t", file, ":", line, "\n") print("\t", file, ":", line, "\n")
@ -811,6 +819,9 @@ func showframe(f funcInfo, gp *g, firstFrame bool, funcID, childID funcID) bool
// showfuncinfo reports whether a function with the given characteristics should // showfuncinfo reports whether a function with the given characteristics should
// be printed during a traceback. // be printed during a traceback.
func showfuncinfo(f funcInfo, firstFrame bool, funcID, childID funcID) bool { func showfuncinfo(f funcInfo, firstFrame bool, funcID, childID funcID) bool {
// Note that f may be a synthesized funcInfo for an inlined
// function, in which case only nameoff and funcID are set.
level, _, _ := gotraceback() level, _, _ := gotraceback()
if level > 1 { if level > 1 {
// Show all frames. // Show all frames.

View file

@ -0,0 +1,26 @@
// compile
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Ensure that late expansion correctly set OpLoad argument type interface{}
package p
type iface interface {
m()
}
type it interface{}
type makeIface func() iface
func f() {
var im makeIface
e := im().(it)
g(e)
}
//go:noinline
func g(i it) {}