mirror of
https://github.com/golang/go.git
synced 2026-01-30 15:42:04 +03:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e676ab2b8 | ||
|
|
ac94297758 | ||
|
|
6961c3775f | ||
|
|
ebee011a54 | ||
|
|
84fb1b8253 | ||
|
|
c95d3093ca | ||
|
|
561964c9a8 | ||
|
|
e73dadc758 | ||
|
|
2899144b8d | ||
|
|
b062eb46e8 | ||
|
|
8ac5714ef2 | ||
|
|
9546293d22 | ||
|
|
4b3a0b9785 | ||
|
|
5abb1d84f8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,7 +30,6 @@ _testmain.go
|
||||
/misc/cgo/testso/main
|
||||
/pkg/
|
||||
/src/*.*/
|
||||
/src/_artifacts/
|
||||
/src/cmd/cgo/zdefaultcc.go
|
||||
/src/cmd/dist/dist
|
||||
/src/cmd/go/internal/cfg/zdefaultcc.go
|
||||
|
||||
180
api/go1.26.txt
180
api/go1.26.txt
@@ -1,180 +0,0 @@
|
||||
pkg bytes, method (*Buffer) Peek(int) ([]uint8, error) #73794
|
||||
pkg crypto, type Decapsulator interface { Decapsulate, Encapsulator } #75300
|
||||
pkg crypto, type Decapsulator interface, Decapsulate([]uint8) ([]uint8, error) #75300
|
||||
pkg crypto, type Decapsulator interface, Encapsulator() Encapsulator #75300
|
||||
pkg crypto, type Encapsulator interface { Bytes, Encapsulate } #75300
|
||||
pkg crypto, type Encapsulator interface, Bytes() []uint8 #75300
|
||||
pkg crypto, type Encapsulator interface, Encapsulate() ([]uint8, []uint8) #75300
|
||||
pkg crypto/ecdh, type KeyExchanger interface { Curve, ECDH, PublicKey } #75300
|
||||
pkg crypto/ecdh, type KeyExchanger interface, Curve() Curve #75300
|
||||
pkg crypto/ecdh, type KeyExchanger interface, ECDH(*PublicKey) ([]uint8, error) #75300
|
||||
pkg crypto/ecdh, type KeyExchanger interface, PublicKey() *PublicKey #75300
|
||||
pkg crypto/ecdsa, type PrivateKey struct, D //deprecated #63963
|
||||
pkg crypto/ecdsa, type PublicKey struct, X //deprecated #63963
|
||||
pkg crypto/ecdsa, type PublicKey struct, Y //deprecated #63963
|
||||
pkg crypto/fips140, func Enforced() bool #74630
|
||||
pkg crypto/fips140, func Version() string #75301
|
||||
pkg crypto/fips140, func WithoutEnforcement(func()) #74630
|
||||
pkg crypto/hpke, func AES128GCM() AEAD #75300
|
||||
pkg crypto/hpke, func AES256GCM() AEAD #75300
|
||||
pkg crypto/hpke, func ChaCha20Poly1305() AEAD #75300
|
||||
pkg crypto/hpke, func DHKEM(ecdh.Curve) KEM #75300
|
||||
pkg crypto/hpke, func ExportOnly() AEAD #75300
|
||||
pkg crypto/hpke, func HKDFSHA256() KDF #75300
|
||||
pkg crypto/hpke, func HKDFSHA384() KDF #75300
|
||||
pkg crypto/hpke, func HKDFSHA512() KDF #75300
|
||||
pkg crypto/hpke, func MLKEM1024() KEM #75300
|
||||
pkg crypto/hpke, func MLKEM1024P384() KEM #75300
|
||||
pkg crypto/hpke, func MLKEM768() KEM #75300
|
||||
pkg crypto/hpke, func MLKEM768P256() KEM #75300
|
||||
pkg crypto/hpke, func MLKEM768X25519() KEM #75300
|
||||
pkg crypto/hpke, func NewAEAD(uint16) (AEAD, error) #75300
|
||||
pkg crypto/hpke, func NewDHKEMPrivateKey(ecdh.KeyExchanger) (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, func NewDHKEMPublicKey(*ecdh.PublicKey) (PublicKey, error) #75300
|
||||
pkg crypto/hpke, func NewHybridPrivateKey(crypto.Decapsulator, ecdh.KeyExchanger) (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, func NewHybridPublicKey(crypto.Encapsulator, *ecdh.PublicKey) (PublicKey, error) #75300
|
||||
pkg crypto/hpke, func NewKDF(uint16) (KDF, error) #75300
|
||||
pkg crypto/hpke, func NewKEM(uint16) (KEM, error) #75300
|
||||
pkg crypto/hpke, func NewMLKEMPrivateKey(crypto.Decapsulator) (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, func NewMLKEMPublicKey(crypto.Encapsulator) (PublicKey, error) #75300
|
||||
pkg crypto/hpke, func NewRecipient([]uint8, PrivateKey, KDF, AEAD, []uint8) (*Recipient, error) #75300
|
||||
pkg crypto/hpke, func NewSender(PublicKey, KDF, AEAD, []uint8) ([]uint8, *Sender, error) #75300
|
||||
pkg crypto/hpke, func Open(PrivateKey, KDF, AEAD, []uint8, []uint8) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, func SHAKE128() KDF #75300
|
||||
pkg crypto/hpke, func SHAKE256() KDF #75300
|
||||
pkg crypto/hpke, func Seal(PublicKey, KDF, AEAD, []uint8, []uint8) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, method (*Recipient) Export(string, int) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, method (*Recipient) Open([]uint8, []uint8) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, method (*Sender) Export(string, int) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, method (*Sender) Seal([]uint8, []uint8) ([]uint8, error) #75300
|
||||
pkg crypto/hpke, type AEAD interface, ID() uint16 #75300
|
||||
pkg crypto/hpke, type AEAD interface, unexported methods #75300
|
||||
pkg crypto/hpke, type KDF interface, ID() uint16 #75300
|
||||
pkg crypto/hpke, type KDF interface, unexported methods #75300
|
||||
pkg crypto/hpke, type KEM interface, DeriveKeyPair([]uint8) (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, type KEM interface, GenerateKey() (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, type KEM interface, ID() uint16 #75300
|
||||
pkg crypto/hpke, type KEM interface, NewPrivateKey([]uint8) (PrivateKey, error) #75300
|
||||
pkg crypto/hpke, type KEM interface, NewPublicKey([]uint8) (PublicKey, error) #75300
|
||||
pkg crypto/hpke, type KEM interface, unexported methods #75300
|
||||
pkg crypto/hpke, type PrivateKey interface, Bytes() ([]uint8, error) #75300
|
||||
pkg crypto/hpke, type PrivateKey interface, KEM() KEM #75300
|
||||
pkg crypto/hpke, type PrivateKey interface, PublicKey() PublicKey #75300
|
||||
pkg crypto/hpke, type PrivateKey interface, unexported methods #75300
|
||||
pkg crypto/hpke, type PublicKey interface, Bytes() []uint8 #75300
|
||||
pkg crypto/hpke, type PublicKey interface, KEM() KEM #75300
|
||||
pkg crypto/hpke, type PublicKey interface, unexported methods #75300
|
||||
pkg crypto/hpke, type Recipient struct #75300
|
||||
pkg crypto/hpke, type Sender struct #75300
|
||||
pkg crypto/mlkem, method (*DecapsulationKey1024) Encapsulator() crypto.Encapsulator #75300
|
||||
pkg crypto/mlkem, method (*DecapsulationKey768) Encapsulator() crypto.Encapsulator #75300
|
||||
pkg crypto/mlkem/mlkemtest, func Encapsulate1024(*mlkem.EncapsulationKey1024, []uint8) ([]uint8, []uint8, error) #73627
|
||||
pkg crypto/mlkem/mlkemtest, func Encapsulate768(*mlkem.EncapsulationKey768, []uint8) ([]uint8, []uint8, error) #73627
|
||||
pkg crypto/rsa, func DecryptPKCS1v15 //deprecated #75302
|
||||
pkg crypto/rsa, func DecryptPKCS1v15SessionKey //deprecated #75302
|
||||
pkg crypto/rsa, func EncryptOAEPWithOptions(io.Reader, *PublicKey, []uint8, *OAEPOptions) ([]uint8, error) #65716
|
||||
pkg crypto/rsa, func EncryptPKCS1v15 //deprecated #75302
|
||||
pkg crypto/rsa, type PKCS1v15DecryptOptions //deprecated #75302
|
||||
pkg crypto/tls, const QUICErrorEvent = 10 #75108
|
||||
pkg crypto/tls, const QUICErrorEvent QUICEventKind #75108
|
||||
pkg crypto/tls, const SecP256r1MLKEM768 = 4587 #71206
|
||||
pkg crypto/tls, const SecP256r1MLKEM768 CurveID #71206
|
||||
pkg crypto/tls, const SecP384r1MLKEM1024 = 4589 #71206
|
||||
pkg crypto/tls, const SecP384r1MLKEM1024 CurveID #71206
|
||||
pkg crypto/tls, type ClientHelloInfo struct, HelloRetryRequest bool #74425
|
||||
pkg crypto/tls, type ConnectionState struct, HelloRetryRequest bool #74425
|
||||
pkg crypto/tls, type QUICEvent struct, Err error #75108
|
||||
pkg crypto/x509, func OIDFromASN1OID(asn1.ObjectIdentifier) (OID, error) #75325
|
||||
pkg crypto/x509, method (ExtKeyUsage) OID() OID #75325
|
||||
pkg crypto/x509, method (ExtKeyUsage) String() string #56866
|
||||
pkg crypto/x509, method (KeyUsage) String() string #56866
|
||||
pkg debug/elf, const R_LARCH_CALL36 = 110 #75562
|
||||
pkg debug/elf, const R_LARCH_CALL36 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC32 = 13 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC32 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64 = 14 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_HI12 = 118 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_HI12 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_LO20 = 117 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_LO20 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_HI12 = 114 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_HI12 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_LO20 = 113 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC64_PC_LO20 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_CALL = 120 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_CALL R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_HI20 = 115 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_HI20 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_LD = 119 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_LD R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_LO12 = 116 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_LO12 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PCREL20_S2 = 126 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PCREL20_S2 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PC_HI20 = 111 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PC_HI20 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PC_LO12 = 112 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_DESC_PC_LO12 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_GD_PCREL20_S2 = 125 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_GD_PCREL20_S2 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LD_PCREL20_S2 = 124 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LD_PCREL20_S2 R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_ADD_R = 122 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_ADD_R R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_HI20_R = 121 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_HI20_R R_LARCH #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_LO12_R = 123 #75562
|
||||
pkg debug/elf, const R_LARCH_TLS_LE_LO12_R R_LARCH #75562
|
||||
pkg errors, func AsType[$0 error](error) ($0, bool) #51945
|
||||
pkg go/ast, func ParseDirective(token.Pos, string) (Directive, bool) #68021
|
||||
pkg go/ast, method (*Directive) End() token.Pos #68021
|
||||
pkg go/ast, method (*Directive) ParseArgs() ([]DirectiveArg, error) #68021
|
||||
pkg go/ast, method (*Directive) Pos() token.Pos #68021
|
||||
pkg go/ast, type BasicLit struct, ValueEnd token.Pos #76031
|
||||
pkg go/ast, type Directive struct #68021
|
||||
pkg go/ast, type Directive struct, Args string #68021
|
||||
pkg go/ast, type Directive struct, ArgsPos token.Pos #68021
|
||||
pkg go/ast, type Directive struct, Name string #68021
|
||||
pkg go/ast, type Directive struct, Slash token.Pos #68021
|
||||
pkg go/ast, type Directive struct, Tool string #68021
|
||||
pkg go/ast, type DirectiveArg struct #68021
|
||||
pkg go/ast, type DirectiveArg struct, Arg string #68021
|
||||
pkg go/ast, type DirectiveArg struct, Pos token.Pos #68021
|
||||
pkg go/token, method (*File) End() Pos #75849
|
||||
pkg log/slog, func NewMultiHandler(...Handler) *MultiHandler #65954
|
||||
pkg log/slog, method (*MultiHandler) Enabled(context.Context, Level) bool #65954
|
||||
pkg log/slog, method (*MultiHandler) Handle(context.Context, Record) error #65954
|
||||
pkg log/slog, method (*MultiHandler) WithAttrs([]Attr) Handler #65954
|
||||
pkg log/slog, method (*MultiHandler) WithGroup(string) Handler #65954
|
||||
pkg log/slog, type MultiHandler struct #65954
|
||||
pkg net, method (*Dialer) DialIP(context.Context, string, netip.Addr, netip.Addr) (*IPConn, error) #49097
|
||||
pkg net, method (*Dialer) DialTCP(context.Context, string, netip.AddrPort, netip.AddrPort) (*TCPConn, error) #49097
|
||||
pkg net, method (*Dialer) DialUDP(context.Context, string, netip.AddrPort, netip.AddrPort) (*UDPConn, error) #49097
|
||||
pkg net, method (*Dialer) DialUnix(context.Context, string, *UnixAddr, *UnixAddr) (*UnixConn, error) #49097
|
||||
pkg net/http, method (*ClientConn) Available() int #75772
|
||||
pkg net/http, method (*ClientConn) Close() error #75772
|
||||
pkg net/http, method (*ClientConn) Err() error #75772
|
||||
pkg net/http, method (*ClientConn) InFlight() int #75772
|
||||
pkg net/http, method (*ClientConn) Release() #75772
|
||||
pkg net/http, method (*ClientConn) Reserve() error #75772
|
||||
pkg net/http, method (*ClientConn) RoundTrip(*Request) (*Response, error) #75772
|
||||
pkg net/http, method (*ClientConn) SetStateHook(func(*ClientConn)) #75772
|
||||
pkg net/http, method (*Transport) NewClientConn(context.Context, string, string) (*ClientConn, error) #75772
|
||||
pkg net/http, type ClientConn struct #75772
|
||||
pkg net/http, type HTTP2Config struct, StrictMaxConcurrentRequests bool #67813
|
||||
pkg net/http/httputil, type ReverseProxy struct, Director //deprecated #73161
|
||||
pkg net/netip, method (Prefix) Compare(Prefix) int #61642
|
||||
pkg os, method (*Process) WithHandle(func(uintptr)) error #70352
|
||||
pkg os, var ErrNoHandle error #70352
|
||||
pkg reflect, method (Value) Fields() iter.Seq2[StructField, Value] #66631
|
||||
pkg reflect, method (Value) Methods() iter.Seq2[Method, Value] #66631
|
||||
pkg reflect, type Type interface, Fields() iter.Seq[StructField] #66631
|
||||
pkg reflect, type Type interface, Ins() iter.Seq[Type] #66631
|
||||
pkg reflect, type Type interface, Methods() iter.Seq[Method] #66631
|
||||
pkg reflect, type Type interface, Outs() iter.Seq[Type] #66631
|
||||
pkg testing, method (*B) ArtifactDir() string #71287
|
||||
pkg testing, method (*F) ArtifactDir() string #71287
|
||||
pkg testing, method (*T) ArtifactDir() string #71287
|
||||
pkg testing, type TB interface, ArtifactDir() string #71287
|
||||
pkg testing/cryptotest, func SetGlobalRandom(*testing.T, uint64) #70942
|
||||
@@ -1,2 +1,2 @@
|
||||
branch: dev.simd
|
||||
branch: release-branch.go1.25
|
||||
parent-branch: master
|
||||
|
||||
@@ -1039,12 +1039,6 @@ The value of <code>GOMIPS64</code> environment variable (<code>hardfloat</code>
|
||||
<code>GOMIPS64_hardfloat</code> or <code>GOMIPS64_softfloat</code>.
|
||||
</p>
|
||||
|
||||
<h3 id="riscv64">RISCV64</h3>
|
||||
|
||||
<p>
|
||||
Reference: <a href="/pkg/cmd/internal/obj/riscv">Go RISCV64 Assembly Instructions Reference Manual</a>
|
||||
</p>
|
||||
|
||||
<h3 id="unsupported_opcodes">Unsupported opcodes</h3>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -231,7 +231,7 @@ do exactly this.
|
||||
|
||||
<p>
|
||||
A read of an array, struct, or complex number
|
||||
may be implemented as a read of each individual sub-value
|
||||
may by implemented as a read of each individual sub-value
|
||||
(array element, struct field, or real/imaginary component),
|
||||
in any order.
|
||||
Similarly, a write of an array, struct, or complex number
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--{
|
||||
"Title": "The Go Programming Language Specification",
|
||||
"Subtitle": "Language version go1.26 (Dec 2, 2025)",
|
||||
"Subtitle": "Language version go1.25 (Feb 25, 2025)",
|
||||
"Path": "/ref/spec"
|
||||
}-->
|
||||
|
||||
@@ -2487,15 +2487,11 @@ type set[P comparable] = map[P]bool
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
In an alias declaration the given type cannot be a type parameter declared in the same declaration.
|
||||
In an alias declaration the given type cannot be a type parameter.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
type A[P any] = P // illegal: P is a type parameter declared in the declaration of A
|
||||
|
||||
func f[P any]() {
|
||||
type A = P // ok: T is a type parameter declared by the enclosing function
|
||||
}
|
||||
type A[P any] = P // illegal: P is a type parameter
|
||||
</pre>
|
||||
|
||||
<h4 id="Type_definitions">Type definitions</h4>
|
||||
@@ -2605,8 +2601,8 @@ In a type definition the given type cannot be a type parameter.
|
||||
<pre>
|
||||
type T[P any] P // illegal: P is a type parameter
|
||||
|
||||
func f[P any]() {
|
||||
type L P // illegal: P is a type parameter declared by the enclosing function
|
||||
func f[T any]() {
|
||||
type L T // illegal: T is a type parameter declared by the enclosing function
|
||||
}
|
||||
</pre>
|
||||
|
||||
@@ -2690,6 +2686,22 @@ of a <a href="#Method_declarations">method declaration</a> associated
|
||||
with a generic type.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Within a type parameter list of a generic type <code>T</code>, a type constraint
|
||||
may not (directly, or indirectly through the type parameter list of another
|
||||
generic type) refer to <code>T</code>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
type T1[P T1[P]] … // illegal: T1 refers to itself
|
||||
type T2[P interface{ T2[int] }] … // illegal: T2 refers to itself
|
||||
type T3[P interface{ m(T3[int])}] … // illegal: T3 refers to itself
|
||||
type T4[P T5[P]] … // illegal: T4 refers to T5 and
|
||||
type T5[P T4[P]] … // T5 refers to T4
|
||||
|
||||
type T6[P int] struct{ f *T6[P] } // ok: reference to T6 is not in type parameter list
|
||||
</pre>
|
||||
|
||||
<h4 id="Type_constraints">Type constraints</h4>
|
||||
|
||||
<p>
|
||||
@@ -3161,7 +3173,7 @@ Element = Expression | LiteralValue .
|
||||
|
||||
<p>
|
||||
Unless the LiteralType is a type parameter,
|
||||
its <a href="#Underlying_types">underlying type</a>
|
||||
its <a href="#Underlying_types">underlying type
|
||||
must be a struct, array, slice, or map type
|
||||
(the syntax enforces this constraint except when the type is given
|
||||
as a TypeName).
|
||||
@@ -4861,7 +4873,7 @@ For instance, <code>x / y * z</code> is the same as <code>(x / y) * z</code>.
|
||||
x <= f() // x <= f()
|
||||
^a >> b // (^a) >> b
|
||||
f() || g() // f() || g()
|
||||
x == y+1 && <-chanInt > 0 // (x == (y+1)) && ((<-chanInt) > 0)
|
||||
x == y+1 && <-chanInt > 0 // (x == (y+1)) && ((<-chanInt) > 0)
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -6623,7 +6635,7 @@ iteration's variable at that moment.
|
||||
|
||||
<pre>
|
||||
var prints []func()
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := 0; i < 5; i++ {
|
||||
prints = append(prints, func() { println(i) })
|
||||
i++
|
||||
}
|
||||
@@ -6760,7 +6772,7 @@ if the iteration variable is preexisting, the type of the iteration values is th
|
||||
variable, which must be of integer type.
|
||||
Otherwise, if the iteration variable is declared by the "range" clause or is absent,
|
||||
the type of the iteration values is the <a href="#Constants">default type</a> for <code>n</code>.
|
||||
If <code>n</code> <= 0, the loop does not run any iterations.
|
||||
If <code>n</code> <= 0, the loop does not run any iterations.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
@@ -6871,7 +6883,7 @@ type Tree[K cmp.Ordered, V any] struct {
|
||||
}
|
||||
|
||||
func (t *Tree[K, V]) walk(yield func(key K, val V) bool) bool {
|
||||
return t == nil || t.left.walk(yield) && yield(t.key, t.value) && t.right.walk(yield)
|
||||
return t == nil || t.left.walk(yield) && yield(t.key, t.value) && t.right.walk(yield)
|
||||
}
|
||||
|
||||
func (t *Tree[K, V]) Walk(yield func(key K, val V) bool) {
|
||||
@@ -7371,8 +7383,8 @@ The values <code>x</code> are passed to a parameter of type <code>...E</code>
|
||||
where <code>E</code> is the element type of <code>S</code>
|
||||
and the respective <a href="#Passing_arguments_to_..._parameters">parameter
|
||||
passing rules</a> apply.
|
||||
As a special case, <code>append</code> also accepts a slice whose type is assignable to
|
||||
type <code>[]byte</code> with a second argument of <code>string</code> type followed by
|
||||
As a special case, <code>append</code> also accepts a first argument assignable
|
||||
to type <code>[]byte</code> with a second argument of string type followed by
|
||||
<code>...</code>.
|
||||
This form appends the bytes of the string.
|
||||
</p>
|
||||
@@ -7496,7 +7508,7 @@ returns a received value along with an indication of whether the channel is clos
|
||||
<p>
|
||||
If the type of the argument to <code>close</code> is a
|
||||
<a href="#Type_parameter_declarations">type parameter</a>,
|
||||
all types in its type set must be channels.
|
||||
all types in its type set must be channels with the same element type.
|
||||
It is an error if any of those channels is a receive-only channel.
|
||||
</p>
|
||||
|
||||
@@ -7787,39 +7799,27 @@ compared lexically byte-wise:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
min(x, y) == if x <= y then x else y
|
||||
min(x, y) == if x <= y then x else y
|
||||
min(x, y, z) == min(min(x, y), z)
|
||||
</pre>
|
||||
|
||||
<h3 id="Allocation">Allocation</h3>
|
||||
|
||||
<p>
|
||||
The built-in function <code>new</code> creates a new, initialized
|
||||
<a href="#Variables">variable</a> and returns
|
||||
a <a href="#Pointer_types">pointer</a> to it.
|
||||
It accepts a single argument, which may be either a type or an expression.
|
||||
The built-in function <code>new</code> takes a type <code>T</code>,
|
||||
allocates storage for a <a href="#Variables">variable</a> of that type
|
||||
at run time, and returns a value of type <code>*T</code>
|
||||
<a href="#Pointer_types">pointing</a> to it.
|
||||
The variable is initialized as described in the section on
|
||||
<a href="#The_zero_value">initial values</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the argument is a type <code>T</code>, then <code>new(T)</code>
|
||||
allocates a variable of type <code>T</code> initialized to its
|
||||
<a href="#The_zero_value">zero value</a>.
|
||||
</p>
|
||||
<pre class="grammar">
|
||||
new(T)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the argument is an expression <code>x</code>, then <code>new(x)</code>
|
||||
allocates a variable of the type of <code>x</code> initialized to the value of <code>x</code>.
|
||||
If that value is an untyped constant, it is first implicitly <a href="#Conversions">converted</a>
|
||||
to its <a href="#Constants">default type</a>;
|
||||
if it is an untyped boolean value, it is first implicitly converted to type bool.
|
||||
The predeclared identifier <code>nil</code> cannot be used as an argument to <code>new</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, <code>new(int)</code> and <code>new(123)</code> each
|
||||
return a pointer to a new variable of type <code>int</code>.
|
||||
The value of the first variable is <code>0</code>, and the value
|
||||
of the second is <code>123</code>. Similarly
|
||||
For instance
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
@@ -7828,12 +7828,13 @@ new(S)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
allocates a variable of type <code>S</code>,
|
||||
allocates storage for a variable of type <code>S</code>,
|
||||
initializes it (<code>a=0</code>, <code>b=0.0</code>),
|
||||
and returns a value of type <code>*S</code> containing the address
|
||||
of the variable.
|
||||
of the location.
|
||||
</p>
|
||||
|
||||
|
||||
<h3 id="Handling_panics">Handling panics</h3>
|
||||
|
||||
<p> Two built-in functions, <code>panic</code> and <code>recover</code>,
|
||||
|
||||
@@ -153,36 +153,6 @@ for example,
|
||||
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
|
||||
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).
|
||||
|
||||
### Go 1.26
|
||||
|
||||
Go 1.26 added a new `httpcookiemaxnum` setting that controls the maximum number
|
||||
of cookies that net/http will accept when parsing HTTP headers. If the number of
|
||||
cookie in a header exceeds the number set in `httpcookiemaxnum`, cookie parsing
|
||||
will fail early. The default value is `httpcookiemaxnum=3000`. Setting
|
||||
`httpcookiemaxnum=0` will allow the cookie parsing to accept an indefinite
|
||||
number of cookies. To avoid denial of service attacks, this setting and default
|
||||
was backported to Go 1.25.2 and Go 1.24.8.
|
||||
|
||||
Go 1.26 added a new `urlstrictcolons` setting that controls whether `net/url.Parse`
|
||||
allows malformed hostnames containing colons outside of a bracketed IPv6 address.
|
||||
The default `urlstrictcolons=1` rejects URLs such as `http://localhost:1:2` or `http://::1/`.
|
||||
Colons are permitted as part of a bracketed IPv6 address, such as `http://[::1]/`.
|
||||
|
||||
Go 1.26 enabled two additional post-quantum key exchange mechanisms:
|
||||
SecP256r1MLKEM768 and SecP384r1MLKEM1024. The default can be reverted using the
|
||||
[`tlssecpmlkem` setting](/pkg/crypto/tls/#Config.CurvePreferences).
|
||||
|
||||
Go 1.26 added a new `tracebacklabels` setting that controls the inclusion of
|
||||
goroutine labels set through the the `runtime/pprof` package. Setting `tracebacklabels=1`
|
||||
includes these key/value pairs in the goroutine status header of runtime
|
||||
tracebacks and debug=2 runtime/pprof stack dumps. This format may change in the future.
|
||||
(see go.dev/issue/76349)
|
||||
|
||||
Go 1.26 added a new `cryptocustomrand` setting that controls whether most crypto/...
|
||||
APIs ignore the random `io.Reader` parameter. For Go 1.26, it defaults
|
||||
to `cryptocustomrand=0`, ignoring the random parameters. Using `cryptocustomrand=1`
|
||||
reverts to the pre-Go 1.26 behavior.
|
||||
|
||||
### Go 1.25
|
||||
|
||||
Go 1.25 added a new `decoratemappings` setting that controls whether the Go
|
||||
@@ -306,7 +276,7 @@ Go 1.23 changed the channels created by package time to be unbuffered
|
||||
and [`Timer.Reset`](/pkg/time/#Timer.Reset) method results much easier.
|
||||
The [`asynctimerchan` setting](/pkg/time/#NewTimer) disables this change.
|
||||
There are no runtime metrics for this change,
|
||||
This setting will be removed in Go 1.27.
|
||||
This setting may be removed in a future release, Go 1.27 at the earliest.
|
||||
|
||||
Go 1.23 changed the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat)
|
||||
for reparse points, which can be controlled with the `winsymlink` setting.
|
||||
@@ -343,7 +313,6 @@ any effect.
|
||||
Go 1.23 changed the default TLS cipher suites used by clients and servers when
|
||||
not explicitly configured, removing 3DES cipher suites. The default can be reverted
|
||||
using the [`tls3des` setting](/pkg/crypto/tls/#Config.CipherSuites).
|
||||
This setting will be removed in Go 1.27.
|
||||
|
||||
Go 1.23 changed the behavior of [`tls.X509KeyPair`](/pkg/crypto/tls#X509KeyPair)
|
||||
and [`tls.LoadX509KeyPair`](/pkg/crypto/tls#LoadX509KeyPair) to populate the
|
||||
@@ -351,7 +320,6 @@ Leaf field of the returned [`tls.Certificate`](/pkg/crypto/tls#Certificate).
|
||||
This behavior is controlled by the `x509keypairleaf` setting. For Go 1.23, it
|
||||
defaults to `x509keypairleaf=1`. Previous versions default to
|
||||
`x509keypairleaf=0`.
|
||||
This setting will be removed in Go 1.27.
|
||||
|
||||
Go 1.23 changed
|
||||
[`net/http.ServeContent`](/pkg/net/http#ServeContent),
|
||||
@@ -385,24 +353,21 @@ Whether the type checker produces `Alias` types or not is controlled by the
|
||||
[`gotypesalias` setting](/pkg/go/types#Alias).
|
||||
For Go 1.22 it defaults to `gotypesalias=0`.
|
||||
For Go 1.23, `gotypesalias=1` will become the default.
|
||||
This setting will be removed in Go 1.27.
|
||||
This setting will be removed in a future release, Go 1.27 at the earliest.
|
||||
|
||||
Go 1.22 changed the default minimum TLS version supported by both servers
|
||||
and clients to TLS 1.2. The default can be reverted to TLS 1.0 using the
|
||||
[`tls10server` setting](/pkg/crypto/tls/#Config).
|
||||
This setting will be removed in Go 1.27.
|
||||
|
||||
Go 1.22 changed the default TLS cipher suites used by clients and servers when
|
||||
not explicitly configured, removing the cipher suites which used RSA based key
|
||||
exchange. The default can be reverted using the [`tlsrsakex` setting](/pkg/crypto/tls/#Config).
|
||||
This setting will be removed in Go 1.27.
|
||||
|
||||
Go 1.22 disabled
|
||||
[`ConnectionState.ExportKeyingMaterial`](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial)
|
||||
when the connection supports neither TLS 1.3 nor Extended Master Secret
|
||||
(implemented in Go 1.21). It can be reenabled with the [`tlsunsafeekm`
|
||||
setting](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial).
|
||||
This setting will be removed in Go 1.27.
|
||||
|
||||
Go 1.22 changed how the runtime interacts with transparent huge pages on Linux.
|
||||
In particular, a common default Linux kernel configuration can result in
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
### Minor changes to the library {#minor_library_changes}
|
||||
|
||||
#### go/types
|
||||
|
||||
The `Var.Kind` method returns an enumeration of type `VarKind` that
|
||||
classifies the variable (package-level, local, receiver, parameter,
|
||||
result, or struct field). See issue #70250.
|
||||
|
||||
Callers of `NewVar` or `NewParam` are encouraged to call `Var.SetKind`
|
||||
to ensure that this attribute is set correctly in all cases.
|
||||
|
||||
@@ -30,7 +30,7 @@ v%.zip:
|
||||
go run ../../src/cmd/go/internal/fips140/mkzip.go v$*
|
||||
|
||||
# normally mkzip refuses to overwrite an existing zip file.
|
||||
# make v1.2.3.rm removes the zip file and unpacked
|
||||
# make v1.2.3.rm removes the zip file and and unpacked
|
||||
# copy from the module cache.
|
||||
v%.rm:
|
||||
rm -f v$*.zip
|
||||
|
||||
@@ -9,5 +9,4 @@
|
||||
#
|
||||
# go test cmd/go/internal/fips140 -update
|
||||
#
|
||||
v1.0.0-c2097c7c.zip daf3614e0406f67ae6323c902db3f953a1effb199142362a039e7526dfb9368b
|
||||
v1.1.0-rc1.zip ea94f8c3885294c9efe1bd8f9b6e86daeb25b6aff2aeb20707cd9a5101f6f54e
|
||||
v1.0.0.zip b50508feaeff05d22516b21e1fd210bbf5d6a1e422eaf2cfa23fe379342713b8
|
||||
|
||||
@@ -1 +1 @@
|
||||
v1.0.0-c2097c7c
|
||||
v1.0.0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
v1.0.0-c2097c7c
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,64 +0,0 @@
|
||||
# Copyright 2025 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.
|
||||
|
||||
# Mercurial extension to add a 'goreposum' command that
|
||||
# computes a hash of a remote repo's tag state.
|
||||
# Tag definitions can come from the .hgtags file stored in
|
||||
# any head of any branch, and the server protocol does not
|
||||
# expose the tags directly. However, the protocol does expose
|
||||
# the hashes of all the branch heads, so we can use a hash of
|
||||
# all those branch names and heads as a conservative snapshot
|
||||
# of the entire remote repo state, and use that as the tag sum.
|
||||
# Any change on the server then invalidates the tag sum,
|
||||
# even if it didn't have anything to do with tags, but at least
|
||||
# we will avoid re-cloning a server when there have been no
|
||||
# changes at all.
|
||||
#
|
||||
# Separately, this extension also adds a 'golookup' command that
|
||||
# returns the hash of a specific reference, like 'default' or a tag.
|
||||
# And golookup of a hash confirms that it still exists on the server.
|
||||
# We can use that to revalidate that specific versions still exist and
|
||||
# have the same meaning they did the last time we checked.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# hg --config "extensions.goreposum=$GOROOT/lib/hg/goreposum.py" goreposum REPOURL
|
||||
|
||||
import base64, hashlib, sys
|
||||
from mercurial import registrar, ui, hg, node
|
||||
from mercurial.i18n import _
|
||||
cmdtable = {}
|
||||
command = registrar.command(cmdtable)
|
||||
@command(b'goreposum', [], _('url'), norepo=True)
|
||||
def goreposum(ui, url):
|
||||
"""
|
||||
goreposum computes a checksum of all the named state in the remote repo.
|
||||
It hashes together all the branch names and hashes
|
||||
and then all the bookmark names and hashes.
|
||||
Tags are stored in .hgtags files in any of the branches,
|
||||
so the branch metadata includes the tags as well.
|
||||
"""
|
||||
h = hashlib.sha256()
|
||||
peer = hg.peer(ui, {}, url)
|
||||
for name, revs in peer.branchmap().items():
|
||||
h.update(name)
|
||||
for r in revs:
|
||||
h.update(b' ')
|
||||
h.update(r)
|
||||
h.update(b'\n')
|
||||
if (b'bookmarks' in peer.listkeys(b'namespaces')):
|
||||
for name, rev in peer.listkeys(b'bookmarks').items():
|
||||
h.update(name)
|
||||
h.update(b'=')
|
||||
h.update(rev)
|
||||
h.update(b'\n')
|
||||
print('r1:'+base64.standard_b64encode(h.digest()).decode('utf-8'))
|
||||
|
||||
@command(b'golookup', [], _('url rev'), norepo=True)
|
||||
def golookup(ui, url, rev):
|
||||
"""
|
||||
golookup looks up a single identifier in the repo,
|
||||
printing its hash.
|
||||
"""
|
||||
print(node.hex(hg.peer(ui, {}, url).lookup(rev)).decode('utf-8'))
|
||||
@@ -24,8 +24,8 @@
|
||||
# in the CL match the update.bash in the CL.
|
||||
|
||||
# Versions to use.
|
||||
CODE=2025c
|
||||
DATA=2025c
|
||||
CODE=2025b
|
||||
DATA=2025b
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
Binary file not shown.
@@ -212,7 +212,7 @@ func copyLocalData(dstbase string) (pkgpath string, err error) {
|
||||
// Copy all immediate files and testdata directories between
|
||||
// the package being tested and the source root.
|
||||
pkgpath = ""
|
||||
for element := range strings.SplitSeq(finalPkgpath, string(filepath.Separator)) {
|
||||
for _, element := range strings.Split(finalPkgpath, string(filepath.Separator)) {
|
||||
if debug {
|
||||
log.Printf("copying %s", pkgpath)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ var (
|
||||
errMissData = errors.New("archive/tar: sparse file references non-existent data")
|
||||
errUnrefData = errors.New("archive/tar: sparse file contains unreferenced data")
|
||||
errWriteHole = errors.New("archive/tar: write non-NUL byte in sparse hole")
|
||||
errSparseTooLong = errors.New("archive/tar: sparse map too long")
|
||||
)
|
||||
|
||||
type headerError []string
|
||||
|
||||
@@ -531,17 +531,12 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
|
||||
cntNewline int64
|
||||
buf bytes.Buffer
|
||||
blk block
|
||||
totalSize int
|
||||
)
|
||||
|
||||
// feedTokens copies data in blocks from r into buf until there are
|
||||
// at least cnt newlines in buf. It will not read more blocks than needed.
|
||||
feedTokens := func(n int64) error {
|
||||
for cntNewline < n {
|
||||
totalSize += len(blk)
|
||||
if totalSize > maxSpecialFileSize {
|
||||
return errSparseTooLong
|
||||
}
|
||||
if _, err := mustReadFull(r, blk[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -574,8 +569,8 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
|
||||
}
|
||||
|
||||
// Parse for all member entries.
|
||||
// numEntries is trusted after this since feedTokens limits the number of
|
||||
// tokens based on maxSpecialFileSize.
|
||||
// numEntries is trusted after this since a potential attacker must have
|
||||
// committed resources proportional to what this library used.
|
||||
if err := feedTokens(2 * numEntries); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"internal/obscuretestdata"
|
||||
"io"
|
||||
"maps"
|
||||
"math"
|
||||
@@ -26,11 +25,10 @@ import (
|
||||
|
||||
func TestReader(t *testing.T) {
|
||||
vectors := []struct {
|
||||
file string // Test input file
|
||||
obscured bool // Obscured with obscuretestdata package
|
||||
headers []*Header // Expected output headers
|
||||
chksums []string // CRC32 checksum of files, leave as nil if not checked
|
||||
err error // Expected error to occur
|
||||
file string // Test input file
|
||||
headers []*Header // Expected output headers
|
||||
chksums []string // CRC32 checksum of files, leave as nil if not checked
|
||||
err error // Expected error to occur
|
||||
}{{
|
||||
file: "testdata/gnu.tar",
|
||||
headers: []*Header{{
|
||||
@@ -525,9 +523,8 @@ func TestReader(t *testing.T) {
|
||||
file: "testdata/pax-nul-path.tar",
|
||||
err: ErrHeader,
|
||||
}, {
|
||||
file: "testdata/neg-size.tar.base64",
|
||||
obscured: true,
|
||||
err: ErrHeader,
|
||||
file: "testdata/neg-size.tar",
|
||||
err: ErrHeader,
|
||||
}, {
|
||||
file: "testdata/issue10968.tar",
|
||||
err: ErrHeader,
|
||||
@@ -624,32 +621,18 @@ func TestReader(t *testing.T) {
|
||||
},
|
||||
Format: FormatPAX,
|
||||
}},
|
||||
}, {
|
||||
// Small compressed file that uncompresses to
|
||||
// a file with a very large GNU 1.0 sparse map.
|
||||
file: "testdata/gnu-sparse-many-zeros.tar.bz2",
|
||||
err: errSparseTooLong,
|
||||
}}
|
||||
|
||||
for _, v := range vectors {
|
||||
t.Run(strings.TrimSuffix(path.Base(v.file), ".base64"), func(t *testing.T) {
|
||||
path := v.file
|
||||
if v.obscured {
|
||||
tf, err := obscuretestdata.DecodeToTempFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("obscuredtestdata.DecodeToTempFile(%s): %v", path, err)
|
||||
}
|
||||
path = tf
|
||||
}
|
||||
|
||||
f, err := os.Open(path)
|
||||
t.Run(path.Base(v.file), func(t *testing.T) {
|
||||
f, err := os.Open(v.file)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var fr io.Reader = f
|
||||
if strings.HasSuffix(v.file, ".bz2") || strings.HasSuffix(v.file, ".bz2.base64") {
|
||||
if strings.HasSuffix(v.file, ".bz2") {
|
||||
fr = bzip2.NewReader(fr)
|
||||
}
|
||||
|
||||
@@ -787,7 +770,7 @@ type readBadSeeker struct{ io.ReadSeeker }
|
||||
|
||||
func (rbs *readBadSeeker) Seek(int64, int) (int64, error) { return 0, fmt.Errorf("illegal seek") }
|
||||
|
||||
// TestReadTruncation tests the ending condition on various truncated files and
|
||||
// TestReadTruncation test the ending condition on various truncated files and
|
||||
// that truncated files are still detected even if the underlying io.Reader
|
||||
// satisfies io.Seeker.
|
||||
func TestReadTruncation(t *testing.T) {
|
||||
|
||||
@@ -19,7 +19,7 @@ func init() {
|
||||
sysStat = statUnix
|
||||
}
|
||||
|
||||
// userMap and groupMap cache UID and GID lookups for performance reasons.
|
||||
// userMap and groupMap caches UID and GID lookups for performance reasons.
|
||||
// The downside is that renaming uname or gname by the OS never takes effect.
|
||||
var userMap, groupMap sync.Map // map[int]string
|
||||
|
||||
|
||||
@@ -213,17 +213,15 @@ func parsePAXTime(s string) (time.Time, error) {
|
||||
}
|
||||
|
||||
// Parse the nanoseconds.
|
||||
// Initialize an array with '0's to handle right padding automatically.
|
||||
nanoDigits := [maxNanoSecondDigits]byte{'0', '0', '0', '0', '0', '0', '0', '0', '0'}
|
||||
for i := range len(sn) {
|
||||
switch c := sn[i]; {
|
||||
case c < '0' || c > '9':
|
||||
return time.Time{}, ErrHeader
|
||||
case i < len(nanoDigits):
|
||||
nanoDigits[i] = c
|
||||
}
|
||||
if strings.Trim(sn, "0123456789") != "" {
|
||||
return time.Time{}, ErrHeader
|
||||
}
|
||||
nsecs, _ := strconv.ParseInt(string(nanoDigits[:]), 10, 64) // Must succeed after validation
|
||||
if len(sn) < maxNanoSecondDigits {
|
||||
sn += strings.Repeat("0", maxNanoSecondDigits-len(sn)) // Right pad
|
||||
} else {
|
||||
sn = sn[:maxNanoSecondDigits] // Right truncate
|
||||
}
|
||||
nsecs, _ := strconv.ParseInt(sn, 10, 64) // Must succeed
|
||||
if len(ss) > 0 && ss[0] == '-' {
|
||||
return time.Unix(secs, -1*nsecs), nil // Negative correction
|
||||
}
|
||||
@@ -312,7 +310,7 @@ func formatPAXRecord(k, v string) (string, error) {
|
||||
// "%d %s=%s\n" % (size, key, value)
|
||||
//
|
||||
// Keys and values should be UTF-8, but the number of bad writers out there
|
||||
// forces us to be more liberal.
|
||||
// forces us to be a more liberal.
|
||||
// Thus, we only reject all keys with NUL, and only reject NULs in values
|
||||
// for the PAX version of the USTAR string fields.
|
||||
// The key must not contain an '=' character.
|
||||
|
||||
@@ -439,66 +439,3 @@ func TestFormatPAXRecord(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParsePAXTime(b *testing.B) {
|
||||
tests := []struct {
|
||||
name string
|
||||
in string
|
||||
want time.Time
|
||||
ok bool
|
||||
}{
|
||||
{
|
||||
name: "NoNanos",
|
||||
in: "123456",
|
||||
want: time.Unix(123456, 0),
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
name: "ExactNanos",
|
||||
in: "1.123456789",
|
||||
want: time.Unix(1, 123456789),
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
name: "WithNanoPadding",
|
||||
in: "1.123",
|
||||
want: time.Unix(1, 123000000),
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
name: "WithNanoTruncate",
|
||||
in: "1.123456789123",
|
||||
want: time.Unix(1, 123456789),
|
||||
ok: true,
|
||||
},
|
||||
{
|
||||
name: "TrailingError",
|
||||
in: "1.123abc",
|
||||
want: time.Time{},
|
||||
ok: false,
|
||||
},
|
||||
{
|
||||
name: "LeadingError",
|
||||
in: "1.abc123",
|
||||
want: time.Time{},
|
||||
ok: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
b.Run(tt.name, func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for b.Loop() {
|
||||
ts, err := parsePAXTime(tt.in)
|
||||
if (err == nil) != tt.ok {
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.Fatal("expected error")
|
||||
}
|
||||
if !ts.Equal(tt.want) {
|
||||
b.Fatalf("time mismatch: got %v, want %v", ts, tt.want)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/archive/tar/testdata/gnu-sparse-big.tar
vendored
Normal file
BIN
src/archive/tar/testdata/gnu-sparse-big.tar
vendored
Normal file
Binary file not shown.
@@ -1,90 +0,0 @@
|
||||
Z251LXNwYXJzZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAAMDA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
Binary file not shown.
BIN
src/archive/tar/testdata/neg-size.tar
vendored
Normal file
BIN
src/archive/tar/testdata/neg-size.tar
vendored
Normal file
Binary file not shown.
9
src/archive/tar/testdata/neg-size.tar.base64
vendored
9
src/archive/tar/testdata/neg-size.tar.base64
vendored
@@ -1,9 +0,0 @@
|
||||
EwMwMBMDLTgyMTk1MDI5NnQTE4NzfINzEzAwcXfhZrsDMDAwAAAAEDAxMRNz9DEwMTAwdBMTg3N8
|
||||
g3NzADATc3yDc3P0eFMTc/QxMDEwMHQTE4NzfINzc/QwE3N8g3Nz9HFTMNR0MBMwMHEw9DAAAAAQ
|
||||
MDGAABAwMTETc/QxMDH0MHQTMDBx1OFmuwMAAAD/gICAADExNTYyMQAgMBP///+AMTAwdHhTMDB0
|
||||
MBMwMHF3MDEwMTAwdBMTg3N8g3Nz9HhTMDB0MBMwMHF34Wa7AzAwMAAAABAwMTETc/QxMDEwMHQT
|
||||
E4NzfINzc/QwE3N8g3Nz9HhTE3P0MTAxMDB0ExODc3yDc3MwMBNzfINzczB4UzAwdDATMDBxMDAA
|
||||
gAAAEDAxc/QxMDEwMHQTAAAAIOFmuwMwNAAAABAwMTET////gDEwMHR4UzAwdDATMDBxd+FmuwMw
|
||||
MDAAAAAQMDExE3ODc3P0eFMTc/QxMDEwMHQTE4NzfINzc/QzMTEwMzM2MjQ4NDYxMjgzODBzfINz
|
||||
c/R4UzAwdDATMDBxMDAwAAAAEDAxAAAQMDExE3P0MTAxMDB0EzAwcdThZrsDMDQAAAAQg3N8g3Nz
|
||||
9DATc3yDc3P0eFMwMHQwEzAwcTAwMAAAABAwMQAAEDAxMRNz9DEwMTAwdBMwMHgw4Wa7AwAAEDA=
|
||||
BIN
src/archive/tar/testdata/pax-sparse-big.tar
vendored
Normal file
BIN
src/archive/tar/testdata/pax-sparse-big.tar
vendored
Normal file
Binary file not sh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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
BIN
src/archive/tar/testdata/writer-big-long.tar
vendored
Normal file
BIN
src/archive/tar/testdata/writer-big-long.tar
vendored
Normal file
Binary file not shown.
@@ -1,27 +0,0 @@
|
||||
bG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9u
|
||||
Z25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbG9uZ25hbWUvbDAwMDAwMDAAMDAwMDA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||||
"bytes"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"internal/obscuretestdata"
|
||||
"io"
|
||||
"io/fs"
|
||||
"maps"
|
||||
@@ -75,9 +74,8 @@ func TestWriter(t *testing.T) {
|
||||
)
|
||||
|
||||
vectors := []struct {
|
||||
file string // Optional filename of expected output
|
||||
obscured bool // Whether file is obscured
|
||||
tests []testFnc
|
||||
file string // Optional filename of expected output
|
||||
tests []testFnc
|
||||
}{{
|
||||
// The writer test file was produced with this command:
|
||||
// tar (GNU tar) 1.26
|
||||
@@ -153,8 +151,7 @@ func TestWriter(t *testing.T) {
|
||||
// bsdtar -xvf writer-big-long.tar
|
||||
//
|
||||
// This file is in PAX format.
|
||||
file: "testdata/writer-big-long.tar.base64",
|
||||
obscured: true,
|
||||
file: "testdata/writer-big-long.tar",
|
||||
tests: []testFnc{
|
||||
testHeader{Header{
|
||||
Typeflag: TypeReg,
|
||||
@@ -396,8 +393,7 @@ func TestWriter(t *testing.T) {
|
||||
testClose{},
|
||||
},
|
||||
}, {
|
||||
file: "testdata/gnu-sparse-big.tar.base64",
|
||||
obscured: true,
|
||||
file: "testdata/gnu-sparse-big.tar",
|
||||
tests: []testFnc{
|
||||
testHeader{Header{
|
||||
Typeflag: TypeGNUSparse,
|
||||
@@ -429,8 +425,7 @@ func TestWriter(t *testing.T) {
|
||||
testClose{nil},
|
||||
},
|
||||
}, {
|
||||
file: "testdata/pax-sparse-big.tar.base64",
|
||||
obscured: true,
|
||||
file: "testdata/pax-sparse-big.tar",
|
||||
tests: []testFnc{
|
||||
testHeader{Header{
|
||||
Typeflag: TypeReg,
|
||||
@@ -488,7 +483,7 @@ func TestWriter(t *testing.T) {
|
||||
return x == y
|
||||
}
|
||||
for _, v := range vectors {
|
||||
t.Run(strings.TrimSuffix(path.Base(v.file), ".base64"), func(t *testing.T) {
|
||||
t.Run(path.Base(v.file), func(t *testing.T) {
|
||||
const maxSize = 10 << 10 // 10KiB
|
||||
buf := new(bytes.Buffer)
|
||||
tw := NewWriter(iotest.TruncateWriter(buf, maxSize))
|
||||
@@ -527,16 +522,7 @@ func TestWriter(t *testing.T) {
|
||||
}
|
||||
|
||||
if v.file != "" {
|
||||
path := v.file
|
||||
if v.obscured {
|
||||
tf, err := obscuretestdata.DecodeToTempFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("obscuretestdata.DecodeToTempFile(%s): %v", path, err)
|
||||
}
|
||||
path = tf
|
||||
}
|
||||
|
||||
want, err := os.ReadFile(path)
|
||||
want, err := os.ReadFile(v.file)
|
||||
if err != nil {
|
||||
t.Fatalf("ReadFile() = %v, want nil", err)
|
||||
}
|
||||
|
||||
@@ -1213,6 +1213,7 @@ func TestFS(t *testing.T) {
|
||||
[]string{"a/b/c"},
|
||||
},
|
||||
} {
|
||||
test := test
|
||||
t.Run(test.file, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
z, err := OpenReader(test.file)
|
||||
@@ -1246,6 +1247,7 @@ func TestFSWalk(t *testing.T) {
|
||||
wantErr: true,
|
||||
},
|
||||
} {
|
||||
test := test
|
||||
t.Run(test.file, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
z, err := OpenReader(test.file)
|
||||
|
||||
@@ -311,7 +311,10 @@ func (b *Reader) ReadRune() (r rune, size int, err error) {
|
||||
if b.r == b.w {
|
||||
return 0, 0, b.readErr()
|
||||
}
|
||||
r, size = utf8.DecodeRune(b.buf[b.r:b.w])
|
||||
r, size = rune(b.buf[b.r]), 1
|
||||
if r >= utf8.RuneSelf {
|
||||
r, size = utf8.DecodeRune(b.buf[b.r:b.w])
|
||||
}
|
||||
b.r += size
|
||||
b.lastByte = int(b.buf[b.r-1])
|
||||
b.lastRuneSize = size
|
||||
|
||||
@@ -77,18 +77,6 @@ func (b *Buffer) String() string {
|
||||
return string(b.buf[b.off:])
|
||||
}
|
||||
|
||||
// Peek returns the next n bytes without advancing the buffer.
|
||||
// If Peek returns fewer than n bytes, it also returns [io.EOF].
|
||||
// The slice is only valid until the next call to a read or write method.
|
||||
// The slice aliases the buffer content at least until the next buffer modification,
|
||||
// so immediate changes to the slice will affect the result of future reads.
|
||||
func (b *Buffer) Peek(n int) ([]byte, error) {
|
||||
if b.Len() < n {
|
||||
return b.buf[b.off:], io.EOF
|
||||
}
|
||||
return b.buf[b.off : b.off+n], nil
|
||||
}
|
||||
|
||||
// empty reports whether the unread portion of the buffer is empty.
|
||||
func (b *Buffer) empty() bool { return len(b.buf) <= b.off }
|
||||
|
||||
|
||||
@@ -531,40 +531,6 @@ func TestReadString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
var peekTests = []struct {
|
||||
buffer string
|
||||
skip int
|
||||
n int
|
||||
expected string
|
||||
err error
|
||||
}{
|
||||
{"", 0, 0, "", nil},
|
||||
{"aaa", 0, 3, "aaa", nil},
|
||||
{"foobar", 0, 2, "fo", nil},
|
||||
{"a", 0, 2, "a", io.EOF},
|
||||
{"helloworld", 4, 3, "owo", nil},
|
||||
{"helloworld", 5, 5, "world", nil},
|
||||
{"helloworld", 5, 6, "world", io.EOF},
|
||||
{"helloworld", 10, 1, "", io.EOF},
|
||||
}
|
||||
|
||||
func TestPeek(t *testing.T) {
|
||||
for _, test := range peekTests {
|
||||
buf := NewBufferString(test.buffer)
|
||||
buf.Next(test.skip)
|
||||
bytes, err := buf.Peek(test.n)
|
||||
if string(bytes) != test.expected {
|
||||
t.Errorf("expected %q, got %q", test.expected, bytes)
|
||||
}
|
||||
if err != test.err {
|
||||
t.Errorf("expected error %v, got %v", test.err, err)
|
||||
}
|
||||
if buf.Len() != len(test.buffer)-test.skip {
|
||||
t.Errorf("bad length after peek: %d, want %d", buf.Len(), len(test.buffer)-test.skip)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkReadString(b *testing.B) {
|
||||
const n = 32 << 10
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ func Fields(s []byte) [][]byte {
|
||||
// It splits the slice s at each run of code points c satisfying f(c) and
|
||||
// returns a slice of subslices of s. If all code points in s satisfy f(c), or
|
||||
// len(s) == 0, an empty slice is returned. Every element of the returned slice is
|
||||
// non-empty. Unlike [Split], leading and trailing runs of code points
|
||||
// non-empty. Unlike [SplitFunc], leading and trailing runs of code points
|
||||
// satisfying f(c) are discarded.
|
||||
//
|
||||
// FieldsFunc makes no guarantees about the order in which it calls f(c)
|
||||
@@ -528,7 +528,11 @@ func FieldsFunc(s []byte, f func(rune) bool) [][]byte {
|
||||
// more efficient, possibly due to cache effects.
|
||||
start := -1 // valid span start if >= 0
|
||||
for i := 0; i < len(s); {
|
||||
r, size := utf8.DecodeRune(s[i:])
|
||||
size := 1
|
||||
r := rune(s[i])
|
||||
if r >= utf8.RuneSelf {
|
||||
r, size = utf8.DecodeRune(s[i:])
|
||||
}
|
||||
if f(r) {
|
||||
if start >= 0 {
|
||||
spans = append(spans, span{start, i})
|
||||
@@ -610,7 +614,11 @@ func Map(mapping func(r rune) rune, s []byte) []byte {
|
||||
// fine. It could also shrink but that falls out naturally.
|
||||
b := make([]byte, 0, len(s))
|
||||
for i := 0; i < len(s); {
|
||||
r, wid := utf8.DecodeRune(s[i:])
|
||||
wid := 1
|
||||
r := rune(s[i])
|
||||
if r >= utf8.RuneSelf {
|
||||
r, wid = utf8.DecodeRune(s[i:])
|
||||
}
|
||||
r = mapping(r)
|
||||
if r >= 0 {
|
||||
b = utf8.AppendRune(b, r)
|
||||
@@ -909,7 +917,11 @@ func LastIndexFunc(s []byte, f func(r rune) bool) int {
|
||||
func indexFunc(s []byte, f func(r rune) bool, truth bool) int {
|
||||
start := 0
|
||||
for start < len(s) {
|
||||
r, wid := utf8.DecodeRune(s[start:])
|
||||
wid := 1
|
||||
r := rune(s[start])
|
||||
if r >= utf8.RuneSelf {
|
||||
r, wid = utf8.DecodeRune(s[start:])
|
||||
}
|
||||
if f(r) == truth {
|
||||
return start
|
||||
}
|
||||
@@ -1040,7 +1052,10 @@ func trimLeftASCII(s []byte, as *asciiSet) []byte {
|
||||
|
||||
func trimLeftUnicode(s []byte, cutset string) []byte {
|
||||
for len(s) > 0 {
|
||||
r, n := utf8.DecodeRune(s)
|
||||
r, n := rune(s[0]), 1
|
||||
if r >= utf8.RuneSelf {
|
||||
r, n = utf8.DecodeRune(s)
|
||||
}
|
||||
if !containsRune(cutset, r) {
|
||||
break
|
||||
}
|
||||
@@ -1102,34 +1117,41 @@ func trimRightUnicode(s []byte, cutset string) []byte {
|
||||
// TrimSpace returns a subslice of s by slicing off all leading and
|
||||
// trailing white space, as defined by Unicode.
|
||||
func TrimSpace(s []byte) []byte {
|
||||
// Fast path for ASCII: look for the first ASCII non-space byte.
|
||||
for lo, c := range s {
|
||||
// Fast path for ASCII: look for the first ASCII non-space byte
|
||||
start := 0
|
||||
for ; start < len(s); start++ {
|
||||
c := s[start]
|
||||
if c >= utf8.RuneSelf {
|
||||
// If we run into a non-ASCII byte, fall back to the
|
||||
// slower unicode-aware method on the remaining bytes.
|
||||
return TrimFunc(s[lo:], unicode.IsSpace)
|
||||
// slower unicode-aware method on the remaining bytes
|
||||
return TrimFunc(s[start:], unicode.IsSpace)
|
||||
}
|
||||
if asciiSpace[c] != 0 {
|
||||
continue
|
||||
}
|
||||
s = s[lo:]
|
||||
// Now look for the first ASCII non-space byte from the end.
|
||||
for hi := len(s) - 1; hi >= 0; hi-- {
|
||||
c := s[hi]
|
||||
if c >= utf8.RuneSelf {
|
||||
return TrimFunc(s[:hi+1], unicode.IsSpace)
|
||||
}
|
||||
if asciiSpace[c] == 0 {
|
||||
// At this point, s[:hi+1] starts and ends with ASCII
|
||||
// non-space bytes, so we're done. Non-ASCII cases have
|
||||
// already been handled above.
|
||||
return s[:hi+1]
|
||||
}
|
||||
if asciiSpace[c] == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
// Special case to preserve previous TrimLeftFunc behavior,
|
||||
// returning nil instead of empty slice if all spaces.
|
||||
return nil
|
||||
|
||||
// Now look for the first ASCII non-space byte from the end
|
||||
stop := len(s)
|
||||
for ; stop > start; stop-- {
|
||||
c := s[stop-1]
|
||||
if c >= utf8.RuneSelf {
|
||||
return TrimFunc(s[start:stop], unicode.IsSpace)
|
||||
}
|
||||
if asciiSpace[c] == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// At this point s[start:stop] starts and ends with an ASCII
|
||||
// non-space bytes, so we're done. Non-ASCII cases have already
|
||||
// been handled above.
|
||||
if start == stop {
|
||||
// Special case to preserve previous TrimLeftFunc behavior,
|
||||
// returning nil instead of empty slice if all spaces.
|
||||
return nil
|
||||
}
|
||||
return s[start:stop]
|
||||
}
|
||||
|
||||
// Runes interprets s as a sequence of UTF-8-encoded code points.
|
||||
@@ -1236,10 +1258,19 @@ hasUnicode:
|
||||
t = t[i:]
|
||||
for len(s) != 0 && len(t) != 0 {
|
||||
// Extract first rune from each.
|
||||
sr, size := utf8.DecodeRune(s)
|
||||
s = s[size:]
|
||||
tr, size := utf8.DecodeRune(t)
|
||||
t = t[size:]
|
||||
var sr, tr rune
|
||||
if s[0] < utf8.RuneSelf {
|
||||
sr, s = rune(s[0]), s[1:]
|
||||
} else {
|
||||
r, size := utf8.DecodeRune(s)
|
||||
sr, s = r, s[size:]
|
||||
}
|
||||
if t[0] < utf8.RuneSelf {
|
||||
tr, t = rune(t[0]), t[1:]
|
||||
} else {
|
||||
r, size := utf8.DecodeRune(t)
|
||||
tr, t = r, t[size:]
|
||||
}
|
||||
|
||||
// If they match, keep going; if not, return false.
|
||||
|
||||
|
||||
@@ -693,14 +693,14 @@ func bmIndexRuneUnicode(rt *unicode.RangeTable, needle rune) func(b *testing.B,
|
||||
for _, r16 := range rt.R16 {
|
||||
for r := rune(r16.Lo); r <= rune(r16.Hi); r += rune(r16.Stride) {
|
||||
if r != needle {
|
||||
rs = append(rs, r)
|
||||
rs = append(rs, rune(r))
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, r32 := range rt.R32 {
|
||||
for r := rune(r32.Lo); r <= rune(r32.Hi); r += rune(r32.Stride) {
|
||||
if r != needle {
|
||||
rs = append(rs, r)
|
||||
rs = append(rs, rune(r))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -891,7 +891,9 @@ func BenchmarkCountSingle(b *testing.B) {
|
||||
b.Fatal("bad count", j, expect)
|
||||
}
|
||||
}
|
||||
clear(buf)
|
||||
for i := 0; i < len(buf); i++ {
|
||||
buf[i] = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -961,7 +963,7 @@ func TestSplit(t *testing.T) {
|
||||
if tt.n < 0 {
|
||||
b := sliceOfString(Split([]byte(tt.s), []byte(tt.sep)))
|
||||
if !slices.Equal(result, b) {
|
||||
t.Errorf("Split disagrees with SplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a)
|
||||
t.Errorf("Split disagrees withSplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a)
|
||||
}
|
||||
}
|
||||
if len(a) > 0 {
|
||||
@@ -1023,7 +1025,7 @@ func TestSplitAfter(t *testing.T) {
|
||||
if tt.n < 0 {
|
||||
b := sliceOfString(SplitAfter([]byte(tt.s), []byte(tt.sep)))
|
||||
if !slices.Equal(result, b) {
|
||||
t.Errorf("SplitAfter disagrees with SplitAfterN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a)
|
||||
t.Errorf("SplitAfter disagrees withSplitAfterN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1224,7 +1226,7 @@ func TestMap(t *testing.T) {
|
||||
// Run a couple of awful growth/shrinkage tests
|
||||
a := tenRunes('a')
|
||||
|
||||
// 1. Grow. This triggers two reallocations in Map.
|
||||
// 1. Grow. This triggers two reallocations in Map.
|
||||
maxRune := func(r rune) rune { return unicode.MaxRune }
|
||||
m := Map(maxRune, []byte(a))
|
||||
expect := tenRunes(unicode.MaxRune)
|
||||
|
||||
@@ -117,7 +117,11 @@ func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte] {
|
||||
return func(yield func([]byte) bool) {
|
||||
start := -1
|
||||
for i := 0; i < len(s); {
|
||||
r, size := utf8.DecodeRune(s[i:])
|
||||
size := 1
|
||||
r := rune(s[i])
|
||||
if r >= utf8.RuneSelf {
|
||||
r, size = utf8.DecodeRune(s[i:])
|
||||
}
|
||||
if f(r) {
|
||||
if start >= 0 {
|
||||
if !yield(s[start:i:i]) {
|
||||
|
||||
12
src/cmd/api/testdata/src/pkg/p1/golden.txt
vendored
12
src/cmd/api/testdata/src/pkg/p1/golden.txt
vendored
@@ -1,6 +1,6 @@
|
||||
pkg p1, const A //deprecated
|
||||
pkg p1, const A = 1
|
||||
pkg p1, const A ideal-int
|
||||
pkg p1, const A //deprecated
|
||||
pkg p1, const A64 = 1
|
||||
pkg p1, const A64 int64
|
||||
pkg p1, const AIsLowerA = 11
|
||||
@@ -25,8 +25,8 @@ pkg p1, func TakesFunc(func(int) int)
|
||||
pkg p1, method (*B) JustOnB()
|
||||
pkg p1, method (*B) OnBothTandBPtr()
|
||||
pkg p1, method (*Embedded) OnEmbedded()
|
||||
pkg p1, method (*S2) SMethod //deprecated
|
||||
pkg p1, method (*S2) SMethod(int8, int16, int64)
|
||||
pkg p1, method (*S2) SMethod //deprecated
|
||||
pkg p1, method (*T) JustOnT()
|
||||
pkg p1, method (*T) OnBothTandBPtr()
|
||||
pkg p1, method (B) OnBothTandBVal()
|
||||
@@ -53,8 +53,8 @@ pkg p1, type Error interface { Error, Temporary }
|
||||
pkg p1, type Error interface, Error() string
|
||||
pkg p1, type Error interface, Temporary() bool
|
||||
pkg p1, type FuncType func(int, int, string) (*B, error)
|
||||
pkg p1, type I interface, Get //deprecated
|
||||
pkg p1, type I interface, Get(string) int64
|
||||
pkg p1, type I interface, Get //deprecated
|
||||
pkg p1, type I interface, GetNamed(string) int64
|
||||
pkg p1, type I interface, Name() string
|
||||
pkg p1, type I interface, PackageTwoMeth()
|
||||
@@ -63,9 +63,9 @@ pkg p1, type I interface, unexported methods
|
||||
pkg p1, type MyInt int
|
||||
pkg p1, type Namer interface { Name }
|
||||
pkg p1, type Namer interface, Name() string
|
||||
pkg p1, type Private //deprecated
|
||||
pkg p1, type Private interface, X()
|
||||
pkg p1, type Private interface, unexported methods
|
||||
pkg p1, type Private //deprecated
|
||||
pkg p1, type Public interface { X, Y }
|
||||
pkg p1, type Public interface, X()
|
||||
pkg p1, type Public interface, Y()
|
||||
@@ -84,8 +84,8 @@ pkg p1, type TPtrExported struct
|
||||
pkg p1, type TPtrExported struct, embedded *Embedded
|
||||
pkg p1, type TPtrUnexported struct
|
||||
pkg p1, type Time struct
|
||||
pkg p1, type URL //deprecated
|
||||
pkg p1, type URL struct
|
||||
pkg p1, type URL //deprecated
|
||||
pkg p1, var Byte uint8
|
||||
pkg p1, var ByteConv []uint8
|
||||
pkg p1, var ByteFunc func(uint8) int32
|
||||
@@ -97,8 +97,8 @@ pkg p1, var StrConv string
|
||||
pkg p1, var V string
|
||||
pkg p1, var V1 uint64
|
||||
pkg p1, var V2 p2.Twoer
|
||||
pkg p1, var VError //deprecated
|
||||
pkg p1, var VError Error
|
||||
pkg p1, var VError //deprecated
|
||||
pkg p1, var X I
|
||||
pkg p1, var X0 int64
|
||||
pkg p1, var Y int
|
||||
|
||||
5
src/cmd/api/testdata/src/pkg/p2/golden.txt
vendored
5
src/cmd/api/testdata/src/pkg/p2/golden.txt
vendored
@@ -1,7 +1,8 @@
|
||||
pkg p2, func F //deprecated
|
||||
pkg p2, func F() string
|
||||
pkg p2, func F //deprecated
|
||||
pkg p2, func G() Twoer
|
||||
pkg p2, func NewError(string) error
|
||||
pkg p2, type Twoer interface { PackageTwoMeth }
|
||||
pkg p2, type Twoer interface, PackageTwoMeth //deprecated
|
||||
pkg p2, type Twoer interface, PackageTwoMeth()
|
||||
pkg p2, type Twoer interface, PackageTwoMeth //deprecated
|
||||
|
||||
|
||||
6
src/cmd/api/testdata/src/pkg/p4/golden.txt
vendored
6
src/cmd/api/testdata/src/pkg/p4/golden.txt
vendored
@@ -1,6 +1,6 @@
|
||||
pkg p4, func Clone //deprecated
|
||||
pkg p4, func Clone[$0 interface{ ~[]$1 }, $1 interface{}]($0) $0
|
||||
pkg p4, func NewPair[$0 interface{ M }, $1 interface{ ~int }]($0, $1) Pair[$0, $1]
|
||||
pkg p4, method (Pair[$0, $1]) First() $0
|
||||
pkg p4, method (Pair[$0, $1]) Second() $1
|
||||
pkg p4, method (Pair[$0, $1]) First() $0
|
||||
pkg p4, type Pair[$0 interface{ M }, $1 interface{ ~int }] struct
|
||||
pkg p4, func Clone[$0 interface{ ~[]$1 }, $1 interface{}]($0) $0
|
||||
pkg p4, func Clone //deprecated
|
||||
|
||||
@@ -92,8 +92,7 @@ func jumpX86(word string) bool {
|
||||
func jumpRISCV(word string) bool {
|
||||
switch word {
|
||||
case "BEQ", "BEQZ", "BGE", "BGEU", "BGEZ", "BGT", "BGTU", "BGTZ", "BLE", "BLEU", "BLEZ",
|
||||
"BLT", "BLTU", "BLTZ", "BNE", "BNEZ", "CALL", "CBEQZ", "CBNEZ", "CJ", "CJALR", "CJR",
|
||||
"JAL", "JALR", "JMP":
|
||||
"BLT", "BLTU", "BLTZ", "BNE", "BNEZ", "CALL", "JAL", "JALR", "JMP":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -195,6 +195,149 @@ func ARM64RegisterShift(reg, op, count int16) (int64, error) {
|
||||
return int64(reg&31)<<16 | int64(op)<<22 | int64(uint16(count)), nil
|
||||
}
|
||||
|
||||
// ARM64RegisterExtension constructs an ARM64 register with extension or arrangement.
|
||||
func ARM64RegisterExtension(a *obj.Addr, ext string, reg, num int16, isAmount, isIndex bool) error {
|
||||
Rnum := (reg & 31) + int16(num<<5)
|
||||
if isAmount {
|
||||
if num < 0 || num > 7 {
|
||||
return errors.New("index shift amount is out of range")
|
||||
}
|
||||
}
|
||||
if reg <= arm64.REG_R31 && reg >= arm64.REG_R0 {
|
||||
if !isAmount {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
switch ext {
|
||||
case "UXTB":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
return errors.New("invalid shift for the register offset addressing mode")
|
||||
}
|
||||
a.Reg = arm64.REG_UXTB + Rnum
|
||||
case "UXTH":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
return errors.New("invalid shift for the register offset addressing mode")
|
||||
}
|
||||
a.Reg = arm64.REG_UXTH + Rnum
|
||||
case "UXTW":
|
||||
// effective address of memory is a base register value and an offset register value.
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
a.Index = arm64.REG_UXTW + Rnum
|
||||
} else {
|
||||
a.Reg = arm64.REG_UXTW + Rnum
|
||||
}
|
||||
case "UXTX":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
return errors.New("invalid shift for the register offset addressing mode")
|
||||
}
|
||||
a.Reg = arm64.REG_UXTX + Rnum
|
||||
case "SXTB":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
return errors.New("invalid shift for the register offset addressing mode")
|
||||
}
|
||||
a.Reg = arm64.REG_SXTB + Rnum
|
||||
case "SXTH":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
return errors.New("invalid shift for the register offset addressing mode")
|
||||
}
|
||||
a.Reg = arm64.REG_SXTH + Rnum
|
||||
case "SXTW":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
a.Index = arm64.REG_SXTW + Rnum
|
||||
} else {
|
||||
a.Reg = arm64.REG_SXTW + Rnum
|
||||
}
|
||||
case "SXTX":
|
||||
if a.Type == obj.TYPE_MEM {
|
||||
a.Index = arm64.REG_SXTX + Rnum
|
||||
} else {
|
||||
a.Reg = arm64.REG_SXTX + Rnum
|
||||
}
|
||||
case "LSL":
|
||||
a.Index = arm64.REG_LSL + Rnum
|
||||
default:
|
||||
return errors.New("unsupported general register extension type: " + ext)
|
||||
|
||||
}
|
||||
} else if reg <= arm64.REG_V31 && reg >= arm64.REG_V0 {
|
||||
switch ext {
|
||||
case "B8":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_8B & 15) << 5)
|
||||
case "B16":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_16B & 15) << 5)
|
||||
case "H4":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_4H & 15) << 5)
|
||||
case "H8":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_8H & 15) << 5)
|
||||
case "S2":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_2S & 15) << 5)
|
||||
case "S4":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_4S & 15) << 5)
|
||||
case "D1":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_1D & 15) << 5)
|
||||
case "D2":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_2D & 15) << 5)
|
||||
case "Q1":
|
||||
if isIndex {
|
||||
return errors.New("invalid register extension")
|
||||
}
|
||||
a.Reg = arm64.REG_ARNG + (reg & 31) + ((arm64.ARNG_1Q & 15) << 5)
|
||||
case "B":
|
||||
if !isIndex {
|
||||
return nil
|
||||
}
|
||||
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_B & 15) << 5)
|
||||
a.Index = num
|
||||
case "H":
|
||||
if !isIndex {
|
||||
return nil
|
||||
}
|
||||
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_H & 15) << 5)
|
||||
a.Index = num
|
||||
case "S":
|
||||
if !isIndex {
|
||||
return nil
|
||||
}
|
||||
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_S & 15) << 5)
|
||||
a.Index = num
|
||||
case "D":
|
||||
if !isIndex {
|
||||
return nil
|
||||
}
|
||||
a.Reg = arm64.REG_ELEM + (reg & 31) + ((arm64.ARNG_D & 15) << 5)
|
||||
a.Index = num
|
||||
default:
|
||||
return errors.New("unsupported simd register extension type: " + ext)
|
||||
}
|
||||
} else {
|
||||
return errors.New("invalid register and extension combination")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ARM64RegisterArrangement constructs an ARM64 vector register arrangement.
|
||||
func ARM64RegisterArrangement(reg int16, name, arng string) (int64, error) {
|
||||
var curQ, curSize uint16
|
||||
|
||||
@@ -23,6 +23,18 @@ func jumpLoong64(word string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsLoong64MUL reports whether the op (as defined by an loong64.A* constant) is
|
||||
// one of the MUL/DIV/REM instructions that require special handling.
|
||||
func IsLoong64MUL(op obj.As) bool {
|
||||
switch op {
|
||||
case loong64.AMUL, loong64.AMULU, loong64.AMULV, loong64.AMULVU,
|
||||
loong64.ADIV, loong64.ADIVU, loong64.ADIVV, loong64.ADIVVU,
|
||||
loong64.AREM, loong64.AREMU, loong64.AREMV, loong64.AREMVU:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsLoong64RDTIME reports whether the op (as defined by an loong64.A*
|
||||
// constant) is one of the RDTIMELW/RDTIMEHW/RDTIMED instructions that
|
||||
// require special handling.
|
||||
|
||||
@@ -11,7 +11,6 @@ package arch
|
||||
import (
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/obj/riscv"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// IsRISCV64AMO reports whether op is an AMO instruction that requires
|
||||
@@ -33,20 +32,6 @@ func IsRISCV64VTypeI(op obj.As) bool {
|
||||
return op == riscv.AVSETVLI || op == riscv.AVSETIVLI
|
||||
}
|
||||
|
||||
// IsRISCV64CSRO reports whether the op is an instruction that uses
|
||||
// CSR symbolic names and whether that instruction expects a register
|
||||
// or an immediate source operand.
|
||||
func IsRISCV64CSRO(op obj.As) (imm bool, ok bool) {
|
||||
switch op {
|
||||
case riscv.ACSRRCI, riscv.ACSRRSI, riscv.ACSRRWI:
|
||||
imm = true
|
||||
fallthrough
|
||||
case riscv.ACSRRC, riscv.ACSRRS, riscv.ACSRRW:
|
||||
ok = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var riscv64SpecialOperand map[string]riscv.SpecialOperand
|
||||
|
||||
// RISCV64SpecialOperand returns the internal representation of a special operand.
|
||||
@@ -54,21 +39,9 @@ func RISCV64SpecialOperand(name string) riscv.SpecialOperand {
|
||||
if riscv64SpecialOperand == nil {
|
||||
// Generate mapping when function is first called.
|
||||
riscv64SpecialOperand = map[string]riscv.SpecialOperand{}
|
||||
for opd := riscv.SPOP_RVV_BEGIN; opd < riscv.SPOP_RVV_END; opd++ {
|
||||
for opd := riscv.SPOP_BEGIN; opd < riscv.SPOP_END; opd++ {
|
||||
riscv64SpecialOperand[opd.String()] = opd
|
||||
}
|
||||
// Add the CSRs
|
||||
for csrCode, csrName := range riscv.CSRs {
|
||||
// The set of RVV special operand names and the set of CSR special operands
|
||||
// names are disjoint and so can safely share a single namespace. However,
|
||||
// it's possible that a future update to the CSRs in inst.go could introduce
|
||||
// a conflict. This check ensures that such a conflict does not go
|
||||
// unnoticed.
|
||||
if _, ok := riscv64SpecialOperand[csrName]; ok {
|
||||
panic(fmt.Sprintf("riscv64 special operand %q redefined", csrName))
|
||||
}
|
||||
riscv64SpecialOperand[csrName] = riscv.SpecialOperand(int(csrCode) + int(riscv.SPOP_CSR_BEGIN))
|
||||
}
|
||||
}
|
||||
if opd, ok := riscv64SpecialOperand[name]; ok {
|
||||
return opd
|
||||
|
||||
@@ -248,7 +248,7 @@ func (p *Parser) asmData(operands [][]lex.Token) {
|
||||
case obj.TYPE_CONST:
|
||||
switch sz {
|
||||
case 1, 2, 4, 8:
|
||||
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, sz, valueAddr.Offset)
|
||||
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Offset)
|
||||
default:
|
||||
p.errorf("bad int size for DATA argument: %d", sz)
|
||||
}
|
||||
@@ -262,10 +262,10 @@ func (p *Parser) asmData(operands [][]lex.Token) {
|
||||
p.errorf("bad float size for DATA argument: %d", sz)
|
||||
}
|
||||
case obj.TYPE_SCONST:
|
||||
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, sz, valueAddr.Val.(string))
|
||||
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Val.(string))
|
||||
case obj.TYPE_ADDR:
|
||||
if sz == p.arch.PtrSize {
|
||||
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, sz, valueAddr.Sym, valueAddr.Offset)
|
||||
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Sym, valueAddr.Offset)
|
||||
} else {
|
||||
p.errorf("bad addr size for DATA argument: %d", sz)
|
||||
}
|
||||
@@ -782,21 +782,6 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) {
|
||||
prog.RegTo2 = a[2].Reg
|
||||
break
|
||||
}
|
||||
// RISCV64 instructions that reference CSRs with symbolic names.
|
||||
if isImm, ok := arch.IsRISCV64CSRO(op); ok {
|
||||
if a[0].Type != obj.TYPE_CONST && isImm {
|
||||
p.errorf("invalid value for first operand to %s instruction, must be a 5 bit unsigned immediate", op)
|
||||
return
|
||||
}
|
||||
if a[1].Type != obj.TYPE_SPECIAL {
|
||||
p.errorf("invalid value for second operand to %s instruction, must be a CSR name", op)
|
||||
return
|
||||
}
|
||||
prog.AddRestSourceArgs([]obj.Addr{a[1]})
|
||||
prog.From = a[0]
|
||||
prog.To = a[2]
|
||||
break
|
||||
}
|
||||
prog.From = a[0]
|
||||
prog.Reg = p.getRegister(prog, op, &a[1])
|
||||
prog.To = a[2]
|
||||
@@ -989,6 +974,14 @@ func (p *Parser) getConstant(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
|
||||
return addr.Offset
|
||||
}
|
||||
|
||||
// getImmediate checks that addr represents an immediate constant and returns its value.
|
||||
func (p *Parser) getImmediate(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
|
||||
if addr.Type != obj.TYPE_CONST || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {
|
||||
p.errorf("%s: expected immediate constant; found %s", op, obj.Dconv(prog, addr))
|
||||
}
|
||||
return addr.Offset
|
||||
}
|
||||
|
||||
// getRegister checks that addr represents a register and returns its value.
|
||||
func (p *Parser) getRegister(prog *obj.Prog, op obj.As, addr *obj.Addr) int16 {
|
||||
if addr.Type != obj.TYPE_REG || addr.Offset != 0 || addr.Name != 0 || addr.Index != 0 {
|
||||
|
||||
@@ -38,7 +38,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
|
||||
ctxt.IsAsm = true
|
||||
defer ctxt.Bso.Flush()
|
||||
failed := false
|
||||
ctxt.DiagFunc = func(format string, args ...any) {
|
||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
||||
failed = true
|
||||
t.Errorf(format, args...)
|
||||
}
|
||||
@@ -193,17 +193,12 @@ Diff:
|
||||
top := pList.Firstpc
|
||||
var text *obj.LSym
|
||||
ok = true
|
||||
ctxt.DiagFunc = func(format string, args ...any) {
|
||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
||||
t.Errorf(format, args...)
|
||||
ok = false
|
||||
}
|
||||
obj.Flushplist(ctxt, pList, nil)
|
||||
|
||||
if !ok {
|
||||
// If we've encountered errors, the output is unlikely to be sane.
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
for p := top; p != nil; p = p.Link {
|
||||
if p.As == obj.ATEXT {
|
||||
text = p.From.Sym
|
||||
@@ -299,7 +294,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
|
||||
failed := false
|
||||
var errBuf bytes.Buffer
|
||||
parser.errorWriter = &errBuf
|
||||
ctxt.DiagFunc = func(format string, args ...any) {
|
||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
||||
failed = true
|
||||
s := fmt.Sprintf(format, args...)
|
||||
if !strings.HasSuffix(s, "\n") {
|
||||
@@ -472,7 +467,6 @@ func TestLOONG64Encoder(t *testing.T) {
|
||||
testEndToEnd(t, "loong64", "loong64enc3")
|
||||
testEndToEnd(t, "loong64", "loong64enc4")
|
||||
testEndToEnd(t, "loong64", "loong64enc5")
|
||||
testEndToEnd(t, "loong64", "loong64enc6")
|
||||
testEndToEnd(t, "loong64", "loong64")
|
||||
}
|
||||
|
||||
@@ -491,35 +485,16 @@ func TestPPC64EndToEnd(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func testRISCV64AllProfiles(t *testing.T, testFn func(t *testing.T)) {
|
||||
t.Helper()
|
||||
|
||||
defer func(orig int) { buildcfg.GORISCV64 = orig }(buildcfg.GORISCV64)
|
||||
|
||||
for _, goriscv64 := range []int{20, 22, 23} {
|
||||
t.Run(fmt.Sprintf("rva%vu64", goriscv64), func(t *testing.T) {
|
||||
buildcfg.GORISCV64 = goriscv64
|
||||
testFn(t)
|
||||
})
|
||||
}
|
||||
func TestRISCVEndToEnd(t *testing.T) {
|
||||
testEndToEnd(t, "riscv64", "riscv64")
|
||||
}
|
||||
|
||||
func TestRISCV64EndToEnd(t *testing.T) {
|
||||
testRISCV64AllProfiles(t, func(t *testing.T) {
|
||||
testEndToEnd(t, "riscv64", "riscv64")
|
||||
})
|
||||
func TestRISCVErrors(t *testing.T) {
|
||||
testErrors(t, "riscv64", "riscv64error")
|
||||
}
|
||||
|
||||
func TestRISCV64Errors(t *testing.T) {
|
||||
testRISCV64AllProfiles(t, func(t *testing.T) {
|
||||
testErrors(t, "riscv64", "riscv64error")
|
||||
})
|
||||
}
|
||||
|
||||
func TestRISCV64Validation(t *testing.T) {
|
||||
testRISCV64AllProfiles(t, func(t *testing.T) {
|
||||
testErrors(t, "riscv64", "riscv64validation")
|
||||
})
|
||||
func TestRISCVValidation(t *testing.T) {
|
||||
testErrors(t, "riscv64", "riscv64validation")
|
||||
}
|
||||
|
||||
func TestS390XEndToEnd(t *testing.T) {
|
||||
|
||||
@@ -78,7 +78,7 @@ func NewParser(ctxt *obj.Link, ar *arch.Arch, lexer lex.TokenReader) *Parser {
|
||||
// and turn it into a recoverable panic.
|
||||
var panicOnError bool
|
||||
|
||||
func (p *Parser) errorf(format string, args ...any) {
|
||||
func (p *Parser) errorf(format string, args ...interface{}) {
|
||||
if panicOnError {
|
||||
panic(fmt.Errorf(format, args...))
|
||||
}
|
||||
@@ -90,7 +90,7 @@ func (p *Parser) errorf(format string, args ...any) {
|
||||
if p.lex != nil {
|
||||
// Put file and line information on head of message.
|
||||
format = "%s:%d: " + format + "\n"
|
||||
args = append([]any{p.lex.File(), p.lineNum}, args...)
|
||||
args = append([]interface{}{p.lex.File(), p.lineNum}, args...)
|
||||
}
|
||||
fmt.Fprintf(p.errorWriter, format, args...)
|
||||
p.errorCount++
|
||||
@@ -775,7 +775,7 @@ func (p *Parser) registerExtension(a *obj.Addr, name string, prefix rune) {
|
||||
|
||||
switch p.arch.Family {
|
||||
case sys.ARM64:
|
||||
err := arm64.ARM64RegisterExtension(a, ext, reg, num, isAmount, isIndex)
|
||||
err := arch.ARM64RegisterExtension(a, ext, reg, num, isAmount, isIndex)
|
||||
if err != nil {
|
||||
p.errorf("%v", err)
|
||||
}
|
||||
|
||||
@@ -169,8 +169,3 @@ TEXT ·a34(SB), 0, $0-0
|
||||
SHLXQ AX, CX, R15
|
||||
ADDQ $1, R15
|
||||
RET
|
||||
|
||||
// Ensure from3 get GOT-rewritten without errors.
|
||||
TEXT ·a35(SB), 0, $0-0
|
||||
VGF2P8AFFINEQB $0, runtime·writeBarrier(SB), Z1, Z1
|
||||
RET
|
||||
|
||||
14
src/cmd/asm/internal/asm/testdata/arm64.s
vendored
14
src/cmd/asm/internal/asm/testdata/arm64.s
vendored
@@ -400,8 +400,6 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
|
||||
MOVD $0x11110000, R1 // MOVD $286326784, R1 // 2122a2d2
|
||||
MOVD $0xaaaa0000aaaa1111, R1 // MOVD $-6149102338357718767, R1 // 212282d24155b5f24155f5f2
|
||||
MOVD $0x1111ffff1111aaaa, R1 // MOVD $1230045644216969898, R1 // a1aa8a922122a2f22122e2f2
|
||||
MOVD $0xaaaaaaaaaaaaaaab, R1 // MOVD $-6148914691236517205, R1 // e1f301b2615595f2
|
||||
MOVD $0x0ff019940ff00ff0, R1 // MOVD $1148446028692721648, R1 // e19f0cb28132c3f2
|
||||
MOVD $0, R1 // e1031faa
|
||||
MOVD $-1, R1 // 01008092
|
||||
MOVD $0x210000, R0 // MOVD $2162688, R0 // 2004a0d2
|
||||
@@ -632,8 +630,6 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
|
||||
FMOVS F1, 0x44332211(R2) // FMOVS F1, 1144201745(R2)
|
||||
FMOVD F1, 0x1007000(R2) // FMOVD F1, 16805888(R2)
|
||||
FMOVD F1, 0x44332211(R2) // FMOVD F1, 1144201745(R2)
|
||||
FMOVQ F1, 0x1003000(R2) // FMOVQ F1, 16789504(R2)
|
||||
FMOVQ F1, 0x44332211(R2) // FMOVQ F1, 1144201745(R2)
|
||||
|
||||
MOVB 0x1000000(R1), R2 // MOVB 16777216(R1), R2
|
||||
MOVB 0x44332211(R1), R2 // MOVB 1144201745(R1), R2
|
||||
@@ -647,8 +643,6 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
|
||||
FMOVS 0x44332211(R1), F2 // FMOVS 1144201745(R1), F2
|
||||
FMOVD 0x1000000(R1), F2 // FMOVD 16777216(R1), F2
|
||||
FMOVD 0x44332211(R1), F2 // FMOVD 1144201745(R1), F2
|
||||
FMOVQ 0x1000000(R1), F2 // FMOVQ 16777216(R1), F2
|
||||
FMOVQ 0x44332211(R1), F2 // FMOVQ 1144201745(R1), F2
|
||||
|
||||
// shifted or extended register offset.
|
||||
MOVD (R2)(R6.SXTW), R4 // 44c866f8
|
||||
@@ -1900,12 +1894,4 @@ next:
|
||||
BTI J // 9f2403d5
|
||||
BTI JC // df2403d5
|
||||
|
||||
// Pointer Authentication Codes (PAC)
|
||||
PACIASP // 3f2303d5
|
||||
AUTIASP // bf2303d5
|
||||
PACIBSP // 7f2303d5
|
||||
AUTIBSP // ff2303d5
|
||||
AUTIA1716 // 9f2103d5
|
||||
AUTIB1716 // df2103d5
|
||||
|
||||
END
|
||||
|
||||
@@ -422,10 +422,4 @@ TEXT errors(SB),$0
|
||||
SHA1H V1.B16, V2.B16 // ERROR "invalid operands"
|
||||
BTI // ERROR "missing operand"
|
||||
BTI PLDL1KEEP // ERROR "illegal argument"
|
||||
PACIASP C // ERROR "illegal combination"
|
||||
AUTIASP R2 // ERROR "illegal combination"
|
||||
PACIBSP R0 // ERROR "illegal combination"
|
||||
AUTIBSP C // ERROR "illegal combination"
|
||||
AUTIA1716 $45 // ERROR "illegal combination"
|
||||
AUTIB1716 R0 // ERROR "illegal combination"
|
||||
RET
|
||||
|
||||
392
src/cmd/asm/internal/asm/testdata/loong64enc1.s
vendored
392
src/cmd/asm/internal/asm/testdata/loong64enc1.s
vendored
@@ -33,17 +33,13 @@ lable2:
|
||||
MOVV R4, R5 // 85001500
|
||||
MOVBU R4, R5 // 85fc4303
|
||||
SUB R4, R5, R6 // a6101100
|
||||
SUBW R4, R5, R6 // a6101100
|
||||
SUBV R4, R5, R6 // a6901100
|
||||
ADD R4, R5, R6 // a6101000
|
||||
ADDW R4, R5, R6 // a6101000
|
||||
ADDV R4, R5, R6 // a6901000
|
||||
AND R4, R5, R6 // a6901400
|
||||
SUB R4, R5 // a5101100
|
||||
SUBW R4, R5 // a5101100
|
||||
SUBV R4, R5 // a5901100
|
||||
ADD R4, R5 // a5101000
|
||||
ADDW R4, R5 // a5101000
|
||||
ADDV R4, R5 // a5901000
|
||||
AND R4, R5 // a5901400
|
||||
NEGW R4, R5 // 05101100
|
||||
@@ -97,8 +93,8 @@ lable2:
|
||||
MOVV R4, 1(R5) // a404c029
|
||||
MOVB R4, 1(R5) // a4040029
|
||||
MOVBU R4, 1(R5) // a4040029
|
||||
SC R4, 4096(R5) // a4001021
|
||||
SCV R4, 4096(R5) // a4001023
|
||||
SC R4, 1(R5) // a4040021
|
||||
SCV R4, 1(R5) // a4040023
|
||||
MOVW y+8(FP), R4 // 64408028
|
||||
MOVWU y+8(FP), R4 // 6440802a
|
||||
MOVV y+8(FP), R4 // 6440c028
|
||||
@@ -109,8 +105,8 @@ lable2:
|
||||
MOVV 1(R5), R4 // a404c028
|
||||
MOVB 1(R5), R4 // a4040028
|
||||
MOVBU 1(R5), R4 // a404002a
|
||||
LL 4096(R5), R4 // a4001020
|
||||
LLV 4096(R5), R4 // a4001022
|
||||
LL 1(R5), R4 // a4040020
|
||||
LLV 1(R5), R4 // a4040022
|
||||
MOVW $4(R4), R5 // 8510c002
|
||||
MOVV $4(R4), R5 // 8510c002
|
||||
MOVW $-1, R4 // 04fcff02
|
||||
@@ -119,8 +115,6 @@ lable2:
|
||||
MOVV $1, R4 // 04048003
|
||||
ADD $-1, R4, R5 // 85fcbf02
|
||||
ADD $-1, R4 // 84fcbf02
|
||||
ADDW $-1, R4, R5 // 85fcbf02
|
||||
ADDW $-1, R4 // 84fcbf02
|
||||
ADDV $-1, R4, R5 // 85fcff02
|
||||
ADDV $-1, R4 // 84fcff02
|
||||
AND $1, R4, R5 // 85044003
|
||||
@@ -171,8 +165,6 @@ lable2:
|
||||
// mul
|
||||
MUL R4, R5 // a5101c00
|
||||
MUL R4, R5, R6 // a6101c00
|
||||
MULW R4, R5 // a5101c00
|
||||
MULW R4, R5, R6 // a6101c00
|
||||
MULV R4, R5 // a5901d00
|
||||
MULV R4, R5, R6 // a6901d00
|
||||
MULVU R4, R5 // a5901d00
|
||||
@@ -199,26 +191,20 @@ lable2:
|
||||
MOVHU R4, 1(R5) // a4044029
|
||||
MOVHU y+8(FP), R4 // 6440402a
|
||||
MOVHU 1(R5), R4 // a404402a
|
||||
MULU R4, R5 // a5101c00
|
||||
MULU R4, R5, R6 // a6101c00
|
||||
MULH R4, R5 // a5901c00
|
||||
MULH R4, R5, R6 // a6901c00
|
||||
MULHU R4, R5 // a5101d00
|
||||
MULHU R4, R5, R6 // a6101d00
|
||||
REM R4, R5 // a5902000
|
||||
REM R4, R5, R6 // a6902000
|
||||
REMW R4, R5 // a5902000
|
||||
REMW R4, R5, R6 // a6902000
|
||||
REMU R4, R5 // a5902100
|
||||
REMU R4, R5, R6 // a6902100
|
||||
REMWU R4, R5 // a5902100
|
||||
REMWU R4, R5, R6 // a6902100
|
||||
DIV R4, R5 // a5102000
|
||||
DIV R4, R5, R6 // a6102000
|
||||
DIVW R4, R5 // a5102000
|
||||
DIVW R4, R5, R6 // a6102000
|
||||
DIVU R4, R5 // a5102100
|
||||
DIVU R4, R5, R6 // a6102100
|
||||
DIVWU R4, R5 // a5102100
|
||||
DIVWU R4, R5, R6 // a6102100
|
||||
SRLV R4, R5 // a5101900
|
||||
SRLV R4, R5, R6 // a6101900
|
||||
SRLV $4, R4, R5 // 85104500
|
||||
@@ -226,12 +212,6 @@ lable2:
|
||||
SRLV $32, R4, R5 // 85804500
|
||||
SRLV $32, R4 // 84804500
|
||||
|
||||
// MULW.D.W[U] instructions
|
||||
MULWVW R4, R5 // a5101f00
|
||||
MULWVW R4, R5, R6 // a6101f00
|
||||
MULWVWU R4, R5 // a5901f00
|
||||
MULWVWU R4, R5, R6 // a6901f00
|
||||
|
||||
MASKEQZ R4, R5, R6 // a6101300
|
||||
MASKNEZ R4, R5, R6 // a6901300
|
||||
|
||||
@@ -280,31 +260,6 @@ lable2:
|
||||
MOVV FCC0, R4 // 04dc1401
|
||||
MOVV R4, FCC0 // 80d81401
|
||||
|
||||
// LDPTR.{W/D} and STPTR.{W/D} instructions
|
||||
MOVWP R5, 32764(R4) // 85fc7f25
|
||||
MOVWP R5, 32(R4) // 85200025
|
||||
MOVWP R5, 4(R4) // 85040025
|
||||
MOVWP R5, (R4) // 85000025
|
||||
MOVVP R5, 32764(R4) // 85fc7f27
|
||||
MOVVP R5, 32(R4) // 85200027
|
||||
MOVVP R5, 4(R4) // 85040027
|
||||
MOVVP R5, (R4) // 85000027
|
||||
MOVWP 32764(R5), R4 // a4fc7f24
|
||||
MOVWP 32(R5), R4 // a4200024
|
||||
MOVWP 4(R5), R4 // a4040024
|
||||
MOVWP (R5), R4 // a4000024
|
||||
MOVVP 32764(R5), R4 // a4fc7f26
|
||||
MOVVP 32(R5), R4 // a4200026
|
||||
MOVVP 4(R5), R4 // a4040026
|
||||
MOVVP (R5), R4 // a4000026
|
||||
|
||||
// ADDU16I.D instruction
|
||||
ADDV16 $(-32768<<16), R4, R5 // ADDV16 $-2147483648, R4, R5 // 85000012
|
||||
ADDV16 $(0<<16), R4, R5 // ADDV16 $0, R4, R5 // 85000010
|
||||
ADDV16 $(8<<16), R4, R5 // ADDV16 $524288, R4, R5 // 85200010
|
||||
ADDV16 $(32767<<16), R4, R5 // ADDV16 $2147418112, R4, R5 // 85fcff11
|
||||
ADDV16 $(16<<16), R4 // ADDV16 $1048576, R4 // 84400010
|
||||
|
||||
// Loong64 atomic memory access instructions
|
||||
AMSWAPB R14, (R13), R12 // ac395c38
|
||||
AMSWAPH R14, (R13), R12 // acb95c38
|
||||
@@ -421,10 +376,6 @@ lable2:
|
||||
FTINTRNEVF F0, F2 // 02e41a01
|
||||
FTINTRNEVD F0, F2 // 02e81a01
|
||||
|
||||
// FSEL instruction
|
||||
FSEL FCC0, F1, F2, F3 // 4304000d
|
||||
FSEL FCC1, F1, F2 // 4284000d
|
||||
|
||||
// LDX.{B,BU,H,HU,W,WU,D} instructions
|
||||
MOVB (R14)(R13), R12 // cc350038
|
||||
MOVBU (R14)(R13), R12 // cc352038
|
||||
@@ -553,44 +504,12 @@ lable2:
|
||||
XVMOVQ X28.V[3], X8 // 88ef0377
|
||||
XVMOVQ X27.V[0], X9 // 69e30377
|
||||
|
||||
// Move vector element to vector.
|
||||
//Move vector element to vector.
|
||||
VMOVQ V1.B[3], V9.B16 // 298cf772
|
||||
VMOVQ V2.H[2], V8.H8 // 48c8f772
|
||||
VMOVQ V3.W[1], V7.W4 // 67e4f772
|
||||
VMOVQ V4.V[0], V6.V2 // 86f0f772
|
||||
|
||||
// Move vector register to vector register.
|
||||
VMOVQ V1, V9 // 29002d73
|
||||
VMOVQ V2, V8 // 48002d73
|
||||
XVMOVQ X3, X7 // 67002d77
|
||||
XVMOVQ X4, X6 // 86002d77
|
||||
|
||||
// Load data from memory and broadcast to each element of a vector register: VMOVQ offset(Rj), <Vd>.<T>
|
||||
VMOVQ (R4), V0.B16 // 80008030
|
||||
VMOVQ 1(R4), V0.B16 // 80048030
|
||||
VMOVQ -3(R4), V0.B16 // 80f4bf30
|
||||
VMOVQ (R4), V1.H8 // 81004030
|
||||
VMOVQ 2(R4), V1.H8 // 81044030
|
||||
VMOVQ -6(R4), V1.H8 // 81f45f30
|
||||
VMOVQ (R4), V2.W4 // 82002030
|
||||
VMOVQ 8(R4), V2.W4 // 82082030
|
||||
VMOVQ -12(R4), V2.W4 // 82f42f30
|
||||
VMOVQ (R4), V3.V2 // 83001030
|
||||
VMOVQ 24(R4), V3.V2 // 830c1030
|
||||
VMOVQ -16(R4), V3.V2 // 83f81730
|
||||
XVMOVQ (R4), X0.B32 // 80008032
|
||||
XVMOVQ 1(R4), X0.B32 // 80048032
|
||||
XVMOVQ -5(R4), X0.B32 // 80ecbf32
|
||||
XVMOVQ (R4), X1.H16 // 81004032
|
||||
XVMOVQ 2(R4), X1.H16 // 81044032
|
||||
XVMOVQ -10(R4), X1.H16 // 81ec5f32
|
||||
XVMOVQ (R4), X2.W8 // 82002032
|
||||
XVMOVQ 8(R4), X2.W8 // 82082032
|
||||
XVMOVQ -20(R4), X2.W8 // 82ec2f32
|
||||
XVMOVQ (R4), X3.V4 // 83001032
|
||||
XVMOVQ 24(R4), X3.V4 // 830c1032
|
||||
XVMOVQ -24(R4), X3.V4 // 83f41732
|
||||
|
||||
// VSEQ{B,H,W,V}, XVSEQ{B,H,W,V} instruction
|
||||
VSEQB V1, V2, V3 // 43040070
|
||||
VSEQH V1, V2, V3 // 43840070
|
||||
@@ -611,42 +530,6 @@ lable2:
|
||||
XVSEQV $15, X2, X4 // 44bc8176
|
||||
XVSEQV $-15, X2, X4 // 44c48176
|
||||
|
||||
// VSLTB{B,H,W,V}, XVSLTB{B,H,W,V} instruction
|
||||
VSLTB V1, V2, V3 // 43040670
|
||||
VSLTH V1, V2, V3 // 43840670
|
||||
VSLTW V1, V2, V3 // 43040770
|
||||
VSLTV V1, V2, V3 // 43840770
|
||||
XVSLTB X1, X2, X3 // 43040674
|
||||
XVSLTH X1, X2, X3 // 43840674
|
||||
XVSLTW X1, X2, X3 // 43040774
|
||||
XVSLTV X1, X2, X3 // 43840774
|
||||
VSLTB $1, V2, V3 // 43048672
|
||||
VSLTH $16, V2, V3 // 43c08672
|
||||
VSLTW $-16, V2, V3 // 43408772
|
||||
VSLTV $-15, V2, V3 // 43c48772
|
||||
XVSLTB $1, X2, X3 // 43048676
|
||||
XVSLTH $16, X2, X3 // 43c08676
|
||||
XVSLTW $-16, X2, X3 // 43408776
|
||||
XVSLTV $-16, X2, X3 // 43c08776
|
||||
|
||||
// VSLTB{B,H,W,V}U, XVSLTB{B,H,W,V}U instruction
|
||||
VSLTBU V1, V2, V3 // 43040870
|
||||
VSLTHU V1, V2, V3 // 43840870
|
||||
VSLTWU V1, V2, V3 // 43040970
|
||||
VSLTVU V1, V2, V3 // 43840970
|
||||
XVSLTBU X1, X2, X3 // 43040874
|
||||
XVSLTHU X1, X2, X3 // 43840874
|
||||
XVSLTWU X1, X2, X3 // 43040974
|
||||
XVSLTVU X1, X2, X3 // 43840974
|
||||
VSLTBU $0, V2, V3 // 43008872
|
||||
VSLTHU $31, V2, V3 // 43fc8872
|
||||
VSLTWU $16, V2, V3 // 43408972
|
||||
VSLTVU $1, V2, V3 // 43848972
|
||||
XVSLTBU $0, X2, X3 // 43008876
|
||||
XVSLTHU $31, X2, X3 // 43fc8876
|
||||
XVSLTWU $8, X2, X3 // 43208976
|
||||
XVSLTVU $0, X2, X3 // 43808976
|
||||
|
||||
// VPCNT{B,H,W,V}, XVPCNT{B,H,W,V} instruction
|
||||
VPCNTB V1, V2 // 22209c72
|
||||
VPCNTH V1, V2 // 22249c72
|
||||
@@ -899,42 +782,6 @@ lable2:
|
||||
XVSUBWU $15, X1, X2 // 223c8d76
|
||||
XVSUBVU $16, X1, X2 // 22c08d76
|
||||
|
||||
// [X]VSADD{B,H,W,V}, [X]VSSUB{B,H,W,V} instructions
|
||||
VSADDB V1, V2, V3 // 43044670
|
||||
VSADDH V1, V2, V3 // 43844670
|
||||
VSADDW V1, V2, V3 // 43044770
|
||||
VSADDV V1, V2, V3 // 43844770
|
||||
VSSUBB V1, V2, V3 // 43044870
|
||||
VSSUBH V1, V2, V3 // 43844870
|
||||
VSSUBW V1, V2, V3 // 43044970
|
||||
VSSUBV V1, V2, V3 // 43844970
|
||||
XVSADDB X3, X2, X1 // 410c4674
|
||||
XVSADDH X3, X2, X1 // 418c4674
|
||||
XVSADDW X3, X2, X1 // 410c4774
|
||||
XVSADDV X3, X2, X1 // 418c4774
|
||||
XVSSUBB X3, X2, X1 // 410c4874
|
||||
XVSSUBH X3, X2, X1 // 418c4874
|
||||
XVSSUBW X3, X2, X1 // 410c4974
|
||||
XVSSUBV X3, X2, X1 // 418c4974
|
||||
|
||||
// [X]VSADD{B,H,W,V}U, [X]VSSUB{B,H,W,V}U instructions
|
||||
VSADDBU V1, V2, V3 // 43044a70
|
||||
VSADDHU V1, V2, V3 // 43844a70
|
||||
VSADDWU V1, V2, V3 // 43044b70
|
||||
VSADDVU V1, V2, V3 // 43844b70
|
||||
VSSUBBU V1, V2, V3 // 43044c70
|
||||
VSSUBHU V1, V2, V3 // 43844c70
|
||||
VSSUBWU V1, V2, V3 // 43044d70
|
||||
VSSUBVU V1, V2, V3 // 43844d70
|
||||
XVSADDBU X1, X2, X3 // 43044a74
|
||||
XVSADDHU X1, X2, X3 // 43044b74
|
||||
XVSADDWU X1, X2, X3 // 43044b74
|
||||
XVSADDVU X1, X2, X3 // 43844b74
|
||||
XVSSUBBU X1, X2, X3 // 43044c74
|
||||
XVSSUBHU X1, X2, X3 // 43844c74
|
||||
XVSSUBWU X1, X2, X3 // 43044d74
|
||||
XVSSUBVU X1, X2, X3 // 43844d74
|
||||
|
||||
// [X]VILV{L/H}{B,H,W,V} instructions
|
||||
VILVLB V1, V2, V3 // 43041a71
|
||||
VILVLH V1, V2, V3 // 43841a71
|
||||
@@ -1089,150 +936,6 @@ lable2:
|
||||
XVMULWODVWUW X1, X2, X3 // 4304a374
|
||||
XVMULWODQVUV X1, X2, X3 // 4384a374
|
||||
|
||||
// [X]VADDW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
|
||||
VADDWEVHB V1, V2, V3 // 43041e70
|
||||
VADDWEVWH V1, V2, V3 // 43841e70
|
||||
VADDWEVVW V1, V2, V3 // 43041f70
|
||||
VADDWEVQV V1, V2, V3 // 43841f70
|
||||
VADDWODHB V1, V2, V3 // 43042270
|
||||
VADDWODWH V1, V2, V3 // 43842270
|
||||
VADDWODVW V1, V2, V3 // 43042370
|
||||
VADDWODQV V1, V2, V3 // 43842370
|
||||
XVADDWEVHB X1, X2, X3 // 43041e74
|
||||
XVADDWEVWH X1, X2, X3 // 43841e74
|
||||
XVADDWEVVW X1, X2, X3 // 43041f74
|
||||
XVADDWEVQV X1, X2, X3 // 43841f74
|
||||
XVADDWODHB X1, X2, X3 // 43042274
|
||||
XVADDWODWH X1, X2, X3 // 43842274
|
||||
XVADDWODVW X1, X2, X3 // 43042374
|
||||
XVADDWODQV X1, X2, X3 // 43842374
|
||||
|
||||
// [X]VSUBW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
|
||||
VSUBWEVHB V1, V2, V3 // 43042070
|
||||
VSUBWEVWH V1, V2, V3 // 43842070
|
||||
VSUBWEVVW V1, V2, V3 // 43042170
|
||||
VSUBWEVQV V1, V2, V3 // 43842170
|
||||
VSUBWODHB V1, V2, V3 // 43042470
|
||||
VSUBWODWH V1, V2, V3 // 43842470
|
||||
VSUBWODVW V1, V2, V3 // 43042570
|
||||
VSUBWODQV V1, V2, V3 // 43842570
|
||||
XVSUBWEVHB X1, X2, X3 // 43042074
|
||||
XVSUBWEVWH X1, X2, X3 // 43842074
|
||||
XVSUBWEVVW X1, X2, X3 // 43042174
|
||||
XVSUBWEVQV X1, X2, X3 // 43842174
|
||||
XVSUBWODHB X1, X2, X3 // 43042474
|
||||
XVSUBWODWH X1, X2, X3 // 43842474
|
||||
XVSUBWODVW X1, X2, X3 // 43042574
|
||||
XVSUBWODQV X1, X2, X3 // 43842574
|
||||
|
||||
// [X]VADDW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
|
||||
VADDWEVHBU V1, V2, V3 // 43042e70
|
||||
VADDWEVWHU V1, V2, V3 // 43042f70
|
||||
VADDWEVVWU V1, V2, V3 // 43042f70
|
||||
VADDWEVQVU V1, V2, V3 // 43842f70
|
||||
VADDWODHBU V1, V2, V3 // 43043270
|
||||
VADDWODWHU V1, V2, V3 // 43843270
|
||||
VADDWODVWU V1, V2, V3 // 43043370
|
||||
VADDWODQVU V1, V2, V3 // 43843370
|
||||
XVADDWEVHBU X1, X2, X3 // 43042e74
|
||||
XVADDWEVWHU X1, X2, X3 // 43842e74
|
||||
XVADDWEVVWU X1, X2, X3 // 43042f74
|
||||
XVADDWEVQVU X1, X2, X3 // 43842f74
|
||||
XVADDWODHBU X1, X2, X3 // 43043274
|
||||
XVADDWODWHU X1, X2, X3 // 43843274
|
||||
XVADDWODVWU X1, X2, X3 // 43043374
|
||||
XVADDWODQVU X1, X2, X3 // 43843374
|
||||
|
||||
// [X]VSUBW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
|
||||
VSUBWEVHBU V1, V2, V3 // 43043070
|
||||
VSUBWEVWHU V1, V2, V3 // 43843070
|
||||
VSUBWEVVWU V1, V2, V3 // 43043170
|
||||
VSUBWEVQVU V1, V2, V3 // 43843170
|
||||
VSUBWODHBU V1, V2, V3 // 43043470
|
||||
VSUBWODWHU V1, V2, V3 // 43843470
|
||||
VSUBWODVWU V1, V2, V3 // 43043570
|
||||
VSUBWODQVU V1, V2, V3 // 43843570
|
||||
XVSUBWEVHBU X1, X2, X3 // 43043074
|
||||
XVSUBWEVWHU X1, X2, X3 // 43843074
|
||||
XVSUBWEVVWU X1, X2, X3 // 43043174
|
||||
XVSUBWEVQVU X1, X2, X3 // 43843174
|
||||
XVSUBWODHBU X1, X2, X3 // 43043474
|
||||
XVSUBWODWHU X1, X2, X3 // 43843474
|
||||
XVSUBWODVWU X1, X2, X3 // 43043574
|
||||
XVSUBWODQVU X1, X2, X3 // 43843574
|
||||
|
||||
// [X]VMADD.{B/H/W/D}, [X]VMSUB.{B/H/W/D} instructions
|
||||
VMADDB V1, V2, V3 // 4304a870
|
||||
VMADDH V1, V2, V3 // 4384a870
|
||||
VMADDW V1, V2, V3 // 4304a970
|
||||
VMADDV V1, V2, V3 // 4384a970
|
||||
VMSUBB V1, V2, V3 // 4304aa70
|
||||
VMSUBH V1, V2, V3 // 4384aa70
|
||||
VMSUBW V1, V2, V3 // 4304ab70
|
||||
VMSUBV V1, V2, V3 // 4384ab70
|
||||
XVMADDB X1, X2, X3 // 4304a874
|
||||
XVMADDH X1, X2, X3 // 4384a874
|
||||
XVMADDW X1, X2, X3 // 4304a974
|
||||
XVMADDV X1, X2, X3 // 4384a974
|
||||
XVMSUBB X1, X2, X3 // 4304aa74
|
||||
XVMSUBH X1, X2, X3 // 4384aa74
|
||||
XVMSUBW X1, X2, X3 // 4304ab74
|
||||
XVMSUBV X1, X2, X3 // 4384ab74
|
||||
|
||||
// [X]VMADDW{EV/OD}.{H.B/W.H/D.W/Q.D} instructions
|
||||
VMADDWEVHB V1, V2, V3 // 4304ac70
|
||||
VMADDWEVWH V1, V2, V3 // 4384ac70
|
||||
VMADDWEVVW V1, V2, V3 // 4304ad70
|
||||
VMADDWEVQV V1, V2, V3 // 4384ad70
|
||||
VMADDWODHB V1, V2, V3 // 4304ae70
|
||||
VMADDWODWH V1, V2, V3 // 4384ae70
|
||||
VMADDWODVW V1, V2, V3 // 4304af70
|
||||
VMADDWODQV V1, V2, V3 // 4384af70
|
||||
XVMADDWEVHB X1, X2, X3 // 4304ac74
|
||||
XVMADDWEVWH X1, X2, X3 // 4384ac74
|
||||
XVMADDWEVVW X1, X2, X3 // 4304ad74
|
||||
XVMADDWEVQV X1, X2, X3 // 4384ad74
|
||||
XVMADDWODHB X1, X2, X3 // 4304ae74
|
||||
XVMADDWODWH X1, X2, X3 // 4384ae74
|
||||
XVMADDWODVW X1, X2, X3 // 4304af74
|
||||
XVMADDWODQV X1, X2, X3 // 4384af74
|
||||
|
||||
// [X]VMADDW{EV/OD}.{H.B/W.H/D.W/Q.D}U instructions
|
||||
VMADDWEVHBU V1, V2, V3 // 4304b470
|
||||
VMADDWEVWHU V1, V2, V3 // 4384b470
|
||||
VMADDWEVVWU V1, V2, V3 // 4304b570
|
||||
VMADDWEVQVU V1, V2, V3 // 4384b570
|
||||
VMADDWODHBU V1, V2, V3 // 4304b670
|
||||
VMADDWODWHU V1, V2, V3 // 4384b670
|
||||
VMADDWODVWU V1, V2, V3 // 4304b770
|
||||
VMADDWODQVU V1, V2, V3 // 4384b770
|
||||
XVMADDWEVHBU X1, X2, X3 // 4304b474
|
||||
XVMADDWEVWHU X1, X2, X3 // 4384b474
|
||||
XVMADDWEVVWU X1, X2, X3 // 4304b574
|
||||
XVMADDWEVQVU X1, X2, X3 // 4384b574
|
||||
XVMADDWODHBU X1, X2, X3 // 4304b674
|
||||
XVMADDWODWHU X1, X2, X3 // 4384b674
|
||||
XVMADDWODVWU X1, X2, X3 // 4304b774
|
||||
XVMADDWODQVU X1, X2, X3 // 4384b774
|
||||
|
||||
// [X]VMADDW{EV/OD}.{H.BU.B/W.HU.H/D.WU.W/Q.DU.D} instructions
|
||||
VMADDWEVHBUB V1, V2, V3 // 4304bc70
|
||||
VMADDWEVWHUH V1, V2, V3 // 4384bc70
|
||||
VMADDWEVVWUW V1, V2, V3 // 4304bd70
|
||||
VMADDWEVQVUV V1, V2, V3 // 4384bd70
|
||||
VMADDWODHBUB V1, V2, V3 // 4304be70
|
||||
VMADDWODWHUH V1, V2, V3 // 4384be70
|
||||
VMADDWODVWUW V1, V2, V3 // 4304bf70
|
||||
VMADDWODQVUV V1, V2, V3 // 4384bf70
|
||||
XVMADDWEVHBUB X1, X2, X3 // 4304bc74
|
||||
XVMADDWEVWHUH X1, X2, X3 // 4384bc74
|
||||
XVMADDWEVVWUW X1, X2, X3 // 4304bd74
|
||||
XVMADDWEVQVUV X1, X2, X3 // 4384bd74
|
||||
XVMADDWODHBUB X1, X2, X3 // 4304be74
|
||||
XVMADDWODWHUH X1, X2, X3 // 4384be74
|
||||
XVMADDWODVWUW X1, X2, X3 // 4304bf74
|
||||
XVMADDWODQVUV X1, X2, X3 // 4384bf74
|
||||
|
||||
// [X]VSHUF4I.{B/H/W/D} instructions
|
||||
VSHUF4IB $0, V2, V1 // 41009073
|
||||
VSHUF4IB $16, V2, V1 // 41409073
|
||||
@@ -1259,32 +962,6 @@ lable2:
|
||||
XVSHUF4IV $8, X1, X2 // 22209c77
|
||||
XVSHUF4IV $15, X1, X2 // 223c9c77
|
||||
|
||||
// [X]VSHUF.{B/H/W/V} instructions
|
||||
VSHUFH V1, V2, V3 // 43847a71
|
||||
VSHUFW V1, V2, V3 // 43047b71
|
||||
VSHUFV V1, V2, V3 // 43847b71
|
||||
XVSHUFH X1, X2, X3 // 43847a75
|
||||
XVSHUFW X1, X2, X3 // 43047b75
|
||||
XVSHUFV X1, X2, X3 // 43847b75
|
||||
VSHUFB V1, V2, V3, V4 // 6488500d
|
||||
XVSHUFB X1, X2, X3, X4 // 6488600d
|
||||
|
||||
// VPERMIW, XVPERMI{W,V,Q} instructions
|
||||
VPERMIW $0x1B, V1, V2 // VPERMIW $27, V1, V2 // 226ce473
|
||||
XVPERMIW $0x2B, X1, X2 // XVPERMIW $43, X1, X2 // 22ace477
|
||||
XVPERMIV $0x3B, X1, X2 // XVPERMIV $59, X1, X2 // 22ece877
|
||||
XVPERMIQ $0x4B, X1, X2 // XVPERMIQ $75, X1, X2 // 222ced77
|
||||
|
||||
// A{,X}VEXTRINS.{B,H,W,V} instructions
|
||||
VEXTRINSB $0x18, V1, V2 // VEXTRINSB $24, V1, V2 // 22608c73
|
||||
VEXTRINSH $0x27, V1, V2 // VEXTRINSH $39, V1, V2 // 229c8873
|
||||
VEXTRINSW $0x36, V1, V2 // VEXTRINSW $54, V1, V2 // 22d88473
|
||||
VEXTRINSV $0x45, V1, V2 // VEXTRINSV $69, V1, V2 // 22148173
|
||||
XVEXTRINSB $0x54, X1, X2 // XVEXTRINSB $84, X1, X2 // 22508d77
|
||||
XVEXTRINSH $0x63, X1, X2 // XVEXTRINSH $99, X1, X2 // 228c8977
|
||||
XVEXTRINSW $0x72, X1, X2 // XVEXTRINSW $114, X1, X2 // 22c88577
|
||||
XVEXTRINSV $0x81, X1, X2 // XVEXTRINSV $129, X1, X2 // 22048277
|
||||
|
||||
// [X]VSETEQZ.V, [X]VSETNEZ.V
|
||||
VSETEQV V1, FCC0 // 20989c72
|
||||
VSETNEV V1, FCC0 // 209c9c72
|
||||
@@ -1358,58 +1035,3 @@ lable2:
|
||||
PRELD (R4), $0 // 8000c02a
|
||||
PRELD -1(R4), $8 // 88fcff2a
|
||||
PRELD 8(R4), $31 // 9f20c02a
|
||||
|
||||
// [X]{VBITCLR/VBITSET/VBITREV}{B,H,W,V} instructions
|
||||
VBITCLRB V1, V2, V3 // 43040c71
|
||||
VBITCLRH V1, V2, V3 // 43840c71
|
||||
VBITCLRW V1, V2, V3 // 43040d71
|
||||
VBITCLRV V1, V2, V3 // 43840d71
|
||||
VBITSETB V1, V2, V3 // 43040e71
|
||||
VBITSETH V1, V2, V3 // 43840e71
|
||||
VBITSETW V1, V2, V3 // 43040f71
|
||||
VBITSETV V1, V2, V3 // 43840f71
|
||||
VBITREVB V1, V2, V3 // 43041071
|
||||
VBITREVH V1, V2, V3 // 43841071
|
||||
VBITREVW V1, V2, V3 // 43041171
|
||||
VBITREVV V1, V2, V3 // 43841171
|
||||
XVBITCLRB X3, X2, X1 // 410c0c75
|
||||
XVBITCLRH X3, X2, X1 // 418c0c75
|
||||
XVBITCLRW X3, X2, X1 // 410c0d75
|
||||
XVBITCLRV X3, X2, X1 // 418c0d75
|
||||
XVBITSETB X3, X2, X1 // 410c0e75
|
||||
XVBITSETH X3, X2, X1 // 418c0e75
|
||||
XVBITSETW X3, X2, X1 // 410c0f75
|
||||
XVBITSETV X3, X2, X1 // 418c0f75
|
||||
XVBITREVB X3, X2, X1 // 410c1075
|
||||
XVBITREVH X3, X2, X1 // 418c1075
|
||||
XVBITREVW X3, X2, X1 // 410c1175
|
||||
XVBITREVV X3, X2, X1 // 418c1175
|
||||
VBITCLRB $7, V2, V3 // 433c1073
|
||||
VBITCLRH $15, V2, V3 // 437c1073
|
||||
VBITCLRW $31, V2, V3 // 43fc1073
|
||||
VBITCLRV $63, V2, V3 // 43fc1173
|
||||
VBITSETB $7, V2, V3 // 433c1473
|
||||
VBITSETH $15, V2, V3 // 437c1473
|
||||
VBITSETW $31, V2, V3 // 43fc1473
|
||||
VBITSETV $63, V2, V3 // 43fc1573
|
||||
VBITREVB $7, V2, V3 // 433c1873
|
||||
VBITREVH $15, V2, V3 // 437c1873
|
||||
VBITREVW $31, V2, V3 // 43fc1873
|
||||
VBITREVV $63, V2, V3 // 43fc1973
|
||||
XVBITCLRB $7, X2, X1 // 413c1077
|
||||
XVBITCLRH $15, X2, X1 // 417c1077
|
||||
XVBITCLRW $31, X2, X1 // 41fc1077
|
||||
XVBITCLRV $63, X2, X1 // 41fc1177
|
||||
XVBITSETB $7, X2, X1 // 413c1477
|
||||
XVBITSETH $15, X2, X1 // 417c1477
|
||||
XVBITSETW $31, X2, X1 // 41fc1477
|
||||
XVBITSETV $63, X2, X1 // 41fc1577
|
||||
XVBITREVB $7, X2, X1 // 413c1877
|
||||
XVBITREVH $15, X2, X1 // 417c1877
|
||||
XVBITREVW $31, X2, X1 // 41fc1877
|
||||
XVBITREVV $63, X2, X1 // 41fc1977
|
||||
|
||||
// ALSL{W/WU/D}
|
||||
ALSLW $4, R4, R5, R6 // 86940500
|
||||
ALSLWU $4, R4, R5, R6 // 86940700
|
||||
ALSLV $4, R4, R5, R6 // 86942d00
|
||||
|
||||
@@ -21,10 +21,6 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
ADD $4096, R4, R5 // 3e00001485781000
|
||||
ADD $65536, R4 // 1e02001484781000
|
||||
ADD $4096, R4 // 3e00001484781000
|
||||
ADDW $65536, R4, R5 // 1e02001485781000
|
||||
ADDW $4096, R4, R5 // 3e00001485781000
|
||||
ADDW $65536, R4 // 1e02001484781000
|
||||
ADDW $4096, R4 // 3e00001484781000
|
||||
ADDV $65536, R4, R5 // 1e02001485f81000
|
||||
ADDV $4096, R4, R5 // 3e00001485f81000
|
||||
ADDV $65536, R4 // 1e02001484f81000
|
||||
@@ -41,6 +37,10 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
SGTU $4096, R4, R5 // 3e00001485f81200
|
||||
SGTU $65536, R4 // 1e02001484f81200
|
||||
SGTU $4096, R4 // 3e00001484f81200
|
||||
ADDU $65536, R4, R5 // 1e02001485781000
|
||||
ADDU $4096, R4, R5 // 3e00001485781000
|
||||
ADDU $65536, R4 // 1e02001484781000
|
||||
ADDU $4096, R4 // 3e00001484781000
|
||||
ADDVU $65536, R4, R5 // 1e02001485f81000
|
||||
ADDVU $4096, R4, R5 // 3e00001485f81000
|
||||
ADDVU $65536, R4 // 1e02001484f81000
|
||||
|
||||
29
src/cmd/asm/internal/asm/testdata/loong64enc3.s
vendored
29
src/cmd/asm/internal/asm/testdata/loong64enc3.s
vendored
@@ -11,16 +11,12 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
MOVV $4096(R4), R5 // 3e000014de03800385f81000
|
||||
ADD $74565, R4 // 5e020014de178d0384781000
|
||||
ADD $4097, R4 // 3e000014de07800384781000
|
||||
ADDW $74565, R4 // 5e020014de178d0384781000
|
||||
ADDW $4097, R4 // 3e000014de07800384781000
|
||||
ADDV $74565, R4 // 5e020014de178d0384f81000
|
||||
ADDV $4097, R4 // 3e000014de07800384f81000
|
||||
AND $74565, R4 // 5e020014de178d0384f81400
|
||||
AND $4097, R4 // 3e000014de07800384f81400
|
||||
ADD $74565, R4, R5 // 5e020014de178d0385781000
|
||||
ADD $4097, R4, R5 // 3e000014de07800385781000
|
||||
ADDW $74565, R4, R5 // 5e020014de178d0385781000
|
||||
ADDW $4097, R4, R5 // 3e000014de07800385781000
|
||||
ADDV $74565, R4, R5 // 5e020014de178d0385f81000
|
||||
ADDV $4097, R4, R5 // 3e000014de07800385f81000
|
||||
AND $74565, R4, R5 // 5e020014de178d0385f81400
|
||||
@@ -46,10 +42,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
MOVB R4, 4096(R5) // 3e000014de971000c4030029
|
||||
MOVBU R4, 65536(R5) // 1e020014de971000c4030029
|
||||
MOVBU R4, 4096(R5) // 3e000014de971000c4030029
|
||||
SC R4, 65536(R5) // 1e040010de971000c4030021
|
||||
SCV R4, 65536(R5) // 1e040010de971000c4030023
|
||||
LL 65536(R5), R4 // 1e040010de971000c4030020
|
||||
LLV 65536(R5), R4 // 1e040010de971000c4030022
|
||||
SC R4, 65536(R5) // 1e020014de971000c4030021
|
||||
SC R4, 4096(R5) // 3e000014de971000c4030021
|
||||
MOVW y+65540(FP), R4 // 1e020014de8f1000c4338028
|
||||
MOVWU y+65540(FP), R4 // 1e020014de8f1000c433802a
|
||||
MOVV y+65540(FP), R4 // 1e020014de8f1000c433c028
|
||||
@@ -111,6 +105,10 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
SGTU $74565, R4, R5 // 5e020014de178d0385f81200
|
||||
SGTU $4097, R4 // 3e000014de07800384f81200
|
||||
SGTU $4097, R4, R5 // 3e000014de07800385f81200
|
||||
ADDU $74565, R4 // 5e020014de178d0384781000
|
||||
ADDU $74565, R4, R5 // 5e020014de178d0385781000
|
||||
ADDU $4097, R4 // 3e000014de07800384781000
|
||||
ADDU $4097, R4, R5 // 3e000014de07800385781000
|
||||
ADDVU $4097, R4 // 3e000014de07800384f81000
|
||||
ADDVU $4097, R4, R5 // 3e000014de07800385f81000
|
||||
ADDVU $74565, R4 // 5e020014de178d0384f81000
|
||||
@@ -124,21 +122,6 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
XOR $4097, R4 // 3e000014de07800384f81500
|
||||
XOR $4097, R4, R5 // 3e000014de07800385f81500
|
||||
|
||||
MOVWP R5, -32768(R4) // 1efcff13de931000c5038025
|
||||
MOVWP R5, 32768(R4) // 1e000010de931000c5038025
|
||||
MOVWP R5, 65536(R4) // 1e040010de931000c5030025
|
||||
MOVWP R5, 1048576(R4) // 1e400010de931000c5030025
|
||||
MOVVP R5, -32768(R4) // 1efcff13de931000c5038027
|
||||
MOVVP R5, 65536(R4) // 1e040010de931000c5030027
|
||||
MOVVP R5, 1048576(R4) // 1e400010de931000c5030027
|
||||
MOVWP -32768(R5), R4 // 1efcff13de971000c4038024
|
||||
MOVWP 2229248(R5), R4 // 1e880010de971000c4030424
|
||||
MOVWP -2145518592(R5), R4 // 1e740012de971000c403fc24
|
||||
MOVVP -32768(R5), R4 // 1efcff13de971000c4038026
|
||||
MOVVP 2229248(R5), R4 // 1e880010de971000c4030426
|
||||
MOVVP -2145518592(R5), R4 // 1e740012de971000c403fc26
|
||||
|
||||
|
||||
// MOVV C_DCON32_12S, r
|
||||
MOVV $0x27312345fffff800, R4 // MOVV $2824077224892692480, R4 // 0400a002a468241684cc0903
|
||||
MOVV $0xf7312345fffff800, R4 // MOVV $-634687288927848448, R4 // 0400a002a468241684cc3d03
|
||||
|
||||
12
src/cmd/asm/internal/asm/testdata/loong64enc6.s
vendored
12
src/cmd/asm/internal/asm/testdata/loong64enc6.s
vendored
@@ -1,12 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
#include "../../../../../runtime/textflag.h"
|
||||
|
||||
TEXT asmtest(SB),DUPOK|NOSPLIT,$0
|
||||
// MOVWP LOREG_64(Rx), Ry
|
||||
MOVWP 81985529216486896(R4), R5 // 9e571315dec3b703feac6816de4b000384f8100085000025
|
||||
MOVWP -81985529216486896(R4), R5 // 7ea8ec14de4388031e539717deb73f0384f8100085000025
|
||||
MOVWP R4, 81985529216486896(R5) // 9e571315dec3b703feac6816de4b0003a5f81000a4000025
|
||||
MOVWP R4, -81985529216486896(R5) // 7ea8ec14de4388031e539717deb73f03a5f81000a4000025
|
||||
@@ -5,10 +5,3 @@
|
||||
TEXT errors(SB),$0
|
||||
VSHUF4IV $16, V1, V2 // ERROR "operand out of range 0 to 15"
|
||||
XVSHUF4IV $16, X1, X2 // ERROR "operand out of range 0 to 15"
|
||||
ADDV16 $1, R4, R5 // ERROR "the constant must be a multiple of 65536."
|
||||
ADDV16 $65535, R4, R5 // ERROR "the constant must be a multiple of 65536."
|
||||
SC R4, 1(R5) // ERROR "offset must be a multiple of 4."
|
||||
SCV R4, 1(R5) // ERROR "offset must be a multiple of 4."
|
||||
LL 1(R5), R4 // ERROR "offset must be a multiple of 4."
|
||||
LLV 1(R5), R4 // ERROR "offset must be a multiple of 4."
|
||||
|
||||
|
||||
694
src/cmd/asm/internal/asm/testdata/riscv64.s
vendored
694
src/cmd/asm/internal/asm/testdata/riscv64.s
vendored
@@ -172,35 +172,11 @@ start:
|
||||
SD X5, (X6) // 23305300
|
||||
SD X5, 4(X6) // 23325300
|
||||
|
||||
// 7.1: CSR Instructions
|
||||
CSRRC X0, CYCLE, X5 // f33200c0
|
||||
CSRRC X0, CYCLE, X0 // 733000c0
|
||||
CSRRC X10, CYCLE, X5 // f33205c0
|
||||
CSRRC $2, TIME, X5 // f37211c0
|
||||
CSRRCI $2, TIME, X5 // f37211c0
|
||||
CSRRS X0, CYCLE, X5 // f32200c0
|
||||
CSRRS X0, CYCLE, X0 // 732000c0
|
||||
CSRRS X10, CYCLE, X5 // f32205c0
|
||||
CSRRS $2, TIME, X5 // f36211c0
|
||||
CSRRS X0, VLENB, X5 // f32220c2
|
||||
CSRRSI $2, TIME, X5 // f36211c0
|
||||
CSRRW X0, CYCLE, X5 // f31200c0
|
||||
CSRRW X0, CYCLE, X0 // 731000c0
|
||||
CSRRW X10, CYCLE, X5 // f31205c0
|
||||
CSRRW $2, TIME, X5 // f35211c0
|
||||
CSRRWI $2, TIME, X5 // f35211c0
|
||||
|
||||
// 8.1: Base Counters and Timers (Zicntr)
|
||||
RDCYCLE X5 // f32200c0
|
||||
RDTIME X5 // f32210c0
|
||||
RDINSTRET X5 // f32220c0
|
||||
|
||||
// 12.3: Integer Conditional Operations (Zicond)
|
||||
CZEROEQZ X5, X6, X7 // b353530e
|
||||
CZEROEQZ X5, X7 // b3d3530e
|
||||
CZERONEZ X5, X6, X7 // b373530e
|
||||
CZERONEZ X5, X7 // b3f3530e
|
||||
|
||||
// 13.1: Multiplication Operations
|
||||
MUL X5, X6, X7 // b3035302
|
||||
MULH X5, X6, X7 // b3135302
|
||||
@@ -364,84 +340,9 @@ start:
|
||||
FNMSUBD F1, F2, F3, F4 // 4b82201a
|
||||
FNMADDD F1, F2, F3, F4 // 4f82201a
|
||||
|
||||
// 21.6: Double-Precision Floating-Point Compare Instructions
|
||||
FEQD F0, F1, X7 // d3a300a2
|
||||
FLTD F0, F1, X7 // d39300a2
|
||||
FLED F0, F1, X7 // d38300a2
|
||||
|
||||
// 21.7: Double-Precision Floating-Point Classify Instruction
|
||||
FCLASSD F0, X5 // d31200e2
|
||||
|
||||
//
|
||||
// "C" Extension for Compressed Instructions, Version 2.0
|
||||
//
|
||||
|
||||
// 26.3.1: Compressed Stack-Pointer-Based Loads and Stores
|
||||
CLWSP 20(SP), X10 // 5245
|
||||
CLDSP 24(SP), X10 // 6265
|
||||
CFLDSP 32(SP), F10 // 0235
|
||||
CSWSP X10, 20(SP) // 2aca
|
||||
CSDSP X10, 24(SP) // 2aec
|
||||
CFSDSP F10, 32(SP) // 2ab0
|
||||
|
||||
// 26.3.2: Compressed Register-Based Loads and Stores
|
||||
CLW 20(X10), X11 // 4c49
|
||||
CLD 24(X10), X11 // 0c6d
|
||||
CFLD 32(X10), F11 // 0c31
|
||||
CSW X11, 20(X10) // 4cc9
|
||||
CSD X11, 24(X10) // 0ced
|
||||
CFSD F11, 32(X10) // 0cb1
|
||||
|
||||
// 26.4: Compressed Control Transfer Instructions
|
||||
CJ 1(PC) // 09a0
|
||||
CJR X5 // 8282
|
||||
CJALR X5 // 8292
|
||||
CBEQZ X10, 1(PC) // 09c1
|
||||
CBNEZ X10, 1(PC) // 09e1
|
||||
|
||||
// 26.5.1: Compressed Integer Constant-Generation Instructions
|
||||
CLI $-32, X5 // 8152
|
||||
CLI $31, X5 // fd42
|
||||
CLUI $-32, X5 // 8172
|
||||
CLUI $31, X5 // fd62
|
||||
|
||||
// 26.5.2: Compressed Integer Register-Immediate Operations
|
||||
CADD $-32, X5 // 8112
|
||||
CADD $31, X5 // fd02
|
||||
CADDI $-32, X5 // 8112
|
||||
CADDI $31, X5 // fd02
|
||||
CADDW $-32, X5 // 8132
|
||||
CADDW $31, X5 // fd22
|
||||
CADDIW $-32, X5 // 8132
|
||||
CADDIW $31, X5 // fd22
|
||||
CADDI16SP $-512, SP // 0171
|
||||
CADDI16SP $496, SP // 7d61
|
||||
CADDI4SPN $4, SP, X10 // 4800
|
||||
CADDI4SPN $1020, SP, X10 // e81f
|
||||
CSLLI $63, X5 // fe12
|
||||
CSRLI $63, X10 // 7d91
|
||||
CSRAI $63, X10 // 7d95
|
||||
CAND $-32, X10 // 0199
|
||||
CAND $31, X10 // 7d89
|
||||
CANDI $-32, X10 // 0199
|
||||
CANDI $31, X10 // 7d89
|
||||
|
||||
// 26.5.3: Compressed Integer Register-Register Operations
|
||||
CMV X6, X5 // 9a82
|
||||
CADD X9, X8 // 2694
|
||||
CAND X9, X8 // 658c
|
||||
COR X9, X8 // 458c
|
||||
CXOR X9, X8 // 258c
|
||||
CSUB X9, X8 // 058c
|
||||
CADDW X9, X8 // 259c
|
||||
CSUBW X9, X8 // 059c
|
||||
|
||||
// 26.5.5: Compressed NOP Instruction
|
||||
CNOP // 0100
|
||||
|
||||
// 26.5.6: Compressed Breakpoint Instruction
|
||||
CEBREAK // 0290
|
||||
|
||||
// 28.4.1: Address Generation Instructions (Zba)
|
||||
ADDUW X10, X11, X12 // 3b86a508
|
||||
ADDUW X10, X11 // bb85a508
|
||||
@@ -619,588 +520,6 @@ start:
|
||||
VSOXEI64V V3, V2, (X10) // a771250e
|
||||
VSOXEI64V V3, V2, V0, (X10) // a771250c
|
||||
|
||||
// 31.7.7: Unit-stride Fault-Only-First Loads
|
||||
VLE8FFV (X10), V8 // 07040503
|
||||
VLE16FFV (X10), V8 // 07540503
|
||||
VLE32FFV (X10), V8 // 07640503
|
||||
VLE64FFV (X10), V8 // 07740503
|
||||
VLE8FFV (X10), V0, V8 // 07040501
|
||||
VLE16FFV (X10), V0, V8 // 07540501
|
||||
VLE32FFV (X10), V0, V8 // 07640501
|
||||
VLE64FFV (X10), V0, V8 // 07740501
|
||||
|
||||
// 31.7.8: Vector Load/Store Segment Instructions
|
||||
|
||||
// 31.7.8.1: Vector Unit-Stride Segment Loads and Stores
|
||||
VLSEG2E8V (X10), V8 // 07040522
|
||||
VLSEG2E16V (X10), V8 // 07540522
|
||||
VLSEG2E32V (X10), V8 // 07640522
|
||||
VLSEG2E64V (X10), V8 // 07740522
|
||||
VLSEG2E8V (X10), V0, V8 // 07040520
|
||||
VLSEG2E16V (X10), V0, V8 // 07540520
|
||||
VLSEG2E32V (X10), V0, V8 // 07640520
|
||||
VLSEG2E64V (X10), V0, V8 // 07740520
|
||||
|
||||
VLSEG3E8V (X10), V8 // 07040542
|
||||
VLSEG3E16V (X10), V8 // 07540542
|
||||
VLSEG3E32V (X10), V8 // 07640542
|
||||
VLSEG3E64V (X10), V8 // 07740542
|
||||
VLSEG3E8V (X10), V0, V8 // 07040540
|
||||
VLSEG3E16V (X10), V0, V8 // 07540540
|
||||
VLSEG3E32V (X10), V0, V8 // 07640540
|
||||
VLSEG3E64V (X10), V0, V8 // 07740540
|
||||
|
||||
VLSEG4E8V (X10), V8 // 07040562
|
||||
VLSEG4E16V (X10), V8 // 07540562
|
||||
VLSEG4E32V (X10), V8 // 07640562
|
||||
VLSEG4E64V (X10), V8 // 07740562
|
||||
VLSEG4E8V (X10), V0, V8 // 07040560
|
||||
VLSEG4E16V (X10), V0, V8 // 07540560
|
||||
VLSEG4E32V (X10), V0, V8 // 07640560
|
||||
VLSEG4E64V (X10), V0, V8 // 07740560
|
||||
|
||||
VLSEG5E8V (X10), V8 // 07040582
|
||||
VLSEG5E16V (X10), V8 // 07540582
|
||||
VLSEG5E32V (X10), V8 // 07640582
|
||||
VLSEG5E64V (X10), V8 // 07740582
|
||||
VLSEG5E8V (X10), V0, V8 // 07040580
|
||||
VLSEG5E16V (X10), V0, V8 // 07540580
|
||||
VLSEG5E32V (X10), V0, V8 // 07640580
|
||||
VLSEG5E64V (X10), V0, V8 // 07740580
|
||||
|
||||
VLSEG6E8V (X10), V8 // 070405a2
|
||||
VLSEG6E16V (X10), V8 // 075405a2
|
||||
VLSEG6E32V (X10), V8 // 076405a2
|
||||
VLSEG6E64V (X10), V8 // 077405a2
|
||||
VLSEG6E8V (X10), V0, V8 // 070405a0
|
||||
VLSEG6E16V (X10), V0, V8 // 075405a0
|
||||
VLSEG6E32V (X10), V0, V8 // 076405a0
|
||||
VLSEG6E64V (X10), V0, V8 // 077405a0
|
||||
|
||||
VLSEG7E8V (X10), V8 // 070405c2
|
||||
VLSEG7E16V (X10), V8 // 075405c2
|
||||
VLSEG7E32V (X10), V8 // 076405c2
|
||||
VLSEG7E64V (X10), V8 // 077405c2
|
||||
VLSEG7E8V (X10), V0, V8 // 070405c0
|
||||
VLSEG7E16V (X10), V0, V8 // 075405c0
|
||||
VLSEG7E32V (X10), V0, V8 // 076405c0
|
||||
VLSEG7E64V (X10), V0, V8 // 077405c0
|
||||
|
||||
VLSEG8E8V (X10), V8 // 070405e2
|
||||
VLSEG8E16V (X10), V8 // 075405e2
|
||||
VLSEG8E32V (X10), V8 // 076405e2
|
||||
VLSEG8E64V (X10), V8 // 077405e2
|
||||
VLSEG8E8V (X10), V0, V8 // 070405e0
|
||||
VLSEG8E16V (X10), V0, V8 // 075405e0
|
||||
VLSEG8E32V (X10), V0, V8 // 076405e0
|
||||
VLSEG8E64V (X10), V0, V8 // 077405e0
|
||||
|
||||
VSSEG2E8V V24, (X10) // 270c0522
|
||||
VSSEG2E16V V24, (X10) // 275c0522
|
||||
VSSEG2E32V V24, (X10) // 276c0522
|
||||
VSSEG2E64V V24, (X10) // 277c0522
|
||||
VSSEG2E8V V24, V0, (X10) // 270c0520
|
||||
VSSEG2E16V V24, V0, (X10) // 275c0520
|
||||
VSSEG2E32V V24, V0, (X10) // 276c0520
|
||||
VSSEG2E64V V24, V0, (X10) // 277c0520
|
||||
|
||||
VSSEG3E8V V24, (X10) // 270c0542
|
||||
VSSEG3E16V V24, (X10) // 275c0542
|
||||
VSSEG3E32V V24, (X10) // 276c0542
|
||||
VSSEG3E64V V24, (X10) // 277c0542
|
||||
VSSEG3E8V V24, V0, (X10) // 270c0540
|
||||
VSSEG3E16V V24, V0, (X10) // 275c0540
|
||||
VSSEG3E32V V24, V0, (X10) // 276c0540
|
||||
VSSEG3E64V V24, V0, (X10) // 277c0540
|
||||
|
||||
VSSEG4E8V V24, (X10) // 270c0562
|
||||
VSSEG4E16V V24, (X10) // 275c0562
|
||||
VSSEG4E32V V24, (X10) // 276c0562
|
||||
VSSEG4E64V V24, (X10) // 277c0562
|
||||
VSSEG4E8V V24, V0, (X10) // 270c0560
|
||||
VSSEG4E16V V24, V0, (X10) // 275c0560
|
||||
VSSEG4E32V V24, V0, (X10) // 276c0560
|
||||
VSSEG4E64V V24, V0, (X10) // 277c0560
|
||||
|
||||
VSSEG5E8V V24, (X10) // 270c0582
|
||||
VSSEG5E16V V24, (X10) // 275c0582
|
||||
VSSEG5E32V V24, (X10) // 276c0582
|
||||
VSSEG5E64V V24, (X10) // 277c0582
|
||||
VSSEG5E8V V24, V0, (X10) // 270c0580
|
||||
VSSEG5E16V V24, V0, (X10) // 275c0580
|
||||
VSSEG5E32V V24, V0, (X10) // 276c0580
|
||||
VSSEG5E64V V24, V0, (X10) // 277c0580
|
||||
|
||||
VSSEG6E8V V24, (X10) // 270c05a2
|
||||
VSSEG6E16V V24, (X10) // 275c05a2
|
||||
VSSEG6E32V V24, (X10) // 276c05a2
|
||||
VSSEG6E64V V24, (X10) // 277c05a2
|
||||
VSSEG6E8V V24, V0, (X10) // 270c05a0
|
||||
VSSEG6E16V V24, V0, (X10) // 275c05a0
|
||||
VSSEG6E32V V24, V0, (X10) // 276c05a0
|
||||
VSSEG6E64V V24, V0, (X10) // 277c05a0
|
||||
|
||||
VSSEG7E8V V24, (X10) // 270c05c2
|
||||
VSSEG7E16V V24, (X10) // 275c05c2
|
||||
VSSEG7E32V V24, (X10) // 276c05c2
|
||||
VSSEG7E64V V24, (X10) // 277c05c2
|
||||
VSSEG7E8V V24, V0, (X10) // 270c05c0
|
||||
VSSEG7E16V V24, V0, (X10) // 275c05c0
|
||||
VSSEG7E32V V24, V0, (X10) // 276c05c0
|
||||
VSSEG7E64V V24, V0, (X10) // 277c05c0
|
||||
|
||||
VSSEG8E8V V24, (X10) // 270c05e2
|
||||
VSSEG8E16V V24, (X10) // 275c05e2
|
||||
VSSEG8E32V V24, (X10) // 276c05e2
|
||||
VSSEG8E64V V24, (X10) // 277c05e2
|
||||
VSSEG8E8V V24, V0, (X10) // 270c05e0
|
||||
VSSEG8E16V V24, V0, (X10) // 275c05e0
|
||||
VSSEG8E32V V24, V0, (X10) // 276c05e0
|
||||
VSSEG8E64V V24, V0, (X10) // 277c05e0
|
||||
|
||||
VLSEG2E8FFV (X10), V8 // 07040523
|
||||
VLSEG2E16FFV (X10), V8 // 07540523
|
||||
VLSEG2E32FFV (X10), V8 // 07640523
|
||||
VLSEG2E64FFV (X10), V8 // 07740523
|
||||
VLSEG2E8FFV (X10), V0, V8 // 07040521
|
||||
VLSEG2E16FFV (X10), V0, V8 // 07540521
|
||||
VLSEG2E32FFV (X10), V0, V8 // 07640521
|
||||
VLSEG2E64FFV (X10), V0, V8 // 07740521
|
||||
|
||||
VLSEG3E8FFV (X10), V8 // 07040543
|
||||
VLSEG3E16FFV (X10), V8 // 07540543
|
||||
VLSEG3E32FFV (X10), V8 // 07640543
|
||||
VLSEG3E64FFV (X10), V8 // 07740543
|
||||
VLSEG3E8FFV (X10), V0, V8 // 07040541
|
||||
VLSEG3E16FFV (X10), V0, V8 // 07540541
|
||||
VLSEG3E32FFV (X10), V0, V8 // 07640541
|
||||
VLSEG3E64FFV (X10), V0, V8 // 07740541
|
||||
|
||||
VLSEG4E8FFV (X10), V8 // 07040563
|
||||
VLSEG4E16FFV (X10), V8 // 07540563
|
||||
VLSEG4E32FFV (X10), V8 // 07640563
|
||||
VLSEG4E64FFV (X10), V8 // 07740563
|
||||
VLSEG4E8FFV (X10), V0, V8 // 07040561
|
||||
VLSEG4E16FFV (X10), V0, V8 // 07540561
|
||||
VLSEG4E32FFV (X10), V0, V8 // 07640561
|
||||
VLSEG4E64FFV (X10), V0, V8 // 07740561
|
||||
|
||||
VLSEG5E8FFV (X10), V8 // 07040583
|
||||
VLSEG5E16FFV (X10), V8 // 07540583
|
||||
VLSEG5E32FFV (X10), V8 // 07640583
|
||||
VLSEG5E64FFV (X10), V8 // 07740583
|
||||
VLSEG5E8FFV (X10), V0, V8 // 07040581
|
||||
VLSEG5E16FFV (X10), V0, V8 // 07540581
|
||||
VLSEG5E32FFV (X10), V0, V8 // 07640581
|
||||
VLSEG5E64FFV (X10), V0, V8 // 07740581
|
||||
|
||||
VLSEG6E8FFV (X10), V8 // 070405a3
|
||||
VLSEG6E16FFV (X10), V8 // 075405a3
|
||||
VLSEG6E32FFV (X10), V8 // 076405a3
|
||||
VLSEG6E64FFV (X10), V8 // 077405a3
|
||||
VLSEG6E8FFV (X10), V0, V8 // 070405a1
|
||||
VLSEG6E16FFV (X10), V0, V8 // 075405a1
|
||||
VLSEG6E32FFV (X10), V0, V8 // 076405a1
|
||||
VLSEG6E64FFV (X10), V0, V8 // 077405a1
|
||||
|
||||
VLSEG7E8FFV (X10), V8 // 070405c3
|
||||
VLSEG7E16FFV (X10), V8 // 075405c3
|
||||
VLSEG7E32FFV (X10), V8 // 076405c3
|
||||
VLSEG7E64FFV (X10), V8 // 077405c3
|
||||
VLSEG7E8FFV (X10), V0, V8 // 070405c1
|
||||
VLSEG7E16FFV (X10), V0, V8 // 075405c1
|
||||
VLSEG7E32FFV (X10), V0, V8 // 076405c1
|
||||
VLSEG7E64FFV (X10), V0, V8 // 077405c1
|
||||
|
||||
VLSEG8E8FFV (X10), V8 // 070405e3
|
||||
VLSEG8E16FFV (X10), V8 // 075405e3
|
||||
VLSEG8E32FFV (X10), V8 // 076405e3
|
||||
VLSEG8E64FFV (X10), V8 // 077405e3
|
||||
VLSEG8E8FFV (X10), V0, V8 // 070405e1
|
||||
VLSEG8E16FFV (X10), V0, V8 // 075405e1
|
||||
VLSEG8E32FFV (X10), V0, V8 // 076405e1
|
||||
VLSEG8E64FFV (X10), V0, V8 // 077405e1
|
||||
|
||||
// 31.7.8.2: Vector Strided Segment Loads and Stores
|
||||
VLSSEG2E8V (X10), X11, V8 // 0704b52a
|
||||
VLSSEG2E16V (X10), X11, V8 // 0754b52a
|
||||
VLSSEG2E32V (X10), X11, V8 // 0764b52a
|
||||
VLSSEG2E64V (X10), X11, V8 // 0774b52a
|
||||
VLSSEG2E8V (X10), X11, V0, V8 // 0704b528
|
||||
VLSSEG2E16V (X10), X11, V0, V8 // 0754b528
|
||||
VLSSEG2E32V (X10), X11, V0, V8 // 0764b528
|
||||
VLSSEG2E64V (X10), X11, V0, V8 // 0774b528
|
||||
|
||||
VLSSEG3E8V (X10), X11, V8 // 0704b54a
|
||||
VLSSEG3E16V (X10), X11, V8 // 0754b54a
|
||||
VLSSEG3E32V (X10), X11, V8 // 0764b54a
|
||||
VLSSEG3E64V (X10), X11, V8 // 0774b54a
|
||||
VLSSEG3E8V (X10), X11, V0, V8 // 0704b548
|
||||
VLSSEG3E16V (X10), X11, V0, V8 // 0754b548
|
||||
VLSSEG3E32V (X10), X11, V0, V8 // 0764b548
|
||||
VLSSEG3E64V (X10), X11, V0, V8 // 0774b548
|
||||
|
||||
VLSSEG4E8V (X10), X11, V8 // 0704b56a
|
||||
VLSSEG4E16V (X10), X11, V8 // 0754b56a
|
||||
VLSSEG4E32V (X10), X11, V8 // 0764b56a
|
||||
VLSSEG4E64V (X10), X11, V8 // 0774b56a
|
||||
VLSSEG4E8V (X10), X11, V0, V8 // 0704b568
|
||||
VLSSEG4E16V (X10), X11, V0, V8 // 0754b568
|
||||
VLSSEG4E32V (X10), X11, V0, V8 // 0764b568
|
||||
VLSSEG4E64V (X10), X11, V0, V8 // 0774b568
|
||||
|
||||
VLSSEG5E8V (X10), X11, V8 // 0704b58a
|
||||
VLSSEG5E16V (X10), X11, V8 // 0754b58a
|
||||
VLSSEG5E32V (X10), X11, V8 // 0764b58a
|
||||
VLSSEG5E64V (X10), X11, V8 // 0774b58a
|
||||
VLSSEG5E8V (X10), X11, V0, V8 // 0704b588
|
||||
VLSSEG5E16V (X10), X11, V0, V8 // 0754b588
|
||||
VLSSEG5E32V (X10), X11, V0, V8 // 0764b588
|
||||
VLSSEG5E64V (X10), X11, V0, V8 // 0774b588
|
||||
|
||||
VLSSEG6E8V (X10), X11, V8 // 0704b5aa
|
||||
VLSSEG6E16V (X10), X11, V8 // 0754b5aa
|
||||
VLSSEG6E32V (X10), X11, V8 // 0764b5aa
|
||||
VLSSEG6E64V (X10), X11, V8 // 0774b5aa
|
||||
VLSSEG6E8V (X10), X11, V0, V8 // 0704b5a8
|
||||
VLSSEG6E16V (X10), X11, V0, V8 // 0754b5a8
|
||||
VLSSEG6E32V (X10), X11, V0, V8 // 0764b5a8
|
||||
VLSSEG6E64V (X10), X11, V0, V8 // 0774b5a8
|
||||
|
||||
VLSSEG7E8V (X10), X11, V8 // 0704b5ca
|
||||
VLSSEG7E16V (X10), X11, V8 // 0754b5ca
|
||||
VLSSEG7E32V (X10), X11, V8 // 0764b5ca
|
||||
VLSSEG7E64V (X10), X11, V8 // 0774b5ca
|
||||
VLSSEG7E8V (X10), X11, V0, V8 // 0704b5c8
|
||||
VLSSEG7E16V (X10), X11, V0, V8 // 0754b5c8
|
||||
VLSSEG7E32V (X10), X11, V0, V8 // 0764b5c8
|
||||
VLSSEG7E64V (X10), X11, V0, V8 // 0774b5c8
|
||||
|
||||
VLSSEG8E8V (X10), X11, V8 // 0704b5ea
|
||||
VLSSEG8E16V (X10), X11, V8 // 0754b5ea
|
||||
VLSSEG8E32V (X10), X11, V8 // 0764b5ea
|
||||
VLSSEG8E64V (X10), X11, V8 // 0774b5ea
|
||||
VLSSEG8E8V (X10), X11, V0, V8 // 0704b5e8
|
||||
VLSSEG8E16V (X10), X11, V0, V8 // 0754b5e8
|
||||
VLSSEG8E32V (X10), X11, V0, V8 // 0764b5e8
|
||||
VLSSEG8E64V (X10), X11, V0, V8 // 0774b5e8
|
||||
|
||||
VSSSEG2E8V V24, X11, (X10) // 270cb52a
|
||||
VSSSEG2E16V V24, X11, (X10) // 275cb52a
|
||||
VSSSEG2E32V V24, X11, (X10) // 276cb52a
|
||||
VSSSEG2E64V V24, X11, (X10) // 277cb52a
|
||||
VSSSEG2E8V V24, X11, V0, (X10) // 270cb528
|
||||
VSSSEG2E16V V24, X11, V0, (X10) // 275cb528
|
||||
VSSSEG2E32V V24, X11, V0, (X10) // 276cb528
|
||||
VSSSEG2E64V V24, X11, V0, (X10) // 277cb528
|
||||
|
||||
VSSSEG3E8V V24, X11, (X10) // 270cb54a
|
||||
VSSSEG3E16V V24, X11, (X10) // 275cb54a
|
||||
VSSSEG3E32V V24, X11, (X10) // 276cb54a
|
||||
VSSSEG3E64V V24, X11, (X10) // 277cb54a
|
||||
VSSSEG3E8V V24, X11, V0, (X10) // 270cb548
|
||||
VSSSEG3E16V V24, X11, V0, (X10) // 275cb548
|
||||
VSSSEG3E32V V24, X11, V0, (X10) // 276cb548
|
||||
VSSSEG3E64V V24, X11, V0, (X10) // 277cb548
|
||||
|
||||
VSSSEG4E8V V24, X11, (X10) // 270cb56a
|
||||
VSSSEG4E16V V24, X11, (X10) // 275cb56a
|
||||
VSSSEG4E32V V24, X11, (X10) // 276cb56a
|
||||
VSSSEG4E64V V24, X11, (X10) // 277cb56a
|
||||
VSSSEG4E8V V24, X11, V0, (X10) // 270cb568
|
||||
VSSSEG4E16V V24, X11, V0, (X10) // 275cb568
|
||||
VSSSEG4E32V V24, X11, V0, (X10) // 276cb568
|
||||
VSSSEG4E64V V24, X11, V0, (X10) // 277cb568
|
||||
|
||||
VSSSEG5E8V V24, X11, (X10) // 270cb58a
|
||||
VSSSEG5E16V V24, X11, (X10) // 275cb58a
|
||||
VSSSEG5E32V V24, X11, (X10) // 276cb58a
|
||||
VSSSEG5E64V V24, X11, (X10) // 277cb58a
|
||||
VSSSEG5E8V V24, X11, V0, (X10) // 270cb588
|
||||
VSSSEG5E16V V24, X11, V0, (X10) // 275cb588
|
||||
VSSSEG5E32V V24, X11, V0, (X10) // 276cb588
|
||||
VSSSEG5E64V V24, X11, V0, (X10) // 277cb588
|
||||
|
||||
VSSSEG6E8V V24, X11, (X10) // 270cb5aa
|
||||
VSSSEG6E16V V24, X11, (X10) // 275cb5aa
|
||||
VSSSEG6E32V V24, X11, (X10) // 276cb5aa
|
||||
VSSSEG6E64V V24, X11, (X10) // 277cb5aa
|
||||
VSSSEG6E8V V24, X11, V0, (X10) // 270cb5a8
|
||||
VSSSEG6E16V V24, X11, V0, (X10) // 275cb5a8
|
||||
VSSSEG6E32V V24, X11, V0, (X10) // 276cb5a8
|
||||
VSSSEG6E64V V24, X11, V0, (X10) // 277cb5a8
|
||||
|
||||
VSSSEG7E8V V24, X11, (X10) // 270cb5ca
|
||||
VSSSEG7E16V V24, X11, (X10) // 275cb5ca
|
||||
VSSSEG7E32V V24, X11, (X10) // 276cb5ca
|
||||
VSSSEG7E64V V24, X11, (X10) // 277cb5ca
|
||||
VSSSEG7E8V V24, X11, V0, (X10) // 270cb5c8
|
||||
VSSSEG7E16V V24, X11, V0, (X10) // 275cb5c8
|
||||
VSSSEG7E32V V24, X11, V0, (X10) // 276cb5c8
|
||||
VSSSEG7E64V V24, X11, V0, (X10) // 277cb5c8
|
||||
|
||||
VSSSEG8E8V V24, X11, (X10) // 270cb5ea
|
||||
VSSSEG8E16V V24, X11, (X10) // 275cb5ea
|
||||
VSSSEG8E32V V24, X11, (X10) // 276cb5ea
|
||||
VSSSEG8E64V V24, X11, (X10) // 277cb5ea
|
||||
VSSSEG8E8V V24, X11, V0, (X10) // 270cb5e8
|
||||
VSSSEG8E16V V24, X11, V0, (X10) // 275cb5e8
|
||||
VSSSEG8E32V V24, X11, V0, (X10) // 276cb5e8
|
||||
VSSSEG8E64V V24, X11, V0, (X10) // 277cb5e8
|
||||
|
||||
// 31.7.8.3: Vector Indexed Segment Loads and Stores
|
||||
|
||||
VLUXSEG2EI8V (X10), V4, V8 // 07044526
|
||||
VLUXSEG2EI16V (X10), V4, V8 // 07544526
|
||||
VLUXSEG2EI32V (X10), V4, V8 // 07644526
|
||||
VLUXSEG2EI64V (X10), V4, V8 // 07744526
|
||||
VLUXSEG2EI8V (X10), V4, V0, V8 // 07044524
|
||||
VLUXSEG2EI16V (X10), V4, V0, V8 // 07544524
|
||||
VLUXSEG2EI32V (X10), V4, V0, V8 // 07644524
|
||||
VLUXSEG2EI64V (X10), V4, V0, V8 // 07744524
|
||||
|
||||
VLUXSEG3EI8V (X10), V4, V8 // 07044546
|
||||
VLUXSEG3EI16V (X10), V4, V8 // 07544546
|
||||
VLUXSEG3EI32V (X10), V4, V8 // 07644546
|
||||
VLUXSEG3EI64V (X10), V4, V8 // 07744546
|
||||
VLUXSEG3EI8V (X10), V4, V0, V8 // 07044544
|
||||
VLUXSEG3EI16V (X10), V4, V0, V8 // 07544544
|
||||
VLUXSEG3EI32V (X10), V4, V0, V8 // 07644544
|
||||
VLUXSEG3EI64V (X10), V4, V0, V8 // 07744544
|
||||
|
||||
VLUXSEG4EI8V (X10), V4, V8 // 07044566
|
||||
VLUXSEG4EI16V (X10), V4, V8 // 07544566
|
||||
VLUXSEG4EI32V (X10), V4, V8 // 07644566
|
||||
VLUXSEG4EI64V (X10), V4, V8 // 07744566
|
||||
VLUXSEG4EI8V (X10), V4, V0, V8 // 07044564
|
||||
VLUXSEG4EI16V (X10), V4, V0, V8 // 07544564
|
||||
VLUXSEG4EI32V (X10), V4, V0, V8 // 07644564
|
||||
VLUXSEG4EI64V (X10), V4, V0, V8 // 07744564
|
||||
|
||||
VLUXSEG5EI8V (X10), V4, V8 // 07044586
|
||||
VLUXSEG5EI16V (X10), V4, V8 // 07544586
|
||||
VLUXSEG5EI32V (X10), V4, V8 // 07644586
|
||||
VLUXSEG5EI64V (X10), V4, V8 // 07744586
|
||||
VLUXSEG5EI8V (X10), V4, V0, V8 // 07044584
|
||||
VLUXSEG5EI16V (X10), V4, V0, V8 // 07544584
|
||||
VLUXSEG5EI32V (X10), V4, V0, V8 // 07644584
|
||||
VLUXSEG5EI64V (X10), V4, V0, V8 // 07744584
|
||||
|
||||
VLUXSEG6EI8V (X10), V4, V8 // 070445a6
|
||||
VLUXSEG6EI16V (X10), V4, V8 // 075445a6
|
||||
VLUXSEG6EI32V (X10), V4, V8 // 076445a6
|
||||
VLUXSEG6EI64V (X10), V4, V8 // 077445a6
|
||||
VLUXSEG6EI8V (X10), V4, V0, V8 // 070445a4
|
||||
VLUXSEG6EI16V (X10), V4, V0, V8 // 075445a4
|
||||
VLUXSEG6EI32V (X10), V4, V0, V8 // 076445a4
|
||||
VLUXSEG6EI64V (X10), V4, V0, V8 // 077445a4
|
||||
|
||||
VLOXSEG6EI8V (X10), V4, V8 // 070445ae
|
||||
VLOXSEG6EI16V (X10), V4, V8 // 075445ae
|
||||
VLOXSEG6EI32V (X10), V4, V8 // 076445ae
|
||||
VLOXSEG6EI64V (X10), V4, V8 // 077445ae
|
||||
VLOXSEG6EI8V (X10), V4, V0, V8 // 070445ac
|
||||
VLOXSEG6EI16V (X10), V4, V0, V8 // 075445ac
|
||||
VLOXSEG6EI32V (X10), V4, V0, V8 // 076445ac
|
||||
VLOXSEG6EI64V (X10), V4, V0, V8 // 077445ac
|
||||
|
||||
VLUXSEG7EI8V (X10), V4, V8 // 070445c6
|
||||
VLUXSEG7EI16V (X10), V4, V8 // 075445c6
|
||||
VLUXSEG7EI32V (X10), V4, V8 // 076445c6
|
||||
VLUXSEG7EI64V (X10), V4, V8 // 077445c6
|
||||
VLUXSEG7EI8V (X10), V4, V0, V8 // 070445c4
|
||||
VLUXSEG7EI16V (X10), V4, V0, V8 // 075445c4
|
||||
VLUXSEG7EI32V (X10), V4, V0, V8 // 076445c4
|
||||
VLUXSEG7EI64V (X10), V4, V0, V8 // 077445c4
|
||||
|
||||
VLUXSEG8EI8V (X10), V4, V8 // 070445e6
|
||||
VLUXSEG8EI16V (X10), V4, V8 // 075445e6
|
||||
VLUXSEG8EI32V (X10), V4, V8 // 076445e6
|
||||
VLUXSEG8EI64V (X10), V4, V8 // 077445e6
|
||||
VLUXSEG8EI8V (X10), V4, V0, V8 // 070445e4
|
||||
VLUXSEG8EI16V (X10), V4, V0, V8 // 075445e4
|
||||
VLUXSEG8EI32V (X10), V4, V0, V8 // 076445e4
|
||||
VLUXSEG8EI64V (X10), V4, V0, V8 // 077445e4
|
||||
|
||||
VSUXSEG2EI8V V24, V4, (X10) // 270c4526
|
||||
VSUXSEG2EI16V V24, V4, (X10) // 275c4526
|
||||
VSUXSEG2EI32V V24, V4, (X10) // 276c4526
|
||||
VSUXSEG2EI64V V24, V4, (X10) // 277c4526
|
||||
VSUXSEG2EI8V V24, V4, V0, (X10) // 270c4524
|
||||
VSUXSEG2EI16V V24, V4, V0, (X10) // 275c4524
|
||||
VSUXSEG2EI32V V24, V4, V0, (X10) // 276c4524
|
||||
VSUXSEG2EI64V V24, V4, V0, (X10) // 277c4524
|
||||
|
||||
VSUXSEG3EI8V V24, V4, (X10) // 270c4546
|
||||
VSUXSEG3EI16V V24, V4, (X10) // 275c4546
|
||||
VSUXSEG3EI32V V24, V4, (X10) // 276c4546
|
||||
VSUXSEG3EI64V V24, V4, (X10) // 277c4546
|
||||
VSUXSEG3EI8V V24, V4, V0, (X10) // 270c4544
|
||||
VSUXSEG3EI16V V24, V4, V0, (X10) // 275c4544
|
||||
VSUXSEG3EI32V V24, V4, V0, (X10) // 276c4544
|
||||
VSUXSEG3EI64V V24, V4, V0, (X10) // 277c4544
|
||||
|
||||
VSUXSEG4EI8V V24, V4, (X10) // 270c4566
|
||||
VSUXSEG4EI16V V24, V4, (X10) // 275c4566
|
||||
VSUXSEG4EI32V V24, V4, (X10) // 276c4566
|
||||
VSUXSEG4EI64V V24, V4, (X10) // 277c4566
|
||||
VSUXSEG4EI8V V24, V4, V0, (X10) // 270c4564
|
||||
VSUXSEG4EI16V V24, V4, V0, (X10) // 275c4564
|
||||
VSUXSEG4EI32V V24, V4, V0, (X10) // 276c4564
|
||||
VSUXSEG4EI64V V24, V4, V0, (X10) // 277c4564
|
||||
|
||||
VSUXSEG5EI8V V24, V4, (X10) // 270c4586
|
||||
VSUXSEG5EI16V V24, V4, (X10) // 275c4586
|
||||
VSUXSEG5EI32V V24, V4, (X10) // 276c4586
|
||||
VSUXSEG5EI64V V24, V4, (X10) // 277c4586
|
||||
VSUXSEG5EI8V V24, V4, V0, (X10) // 270c4584
|
||||
VSUXSEG5EI16V V24, V4, V0, (X10) // 275c4584
|
||||
VSUXSEG5EI32V V24, V4, V0, (X10) // 276c4584
|
||||
VSUXSEG5EI64V V24, V4, V0, (X10) // 277c4584
|
||||
|
||||
VSUXSEG6EI8V V24, V4, (X10) // 270c45a6
|
||||
VSUXSEG6EI16V V24, V4, (X10) // 275c45a6
|
||||
VSUXSEG6EI32V V24, V4, (X10) // 276c45a6
|
||||
VSUXSEG6EI64V V24, V4, (X10) // 277c45a6
|
||||
VSUXSEG6EI8V V24, V4, V0, (X10) // 270c45a4
|
||||
VSUXSEG6EI16V V24, V4, V0, (X10) // 275c45a4
|
||||
VSUXSEG6EI32V V24, V4, V0, (X10) // 276c45a4
|
||||
VSUXSEG6EI64V V24, V4, V0, (X10) // 277c45a4
|
||||
|
||||
VSUXSEG7EI8V V24, V4, (X10) // 270c45c6
|
||||
VSUXSEG7EI16V V24, V4, (X10) // 275c45c6
|
||||
VSUXSEG7EI32V V24, V4, (X10) // 276c45c6
|
||||
VSUXSEG7EI64V V24, V4, (X10) // 277c45c6
|
||||
VSUXSEG7EI8V V24, V4, V0, (X10) // 270c45c4
|
||||
VSUXSEG7EI16V V24, V4, V0, (X10) // 275c45c4
|
||||
VSUXSEG7EI32V V24, V4, V0, (X10) // 276c45c4
|
||||
VSUXSEG7EI64V V24, V4, V0, (X10) // 277c45c4
|
||||
|
||||
VSUXSEG8EI8V V24, V4, (X10) // 270c45e6
|
||||
VSUXSEG8EI16V V24, V4, (X10) // 275c45e6
|
||||
VSUXSEG8EI32V V24, V4, (X10) // 276c45e6
|
||||
VSUXSEG8EI64V V24, V4, (X10) // 277c45e6
|
||||
VSUXSEG8EI8V V24, V4, V0, (X10) // 270c45e4
|
||||
VSUXSEG8EI16V V24, V4, V0, (X10) // 275c45e4
|
||||
VSUXSEG8EI32V V24, V4, V0, (X10) // 276c45e4
|
||||
VSUXSEG8EI64V V24, V4, V0, (X10) // 277c45e4
|
||||
|
||||
VLOXSEG2EI8V (X10), V4, V8 // 0704452e
|
||||
VLOXSEG2EI16V (X10), V4, V8 // 0754452e
|
||||
VLOXSEG2EI32V (X10), V4, V8 // 0764452e
|
||||
VLOXSEG2EI64V (X10), V4, V8 // 0774452e
|
||||
VLOXSEG2EI8V (X10), V4, V0, V8 // 0704452c
|
||||
VLOXSEG2EI16V (X10), V4, V0, V8 // 0754452c
|
||||
VLOXSEG2EI32V (X10), V4, V0, V8 // 0764452c
|
||||
VLOXSEG2EI64V (X10), V4, V0, V8 // 0774452c
|
||||
|
||||
VLOXSEG3EI8V (X10), V4, V8 // 0704454e
|
||||
VLOXSEG3EI16V (X10), V4, V8 // 0754454e
|
||||
VLOXSEG3EI32V (X10), V4, V8 // 0764454e
|
||||
VLOXSEG3EI64V (X10), V4, V8 // 0774454e
|
||||
VLOXSEG3EI8V (X10), V4, V0, V8 // 0704454c
|
||||
VLOXSEG3EI16V (X10), V4, V0, V8 // 0754454c
|
||||
VLOXSEG3EI32V (X10), V4, V0, V8 // 0764454c
|
||||
VLOXSEG3EI64V (X10), V4, V0, V8 // 0774454c
|
||||
VLOXSEG4EI8V (X10), V4, V8 // 0704456e
|
||||
VLOXSEG4EI16V (X10), V4, V8 // 0754456e
|
||||
VLOXSEG4EI32V (X10), V4, V8 // 0764456e
|
||||
VLOXSEG4EI64V (X10), V4, V8 // 0774456e
|
||||
VLOXSEG4EI8V (X10), V4, V0, V8 // 0704456c
|
||||
VLOXSEG4EI16V (X10), V4, V0, V8 // 0754456c
|
||||
VLOXSEG4EI32V (X10), V4, V0, V8 // 0764456c
|
||||
VLOXSEG4EI64V (X10), V4, V0, V8 // 0774456c
|
||||
|
||||
VLOXSEG5EI8V (X10), V4, V8 // 0704458e
|
||||
VLOXSEG5EI16V (X10), V4, V8 // 0754458e
|
||||
VLOXSEG5EI32V (X10), V4, V8 // 0764458e
|
||||
VLOXSEG5EI64V (X10), V4, V8 // 0774458e
|
||||
VLOXSEG5EI8V (X10), V4, V0, V8 // 0704458c
|
||||
VLOXSEG5EI16V (X10), V4, V0, V8 // 0754458c
|
||||
VLOXSEG5EI32V (X10), V4, V0, V8 // 0764458c
|
||||
VLOXSEG5EI64V (X10), V4, V0, V8 // 0774458c
|
||||
|
||||
VLOXSEG7EI8V (X10), V4, V8 // 070445ce
|
||||
VLOXSEG7EI16V (X10), V4, V8 // 075445ce
|
||||
VLOXSEG7EI32V (X10), V4, V8 // 076445ce
|
||||
VLOXSEG7EI64V (X10), V4, V8 // 077445ce
|
||||
VLOXSEG7EI8V (X10), V4, V0, V8 // 070445cc
|
||||
VLOXSEG7EI16V (X10), V4, V0, V8 // 075445cc
|
||||
VLOXSEG7EI32V (X10), V4, V0, V8 // 076445cc
|
||||
VLOXSEG7EI64V (X10), V4, V0, V8 // 077445cc
|
||||
|
||||
VLOXSEG8EI8V (X10), V4, V8 // 070445ee
|
||||
VLOXSEG8EI16V (X10), V4, V8 // 075445ee
|
||||
VLOXSEG8EI32V (X10), V4, V8 // 076445ee
|
||||
VLOXSEG8EI64V (X10), V4, V8 // 077445ee
|
||||
VLOXSEG8EI8V (X10), V4, V0, V8 // 070445ec
|
||||
VLOXSEG8EI16V (X10), V4, V0, V8 // 075445ec
|
||||
VLOXSEG8EI32V (X10), V4, V0, V8 // 076445ec
|
||||
VLOXSEG8EI64V (X10), V4, V0, V8 // 077445ec
|
||||
|
||||
VSOXSEG2EI8V V24, V4, (X10) // 270c452e
|
||||
VSOXSEG2EI16V V24, V4, (X10) // 275c452e
|
||||
VSOXSEG2EI32V V24, V4, (X10) // 276c452e
|
||||
VSOXSEG2EI64V V24, V4, (X10) // 277c452e
|
||||
VSOXSEG2EI8V V24, V4, V0, (X10) // 270c452c
|
||||
VSOXSEG2EI16V V24, V4, V0, (X10) // 275c452c
|
||||
VSOXSEG2EI32V V24, V4, V0, (X10) // 276c452c
|
||||
VSOXSEG2EI64V V24, V4, V0, (X10) // 277c452c
|
||||
|
||||
VSOXSEG3EI8V V24, V4, (X10) // 270c454e
|
||||
VSOXSEG3EI16V V24, V4, (X10) // 275c454e
|
||||
VSOXSEG3EI32V V24, V4, (X10) // 276c454e
|
||||
VSOXSEG3EI64V V24, V4, (X10) // 277c454e
|
||||
VSOXSEG3EI8V V24, V4, V0, (X10) // 270c454c
|
||||
VSOXSEG3EI16V V24, V4, V0, (X10) // 275c454c
|
||||
VSOXSEG3EI32V V24, V4, V0, (X10) // 276c454c
|
||||
VSOXSEG3EI64V V24, V4, V0, (X10) // 277c454c
|
||||
|
||||
VSOXSEG4EI8V V24, V4, (X10) // 270c456e
|
||||
VSOXSEG4EI16V V24, V4, (X10) // 275c456e
|
||||
VSOXSEG4EI32V V24, V4, (X10) // 276c456e
|
||||
VSOXSEG4EI64V V24, V4, (X10) // 277c456e
|
||||
VSOXSEG4EI8V V24, V4, V0, (X10) // 270c456c
|
||||
VSOXSEG4EI16V V24, V4, V0, (X10) // 275c456c
|
||||
VSOXSEG4EI32V V24, V4, V0, (X10) // 276c456c
|
||||
VSOXSEG4EI64V V24, V4, V0, (X10) // 277c456c
|
||||
|
||||
VSOXSEG5EI8V V24, V4, (X10) // 270c458e
|
||||
VSOXSEG5EI16V V24, V4, (X10) // 275c458e
|
||||
VSOXSEG5EI32V V24, V4, (X10) // 276c458e
|
||||
VSOXSEG5EI64V V24, V4, (X10) // 277c458e
|
||||
VSOXSEG5EI8V V24, V4, V0, (X10) // 270c458c
|
||||
VSOXSEG5EI16V V24, V4, V0, (X10) // 275c458c
|
||||
VSOXSEG5EI32V V24, V4, V0, (X10) // 276c458c
|
||||
VSOXSEG5EI64V V24, V4, V0, (X10) // 277c458c
|
||||
|
||||
VSOXSEG6EI8V V24, V4, (X10) // 270c45ae
|
||||
VSOXSEG6EI16V V24, V4, (X10) // 275c45ae
|
||||
VSOXSEG6EI32V V24, V4, (X10) // 276c45ae
|
||||
VSOXSEG6EI64V V24, V4, (X10) // 277c45ae
|
||||
VSOXSEG6EI8V V24, V4, V0, (X10) // 270c45ac
|
||||
VSOXSEG6EI16V V24, V4, V0, (X10) // 275c45ac
|
||||
VSOXSEG6EI32V V24, V4, V0, (X10) // 276c45ac
|
||||
VSOXSEG6EI64V V24, V4, V0, (X10) // 277c45ac
|
||||
|
||||
VSOXSEG7EI8V V24, V4, (X10) // 270c45ce
|
||||
VSOXSEG7EI16V V24, V4, (X10) // 275c45ce
|
||||
VSOXSEG7EI32V V24, V4, (X10) // 276c45ce
|
||||
VSOXSEG7EI64V V24, V4, (X10) // 277c45ce
|
||||
VSOXSEG7EI8V V24, V4, V0, (X10) // 270c45cc
|
||||
VSOXSEG7EI16V V24, V4, V0, (X10) // 275c45cc
|
||||
VSOXSEG7EI32V V24, V4, V0, (X10) // 276c45cc
|
||||
VSOXSEG7EI64V V24, V4, V0, (X10) // 277c45cc
|
||||
|
||||
VSOXSEG8EI8V V24, V4, (X10) // 270c45ee
|
||||
VSOXSEG8EI16V V24, V4, (X10) // 275c45ee
|
||||
VSOXSEG8EI32V V24, V4, (X10) // 276c45ee
|
||||
VSOXSEG8EI64V V24, V4, (X10) // 277c45ee
|
||||
VSOXSEG8EI8V V24, V4, V0, (X10) // 270c45ec
|
||||
VSOXSEG8EI16V V24, V4, V0, (X10) // 275c45ec
|
||||
VSOXSEG8EI32V V24, V4, V0, (X10) // 276c45ec
|
||||
VSOXSEG8EI64V V24, V4, V0, (X10) // 277c45ec
|
||||
|
||||
// 31.7.9: Vector Load/Store Whole Register Instructions
|
||||
VL1RV (X10), V3 // 87018502
|
||||
VL1RE8V (X10), V3 // 87018502
|
||||
@@ -2038,23 +1357,12 @@ start:
|
||||
MOVF 4(X5), F0 // 07a04200
|
||||
MOVF F0, 4(X5) // 27a20200
|
||||
MOVF F0, F1 // d3000020
|
||||
MOVF X1, F3 // d38100f0
|
||||
MOVF F3, X1 // d38001e0
|
||||
MOVF X0, F3 // d30100f0
|
||||
MOVF $(0.0), F3 // d30100f0
|
||||
|
||||
// Converted to load of symbol (AUIPC + FLW)
|
||||
MOVF $(709.78271289338397), F3 // 970f000087a10f00
|
||||
|
||||
MOVD 4(X5), F0 // 07b04200
|
||||
MOVD F0, 4(X5) // 27b20200
|
||||
MOVD F0, F1 // d3000022
|
||||
MOVD F3, X1 // d38001e2
|
||||
MOVD X1, F3 // d38100f2
|
||||
MOVD X0, F3 // d30100f2
|
||||
MOVD $(0.0), F3 // d30100f2
|
||||
|
||||
// Converted to load of symbol (AUIPC + FLD)
|
||||
// Convert to load of symbol (AUIPC + FLD)
|
||||
MOVD $(709.78271289338397), F3 // 970f000087b10f00
|
||||
|
||||
// TLS load with local-exec (LUI + ADDIW + ADD of TP + load)
|
||||
|
||||
31
src/cmd/asm/internal/asm/testdata/riscv64error.s
vendored
31
src/cmd/asm/internal/asm/testdata/riscv64error.s
vendored
@@ -3,27 +3,6 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
TEXT errors(SB),$0
|
||||
CSRRC (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
|
||||
CSRRC X0, TU, X5 // ERROR "unknown CSR"
|
||||
CSRRC X0, CYCLE // ERROR "missing CSR name"
|
||||
CSRRC X0, CYCLE, (X10) // ERROR "needs an integer register output"
|
||||
CSRRC $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRCI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRCI $1, TIME, (X15) // ERROR "needs an integer register output"
|
||||
CSRRS (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
|
||||
CSRRS X0, CYCLE, (X10) // ERROR "needs an integer register output"
|
||||
CSRRS X0, TU, X5 // ERROR "unknown CSR"
|
||||
CSRRS X0, CYCLE // ERROR "missing CSR name"
|
||||
CSRRS $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRSI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRSI $1, TIME, (X15) // ERROR "needs an integer register output"
|
||||
CSRRW (X10), CYCLE, X5 // ERROR "integer register or immediate expected for 1st operand"
|
||||
CSRRW X0, TU, X5 // ERROR "unknown CSR"
|
||||
CSRRW X0, CYCLE // ERROR "missing CSR name"
|
||||
CSRRW X0, CYCLE, (X5) // ERROR "needs an integer register output"
|
||||
CSRRW $-1, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRWI $32, TIME, X15 // ERROR "immediate out of range 0 to 31"
|
||||
CSRRWI $1, TIME, (X15) // ERROR "needs an integer register output"
|
||||
MOV $errors(SB), (X5) // ERROR "address load must target register"
|
||||
MOV $8(SP), (X5) // ERROR "address load must target register"
|
||||
MOVB $8(SP), X5 // ERROR "unsupported address load"
|
||||
@@ -73,7 +52,6 @@ TEXT errors(SB),$0
|
||||
//
|
||||
VSETIVLI X10, E32, M2, TA, MA, X12 // ERROR "expected immediate value"
|
||||
VLE8V (X10), V1, V3 // ERROR "invalid vector mask register"
|
||||
VLE8FFV (X10), V1, V3 // ERROR "invalid vector mask register"
|
||||
VSE8V V3, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLSE8V (X10), X10, V1, V3 // ERROR "invalid vector mask register"
|
||||
VSSE8V V3, X11, V1, (X10) // ERROR "invalid vector mask register"
|
||||
@@ -81,15 +59,6 @@ TEXT errors(SB),$0
|
||||
VSUXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLOXEI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
|
||||
VSOXEI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLSEG2E8V (X10), V1, V3 // ERROR "invalid vector mask register"
|
||||
VLSEG2E8FFV (X10), V1, V3 // ERROR "invalid vector mask register"
|
||||
VSSEG2E8V V3, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLSSEG2E8V (X10), X10, V1, V3 // ERROR "invalid vector mask register"
|
||||
VSSSEG2E8V V3, X11, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLUXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
|
||||
VSUXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VLOXSEG2EI8V (X10), V2, V1, V3 // ERROR "invalid vector mask register"
|
||||
VSOXSEG2EI8V V3, V2, V1, (X10) // ERROR "invalid vector mask register"
|
||||
VL1RV (X10), V0, V3 // ERROR "too many operands for instruction"
|
||||
VS1RV V3, V0, (X11) // ERROR "too many operands for instruction"
|
||||
VADDVV V1, V2, V4, V3 // ERROR "invalid vector mask register"
|
||||
|
||||
@@ -12,147 +12,6 @@ TEXT validation(SB),$0
|
||||
SRLI $1, X5, F1 // ERROR "expected integer register in rd position but got non-integer register F1"
|
||||
SRLI $1, F1, X5 // ERROR "expected integer register in rs1 position but got non-integer register F1"
|
||||
|
||||
WORD $-1 // ERROR "must be in range [0x0, 0xffffffff]"
|
||||
WORD $0x100000000 // ERROR "must be in range [0x0, 0xffffffff]"
|
||||
|
||||
//
|
||||
// "C" Extension for Compressed Instructions, Version 2.0
|
||||
//
|
||||
CLWSP 20(X5), X10 // ERROR "rs2 must be SP/X2"
|
||||
CLWSP 20(SP), X0 // ERROR "cannot use register X0"
|
||||
CLWSP 20(SP), F10 // ERROR "expected integer register in rd position"
|
||||
CLWSP 22(SP), X10 // ERROR "must be a multiple of 4"
|
||||
CLDSP 24(X5), X10 // ERROR "rs2 must be SP/X2"
|
||||
CLDSP 24(SP), X0 // ERROR "cannot use register X0"
|
||||
CLDSP 24(SP), F10 // ERROR "expected integer register in rd position"
|
||||
CLDSP 28(SP), X10 // ERROR "must be a multiple of 8"
|
||||
CFLDSP 32(X5), F10 // ERROR "rs2 must be SP/X2"
|
||||
CFLDSP 32(SP), X10 // ERROR "expected float register in rd position"
|
||||
CFLDSP 36(SP), F10 // ERROR "must be a multiple of 8"
|
||||
CSWSP X10, 20(X5) // ERROR "rd must be SP/X2"
|
||||
CSWSP F10, 20(SP) // ERROR "expected integer register in rs2 position"
|
||||
CSWSP X10, 22(SP) // ERROR "must be a multiple of 4"
|
||||
CSDSP X10, 24(X5) // ERROR "rd must be SP/X2"
|
||||
CSDSP F10, 24(SP) // ERROR "expected integer register in rs2 position"
|
||||
CSDSP X10, 28(SP) // ERROR "must be a multiple of 8"
|
||||
CFSDSP F10, 32(X5) // ERROR "rd must be SP/X2"
|
||||
CFSDSP X10, 32(SP) // ERROR "expected float register in rs2 position"
|
||||
CFSDSP F10, 36(SP) // ERROR "must be a multiple of 8"
|
||||
CLW 20(X10), F11 // ERROR "expected integer prime register in rd position"
|
||||
CLW 20(X5), X11 // ERROR "expected integer prime register in rs1 position"
|
||||
CLW 20(X10), X5 // ERROR "expected integer prime register in rd position"
|
||||
CLW -1(X10), X11 // ERROR "must be in range [0, 127]"
|
||||
CLW 22(X10), X11 // ERROR "must be a multiple of 4"
|
||||
CLW 128(X10), X11 // ERROR "must be in range [0, 127]"
|
||||
CLD 24(X10), F11 // ERROR "expected integer prime register in rd position"
|
||||
CLD 24(X5), X11 // ERROR "expected integer prime register in rs1 position"
|
||||
CLD -1(X10), X11 // ERROR "must be in range [0, 255]"
|
||||
CLD 30(X10), X11 // ERROR "must be a multiple of 8"
|
||||
CLD 256(X10), X11 // ERROR "must be in range [0, 255]"
|
||||
CFLD 32(X10), X11 // ERROR "expected float prime register in rd position"
|
||||
CFLD 32(X5), F11 // ERROR "expected integer prime register in rs1 position"
|
||||
CFLD -1(X10), F11 // ERROR "must be in range [0, 255]"
|
||||
CFLD 34(X10), F11 // ERROR "must be a multiple of 8"
|
||||
CFLD 256(X10), F11 // ERROR "must be in range [0, 255]"
|
||||
CSW F11, 20(X10) // ERROR "expected integer prime register in rs2 position"
|
||||
CSW X11, -1(X10) // ERROR "must be in range [0, 127]"
|
||||
CSW X11, 22(X10) // ERROR "must be a multiple of 4"
|
||||
CSW X11, 128(X10) // ERROR "must be in range [0, 127]"
|
||||
CSD F11, 24(X10) // ERROR "expected integer prime register in rs2 position"
|
||||
CSD X11, -1(X10) // ERROR "must be in range [0, 255]"
|
||||
CSD X11, 28(X10) // ERROR "must be a multiple of 8"
|
||||
CSD X11, 256(X10) // ERROR "must be in range [0, 255]"
|
||||
CFSD X11, 32(X10) // ERROR "expected float prime register in rs2 position"
|
||||
CFSD F11, -1(X10) // ERROR "must be in range [0, 255]"
|
||||
CFSD F11, 36(X10) // ERROR "must be a multiple of 8"
|
||||
CFSD F11, 256(X10) // ERROR "must be in range [0, 255]"
|
||||
CJR X0 // ERROR "cannot use register X0 in rs1"
|
||||
CJR X10, X11 // ERROR "expected no register in rs2"
|
||||
CJALR X0 // ERROR "cannot use register X0 in rs1"
|
||||
CJALR X10, X11 // ERROR "expected no register in rd"
|
||||
CBEQZ X5, 1(PC) // ERROR "expected integer prime register in rs1"
|
||||
CBNEZ X5, 1(PC) // ERROR "expected integer prime register in rs1"
|
||||
CLI $3, X0 // ERROR "cannot use register X0 in rd"
|
||||
CLI $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CLI $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CLUI $0, X5 // ERROR "immediate cannot be zero"
|
||||
CLUI $3, X0 // ERROR "cannot use register X0 in rd"
|
||||
CLUI $3, X2 // ERROR "cannot use register SP/X2 in rd"
|
||||
CLUI $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CLUI $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADD $31, X5, X6 // ERROR "rd must be the same as rs1"
|
||||
CADD $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADD $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDI $0, X5 // ERROR "immediate cannot be zero"
|
||||
CADDI $31, X5, X6 // ERROR "rd must be the same as rs1"
|
||||
CADDI $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDI $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDW $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDW $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDIW $-33, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDIW $32, X5 // ERROR "must be in range [-32, 31]"
|
||||
CADDI16SP $0, SP // ERROR "immediate cannot be zero"
|
||||
CADDI16SP $16, X5 // ERROR "rd must be SP/X2"
|
||||
CADDI16SP $-513, SP // ERROR "must be in range [-512, 511]"
|
||||
CADDI16SP $20, SP // ERROR "must be a multiple of 16"
|
||||
CADDI16SP $512, SP // ERROR "must be in range [-512, 511]"
|
||||
CADDI4SPN $4, SP, X5 // ERROR "expected integer prime register in rd"
|
||||
CADDI4SPN $4, X5, X10 // ERROR "SP/X2 must be in rs1"
|
||||
CADDI4SPN $-1, SP, X10 // ERROR "must be in range [0, 1023]"
|
||||
CADDI4SPN $0, SP, X10 // ERROR "immediate cannot be zero"
|
||||
CADDI4SPN $6, SP, X10 // ERROR "must be a multiple of 4"
|
||||
CADDI4SPN $1024, SP, X10 // ERROR "must be in range [0, 1023]"
|
||||
CSLLI $63, X5, X6 // ERROR "rd must be the same as rs1"
|
||||
CSLLI $-1, X5 // ERROR "must be in range [0, 63]"
|
||||
CSLLI $0, X5 // ERROR "immediate cannot be zero"
|
||||
CSLLI $64, X5 // ERROR "must be in range [0, 63]"
|
||||
CSRLI $63, X10, X11 // ERROR "rd must be the same as rs1"
|
||||
CSRLI $63, X5 // ERROR "expected integer prime register in rd"
|
||||
CSRLI $-1, X10 // ERROR "must be in range [0, 63]"
|
||||
CSRLI $0, X10 // ERROR "immediate cannot be zero"
|
||||
CSRLI $64, X10 // ERROR "must be in range [0, 63]"
|
||||
CSRAI $63, X10, X11 // ERROR "rd must be the same as rs1"
|
||||
CSRAI $63, X5 // ERROR "expected integer prime register in rd"
|
||||
CSRAI $-1, X10 // ERROR "must be in range [0, 63]"
|
||||
CSRAI $0, X10 // ERROR "immediate cannot be zero"
|
||||
CSRAI $64, X10 // ERROR "must be in range [0, 63]"
|
||||
CAND $1, X10, X11 // ERROR "rd must be the same as rs1"
|
||||
CAND $1, X5 // ERROR "expected integer prime register in rd"
|
||||
CAND $-64, X10 // ERROR "must be in range [-32, 31]"
|
||||
CAND $63, X10 // ERROR "must be in range [-32, 31]"
|
||||
CANDI $1, X10, X11 // ERROR "rd must be the same as rs1"
|
||||
CANDI $1, X5 // ERROR "expected integer prime register in rd"
|
||||
CANDI $-64, X10 // ERROR "must be in range [-32, 31]"
|
||||
CANDI $63, X10 // ERROR "must be in range [-32, 31]"
|
||||
CMV X0, X5 // ERROR "cannot use register X0 in rs2"
|
||||
CMV X5, X6, X7 // ERROR "expected no register in rs1"
|
||||
CMV X5, X0 // ERROR "cannot use register X0 in rd"
|
||||
CMV F1, X5 // ERROR "expected integer register in rs2"
|
||||
CMV X5, F1 // ERROR "expected integer register in rd"
|
||||
CADD X5, X6, X7 // ERROR "rd must be the same as rs1"
|
||||
CADD X0, X8 // ERROR "cannot use register X0 in rs2"
|
||||
CADD X8, X0 // ERROR "cannot use register X0 in rd"
|
||||
CAND X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
CAND X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
CAND X10, X5 // ERROR "expected integer prime register in rd"
|
||||
COR X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
COR X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
COR X10, X5 // ERROR "expected integer prime register in rd"
|
||||
CXOR X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
CXOR X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
CXOR X10, X5 // ERROR "expected integer prime register in rd"
|
||||
CSUB X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
CSUB X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
CSUB X10, X5 // ERROR "expected integer prime register in rd"
|
||||
CADDW X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
CADDW X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
CADDW X10, X5 // ERROR "expected integer prime register in rd"
|
||||
CSUBW X10, X11, X12 // ERROR "rd must be the same as rs1"
|
||||
CSUBW X5, X11 // ERROR "expected integer prime register in rs2"
|
||||
CSUBW X10, X5 // ERROR "expected integer prime register in rd"
|
||||
CNOP X10 // ERROR "expected no register in rs2"
|
||||
CEBREAK X10 // ERROR "expected no register in rs2"
|
||||
|
||||
//
|
||||
// "V" Standard Extension for Vector Operations, Version 1.0
|
||||
//
|
||||
@@ -161,8 +20,6 @@ TEXT validation(SB),$0
|
||||
VSETVL X10, X11 // ERROR "expected integer register in rs1 position"
|
||||
VLE8V (X10), X10 // ERROR "expected vector register in vd position"
|
||||
VLE8V (V1), V3 // ERROR "expected integer register in rs1 position"
|
||||
VLE8FFV (X10), X10 // ERROR "expected vector register in vd position"
|
||||
VLE8FFV (V1), V3 // ERROR "expected integer register in rs1 position"
|
||||
VSE8V X10, (X10) // ERROR "expected vector register in vs1 position"
|
||||
VSE8V V3, (V1) // ERROR "expected integer register in rd position"
|
||||
VLSE8V (X10), V3 // ERROR "expected integer register in rs2 position"
|
||||
@@ -186,33 +43,6 @@ TEXT validation(SB),$0
|
||||
VSOXEI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
|
||||
VSOXEI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
|
||||
VSOXEI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
|
||||
VLSEG2E8V (X10), X10 // ERROR "expected vector register in vd position"
|
||||
VLSEG2E8V (V1), V3 // ERROR "expected integer register in rs1 position"
|
||||
VLSEG2E8FFV (X10), X10 // ERROR "expected vector register in vd position"
|
||||
VLSEG2E8FFV (V1), V3 // ERROR "expected integer register in rs1 position"
|
||||
VSSEG2E8V X10, (X10) // ERROR "expected vector register in vs1 position"
|
||||
VSSEG2E8V V3, (V1) // ERROR "expected integer register in rd position"
|
||||
VLSSEG2E8V (X10), V3 // ERROR "expected integer register in rs2 position"
|
||||
VLSSEG2E8V (X10), X10, X11 // ERROR "expected vector register in vd position"
|
||||
VLSSEG2E8V (V1), X10, V3 // ERROR "expected integer register in rs1 position"
|
||||
VLSSEG2E8V (X10), V1, V0, V3 // ERROR "expected integer register in rs2 position"
|
||||
VSSSEG2E8V V3, (X10) // ERROR "expected integer register in rs2 position"
|
||||
VSSSEG2E8V X10, X11, (X10) // ERROR "expected vector register in vd position"
|
||||
VSSSEG2E8V V3, X11, (V1) // ERROR "expected integer register in rs1 position"
|
||||
VSSSEG2E8V V3, V1, V0, (X10) // ERROR "expected integer register in rs2 position"
|
||||
VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
|
||||
VLUXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
|
||||
VLUXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position"
|
||||
VLUXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position"
|
||||
VSUXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
|
||||
VSUXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
|
||||
VSUXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
|
||||
VLOXSEG2EI8V (X10), V2, X11 // ERROR "expected vector register in vd position"
|
||||
VLOXSEG2EI8V (V1), V2, V3 // ERROR "expected integer register in rs1 position"
|
||||
VLOXSEG2EI8V (X10), X11, V0, V3 // ERROR "expected vector register in vs2 position"
|
||||
VSOXSEG2EI8V X10, V2, (X10) // ERROR "expected vector register in vd position"
|
||||
VSOXSEG2EI8V V3, V2, (V1) // ERROR "expected integer register in rs1 position"
|
||||
VSOXSEG2EI8V V3, X11, V0, (X10) // ERROR "expected vector register in vs2 position"
|
||||
VL1RV (X10), X10 // ERROR "expected vector register in vd position"
|
||||
VL1RV (V1), V3 // ERROR "expected integer register in rs1 position"
|
||||
VS1RV X11, (X11) // ERROR "expected vector register in vs1 position"
|
||||
|
||||
19
src/cmd/asm/internal/asm/testdata/s390x.s
vendored
19
src/cmd/asm/internal/asm/testdata/s390x.s
vendored
@@ -263,15 +263,10 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
|
||||
NC $8, (R15), n-8(SP) // d407f010f000
|
||||
OC $8, (R15), n-8(SP) // d607f010f000
|
||||
MVC $8, (R15), n-8(SP) // d207f010f000
|
||||
MVC $256, 8192(R1), 8192(R2) // b90400a2c2a800002000b90400b1c2b800002000d2ffa000b000
|
||||
MVCIN $8, (R15), n-8(SP) // e807f010f000
|
||||
CLC $8, (R15), n-8(SP) // d507f000f010
|
||||
XC $256, -8(R15), -8(R15) // b90400afc2a8fffffff8d7ffa000a000
|
||||
MVCLE 0, R4, R6 // a8640000
|
||||
MVCLE 4095, R4, R6 // a8640fff
|
||||
MVCLE $4095, R4, R6 // a8640fff
|
||||
MVCLE (R3), R4, R6 // a8643000
|
||||
MVCLE 10(R3), R4, R6 // a864300a
|
||||
MVC $256, 8192(R1), 8192(R2) // b90400a2c2a800002000b90400b1c2b800002000d2ffa000b000
|
||||
|
||||
CMP R1, R2 // b9200012
|
||||
CMP R3, $32767 // a73f7fff
|
||||
@@ -540,18 +535,6 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
|
||||
VSTRCZBS V18, V20, V22, V24 // e78240306f8a
|
||||
VSTRCZHS V18, V20, V22, V24 // e78241306f8a
|
||||
VSTRCZFS V18, V20, V22, V24 // e78242306f8a
|
||||
VFMAXSB $1, V2, V3, V4 // e742301020ef
|
||||
WFMAXSB $2, V5, V6, V7 // e775602820ef
|
||||
WFMAXSB $2, F5, F6, F7 // e775602820ef
|
||||
VFMAXDB $3, V8, V9, V10 // e7a8903030ef
|
||||
WFMAXDB $4, V11, V12, V13 // e7dbc04830ef
|
||||
WFMAXDB $4, F11, F12, F13 // e7dbc04830ef
|
||||
VFMINSB $7, V14, V15, V16 // e70ef07028ee
|
||||
WFMINSB $8, V17, V18, V19 // e73120882eee
|
||||
WFMINSB $8, F1, F2, F3 // e731208820ee
|
||||
VFMINDB $9, V20, V21, V22 // e76450903eee
|
||||
WFMINDB $10, V23, V24, V25 // e79780a83eee
|
||||
WFMINDB $10, F7, F8, F9 // e79780a830ee
|
||||
|
||||
RET
|
||||
RET foo(SB)
|
||||
|
||||
@@ -29,9 +29,8 @@ var (
|
||||
)
|
||||
|
||||
var DebugFlags struct {
|
||||
CompressInstructions int `help:"use compressed instructions when possible (if supported by architecture)"`
|
||||
MayMoreStack string `help:"call named function before all stack growth checks"`
|
||||
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
|
||||
MayMoreStack string `help:"call named function before all stack growth checks"`
|
||||
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -48,8 +47,6 @@ func init() {
|
||||
flag.Var(objabi.NewDebugFlag(&DebugFlags, nil), "d", "enable debugging settings; try -d help")
|
||||
objabi.AddVersionFlag() // -V
|
||||
objabi.Flagcount("S", "print assembly and machine code", &PrintOut)
|
||||
|
||||
DebugFlags.CompressInstructions = 1
|
||||
}
|
||||
|
||||
// MultiFlag allows setting a value multiple times to collect a list, as in -I=dir1 -I=dir2.
|
||||
|
||||
@@ -68,7 +68,7 @@ func predefine(defines flags.MultiFlag) map[string]*Macro {
|
||||
|
||||
var panicOnError bool // For testing.
|
||||
|
||||
func (in *Input) Error(args ...any) {
|
||||
func (in *Input) Error(args ...interface{}) {
|
||||
if panicOnError {
|
||||
panic(fmt.Errorf("%s:%d: %s", in.File(), in.Line(), fmt.Sprintln(args...)))
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (in *Input) Error(args ...any) {
|
||||
}
|
||||
|
||||
// expectText is like Error but adds "got XXX" where XXX is a quoted representation of the most recent token.
|
||||
func (in *Input) expectText(args ...any) {
|
||||
func (in *Input) expectText(args ...interface{}) {
|
||||
in.Error(append(args, "; got", strconv.Quote(in.Stack.Text()))...)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ func main() {
|
||||
log.Fatalf("unrecognized architecture %s", GOARCH)
|
||||
}
|
||||
ctxt := obj.Linknew(architecture.LinkArch)
|
||||
ctxt.CompressInstructions = flags.DebugFlags.CompressInstructions != 0
|
||||
ctxt.Debugasm = flags.PrintOut
|
||||
ctxt.Debugvlog = flags.DebugV
|
||||
ctxt.Flag_dynlink = *flags.Dynlink
|
||||
@@ -59,7 +58,7 @@ func main() {
|
||||
// nothing
|
||||
case "index":
|
||||
// known to compiler; ignore here so people can use
|
||||
// the same list with -gcflags=-spectre=LIST and -asmflags=-spectre=LIST
|
||||
// the same list with -gcflags=-spectre=LIST and -asmflags=-spectrre=LIST
|
||||
case "all", "ret":
|
||||
ctxt.Retpoline = true
|
||||
}
|
||||
@@ -94,7 +93,7 @@ func main() {
|
||||
for _, f := range flag.Args() {
|
||||
lexer := lex.NewLexer(f)
|
||||
parser := asm.NewParser(ctxt, architecture, lexer)
|
||||
ctxt.DiagFunc = func(format string, args ...any) {
|
||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
||||
diag = true
|
||||
log.Printf(format, args...)
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ func commentText(g *ast.CommentGroup) string {
|
||||
return strings.Join(pieces, "")
|
||||
}
|
||||
|
||||
func (f *File) validateIdents(x any, context astContext) {
|
||||
func (f *File) validateIdents(x interface{}, context astContext) {
|
||||
if x, ok := x.(*ast.Ident); ok {
|
||||
if f.isMangledName(x.Name) {
|
||||
error_(x.Pos(), "identifier %q may conflict with identifiers generated by cgo", x.Name)
|
||||
@@ -208,7 +208,7 @@ func (f *File) validateIdents(x any, context astContext) {
|
||||
}
|
||||
|
||||
// Save various references we are going to need later.
|
||||
func (f *File) saveExprs(x any, context astContext) {
|
||||
func (f *File) saveExprs(x interface{}, context astContext) {
|
||||
switch x := x.(type) {
|
||||
case *ast.Expr:
|
||||
switch (*x).(type) {
|
||||
@@ -278,7 +278,7 @@ func (f *File) saveCall(call *ast.CallExpr, context astContext) {
|
||||
}
|
||||
|
||||
// If a function should be exported add it to ExpFunc.
|
||||
func (f *File) saveExport(x any, context astContext) {
|
||||
func (f *File) saveExport(x interface{}, context astContext) {
|
||||
n, ok := x.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
return
|
||||
@@ -318,7 +318,7 @@ func (f *File) saveExport(x any, context astContext) {
|
||||
}
|
||||
|
||||
// Make f.ExpFunc[i] point at the Func from this AST instead of the other one.
|
||||
func (f *File) saveExport2(x any, context astContext) {
|
||||
func (f *File) saveExport2(x interface{}, context astContext) {
|
||||
n, ok := x.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
return
|
||||
@@ -355,7 +355,7 @@ const (
|
||||
)
|
||||
|
||||
// walk walks the AST x, calling visit(f, x, context) for each node.
|
||||
func (f *File) walk(x any, context astContext, visit func(*File, any, astContext)) {
|
||||
func (f *File) walk(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
|
||||
visit(f, x, context)
|
||||
switch n := x.(type) {
|
||||
case *ast.Expr:
|
||||
@@ -363,8 +363,7 @@ func (f *File) walk(x any, context astContext, visit func(*File, any, astContext
|
||||
|
||||
// everything else just recurs
|
||||
default:
|
||||
error_(token.NoPos, "unexpected type %T in walk", x)
|
||||
panic("unexpected type")
|
||||
f.walkUnexpected(x, context, visit)
|
||||
|
||||
case nil:
|
||||
|
||||
@@ -397,9 +396,6 @@ func (f *File) walk(x any, context astContext, visit func(*File, any, astContext
|
||||
case *ast.IndexExpr:
|
||||
f.walk(&n.X, ctxExpr, visit)
|
||||
f.walk(&n.Index, ctxExpr, visit)
|
||||
case *ast.IndexListExpr:
|
||||
f.walk(&n.X, ctxExpr, visit)
|
||||
f.walk(n.Indices, ctxExpr, visit)
|
||||
case *ast.SliceExpr:
|
||||
f.walk(&n.X, ctxExpr, visit)
|
||||
if n.Low != nil {
|
||||
@@ -438,8 +434,8 @@ func (f *File) walk(x any, context astContext, visit func(*File, any, astContext
|
||||
case *ast.StructType:
|
||||
f.walk(n.Fields, ctxField, visit)
|
||||
case *ast.FuncType:
|
||||
if n.TypeParams != nil {
|
||||
f.walk(n.TypeParams, ctxParam, visit)
|
||||
if tparams := funcTypeTypeParams(n); tparams != nil {
|
||||
f.walk(tparams, ctxParam, visit)
|
||||
}
|
||||
f.walk(n.Params, ctxParam, visit)
|
||||
if n.Results != nil {
|
||||
@@ -528,8 +524,8 @@ func (f *File) walk(x any, context astContext, visit func(*File, any, astContext
|
||||
f.walk(n.Values, ctxExpr, visit)
|
||||
}
|
||||
case *ast.TypeSpec:
|
||||
if n.TypeParams != nil {
|
||||
f.walk(n.TypeParams, ctxParam, visit)
|
||||
if tparams := typeSpecTypeParams(n); tparams != nil {
|
||||
f.walk(tparams, ctxParam, visit)
|
||||
}
|
||||
f.walk(&n.Type, ctxType, visit)
|
||||
|
||||
|
||||
25
src/cmd/cgo/ast_go1.go
Normal file
25
src/cmd/cgo/ast_go1.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build compiler_bootstrap
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/token"
|
||||
)
|
||||
|
||||
func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
|
||||
error_(token.NoPos, "unexpected type %T in walk", x)
|
||||
panic("unexpected type")
|
||||
}
|
||||
|
||||
func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
|
||||
return nil
|
||||
}
|
||||
|
||||
func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
|
||||
return nil
|
||||
}
|
||||
32
src/cmd/cgo/ast_go118.go
Normal file
32
src/cmd/cgo/ast_go118.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build !compiler_bootstrap
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/token"
|
||||
)
|
||||
|
||||
func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
|
||||
switch n := x.(type) {
|
||||
default:
|
||||
error_(token.NoPos, "unexpected type %T in walk", x)
|
||||
panic("unexpected type")
|
||||
|
||||
case *ast.IndexListExpr:
|
||||
f.walk(&n.X, ctxExpr, visit)
|
||||
f.walk(n.Indices, ctxExpr, visit)
|
||||
}
|
||||
}
|
||||
|
||||
func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
|
||||
return n.TypeParams
|
||||
}
|
||||
|
||||
func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
|
||||
return n.TypeParams
|
||||
}
|
||||
@@ -127,7 +127,7 @@ environment variable when running the go tool: set it to 1 to enable
|
||||
the use of cgo, and to 0 to disable it. The go tool will set the
|
||||
build constraint "cgo" if cgo is enabled. The special import "C"
|
||||
implies the "cgo" build constraint, as though the file also said
|
||||
"//go:build cgo". Therefore, if cgo is disabled, files that import
|
||||
"//go:build cgo". Therefore, if cgo is disabled, files that import
|
||||
"C" will not be built by the go tool. (For more about build constraints
|
||||
see https://golang.org/pkg/go/build/#hdr-Build_Constraints).
|
||||
|
||||
@@ -425,8 +425,8 @@ and of course there is nothing stopping the C code from doing anything
|
||||
it likes. However, programs that break these rules are likely to fail
|
||||
in unexpected and unpredictable ways.
|
||||
|
||||
The type [runtime/cgo.Handle] can be used to safely pass Go values
|
||||
between Go and C.
|
||||
The runtime/cgo.Handle type can be used to safely pass Go values
|
||||
between Go and C. See the runtime/cgo package documentation for details.
|
||||
|
||||
Note: the current implementation has a bug. While Go code is permitted
|
||||
to write nil or a C pointer (but not a Go pointer) to C memory, the
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
@@ -183,22 +182,25 @@ func splitQuoted(s string) (r []string, err error) {
|
||||
return args, err
|
||||
}
|
||||
|
||||
// loadDebug runs gcc to load debug information for the File. The debug
|
||||
// information will be saved to the debugs field of the file, and be
|
||||
// processed when Translate is called on the file later.
|
||||
// loadDebug is called concurrently with different files.
|
||||
func (f *File) loadDebug(p *Package) {
|
||||
// Translate rewrites f.AST, the original Go input, to remove
|
||||
// references to the imported package C, replacing them with
|
||||
// references to the equivalent Go types, functions, and variables.
|
||||
func (p *Package) Translate(f *File) {
|
||||
for _, cref := range f.Ref {
|
||||
// Convert C.ulong to C.unsigned long, etc.
|
||||
cref.Name.C = cname(cref.Name.Go)
|
||||
}
|
||||
|
||||
ft := fileTypedefs{typedefs: make(map[string]bool)}
|
||||
var conv typeConv
|
||||
conv.Init(p.PtrSize, p.IntSize)
|
||||
|
||||
p.typedefs = map[string]bool{}
|
||||
p.typedefList = nil
|
||||
numTypedefs := -1
|
||||
for len(ft.typedefs) > numTypedefs {
|
||||
numTypedefs = len(ft.typedefs)
|
||||
for len(p.typedefs) > numTypedefs {
|
||||
numTypedefs = len(p.typedefs)
|
||||
// Also ask about any typedefs we've seen so far.
|
||||
for _, info := range ft.typedefList {
|
||||
for _, info := range p.typedefList {
|
||||
if f.Name[info.typedef] != nil {
|
||||
continue
|
||||
}
|
||||
@@ -211,7 +213,7 @@ func (f *File) loadDebug(p *Package) {
|
||||
}
|
||||
needType := p.guessKinds(f)
|
||||
if len(needType) > 0 {
|
||||
f.debugs = append(f.debugs, p.loadDWARF(f, &ft, needType))
|
||||
p.loadDWARF(f, &conv, needType)
|
||||
}
|
||||
|
||||
// In godefs mode we're OK with the typedefs, which
|
||||
@@ -221,18 +223,6 @@ func (f *File) loadDebug(p *Package) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Translate rewrites f.AST, the original Go input, to remove
|
||||
// references to the imported package C, replacing them with
|
||||
// references to the equivalent Go types, functions, and variables.
|
||||
// Preconditions: File.loadDebug must be called prior to translate.
|
||||
func (p *Package) Translate(f *File) {
|
||||
var conv typeConv
|
||||
conv.Init(p.PtrSize, p.IntSize)
|
||||
for _, d := range f.debugs {
|
||||
p.recordTypes(f, d, &conv)
|
||||
}
|
||||
p.prepareNames(f)
|
||||
if p.rewriteCalls(f) {
|
||||
// Add `import _cgo_unsafe "unsafe"` after the package statement.
|
||||
@@ -251,7 +241,7 @@ func (f *File) loadDefines(gccOptions []string) bool {
|
||||
stdout := gccDefines(b.Bytes(), gccOptions)
|
||||
|
||||
var gccIsClang bool
|
||||
for line := range strings.SplitSeq(stdout, "\n") {
|
||||
for _, line := range strings.Split(stdout, "\n") {
|
||||
if len(line) < 9 || line[0:7] != "#define" {
|
||||
continue
|
||||
}
|
||||
@@ -289,7 +279,6 @@ func (f *File) loadDefines(gccOptions []string) bool {
|
||||
// guessKinds tricks gcc into revealing the kind of each
|
||||
// name xxx for the references C.xxx in the Go input.
|
||||
// The kind is either a constant, type, or variable.
|
||||
// guessKinds is called concurrently with different files.
|
||||
func (p *Package) guessKinds(f *File) []*Name {
|
||||
// Determine kinds for names we already know about,
|
||||
// like #defines or 'struct foo', before bothering with gcc.
|
||||
@@ -428,7 +417,7 @@ func (p *Package) guessKinds(f *File) []*Name {
|
||||
notDeclared
|
||||
)
|
||||
sawUnmatchedErrors := false
|
||||
for line := range strings.SplitSeq(stderr, "\n") {
|
||||
for _, line := range strings.Split(stderr, "\n") {
|
||||
// Ignore warnings and random comments, with one
|
||||
// exception: newer GCC versions will sometimes emit
|
||||
// an error on a macro #define with a note referring
|
||||
@@ -533,8 +522,7 @@ func (p *Package) guessKinds(f *File) []*Name {
|
||||
// loadDWARF parses the DWARF debug information generated
|
||||
// by gcc to learn the details of the constants, variables, and types
|
||||
// being referred to as C.xxx.
|
||||
// loadDwarf is called concurrently with different files.
|
||||
func (p *Package) loadDWARF(f *File, ft *fileTypedefs, names []*Name) *debug {
|
||||
func (p *Package) loadDWARF(f *File, conv *typeConv, names []*Name) {
|
||||
// Extract the types from the DWARF section of an object
|
||||
// from a well-formed C program. Gcc only generates DWARF info
|
||||
// for symbols in the object file, so it is not enough to print the
|
||||
@@ -648,28 +636,13 @@ func (p *Package) loadDWARF(f *File, ft *fileTypedefs, names []*Name) *debug {
|
||||
fatalf("malformed __cgo__ name: %s", name)
|
||||
}
|
||||
types[i] = t.Type
|
||||
ft.recordTypedefs(t.Type, f.NamePos[names[i]])
|
||||
p.recordTypedefs(t.Type, f.NamePos[names[i]])
|
||||
}
|
||||
if e.Tag != dwarf.TagCompileUnit {
|
||||
r.SkipChildren()
|
||||
}
|
||||
}
|
||||
|
||||
return &debug{names, types, ints, floats, strs}
|
||||
}
|
||||
|
||||
// debug is the data extracted by running an iteration of loadDWARF on a file.
|
||||
type debug struct {
|
||||
names []*Name
|
||||
types []dwarf.Type
|
||||
ints []int64
|
||||
floats []float64
|
||||
strs []string
|
||||
}
|
||||
|
||||
func (p *Package) recordTypes(f *File, data *debug, conv *typeConv) {
|
||||
names, types, ints, floats, strs := data.names, data.types, data.ints, data.floats, data.strs
|
||||
|
||||
// Record types and typedef information.
|
||||
for i, n := range names {
|
||||
if strings.HasSuffix(n.Go, "GetTypeID") && types[i].String() == "func() CFTypeID" {
|
||||
@@ -728,17 +701,12 @@ func (p *Package) recordTypes(f *File, data *debug, conv *typeConv) {
|
||||
}
|
||||
}
|
||||
|
||||
type fileTypedefs struct {
|
||||
typedefs map[string]bool // type names that appear in the types of the objects we're interested in
|
||||
typedefList []typedefInfo
|
||||
// recordTypedefs remembers in p.typedefs all the typedefs used in dtypes and its children.
|
||||
func (p *Package) recordTypedefs(dtype dwarf.Type, pos token.Pos) {
|
||||
p.recordTypedefs1(dtype, pos, map[dwarf.Type]bool{})
|
||||
}
|
||||
|
||||
// recordTypedefs remembers in ft.typedefs all the typedefs used in dtypes and its children.
|
||||
func (ft *fileTypedefs) recordTypedefs(dtype dwarf.Type, pos token.Pos) {
|
||||
ft.recordTypedefs1(dtype, pos, map[dwarf.Type]bool{})
|
||||
}
|
||||
|
||||
func (ft *fileTypedefs) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited map[dwarf.Type]bool) {
|
||||
func (p *Package) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited map[dwarf.Type]bool) {
|
||||
if dtype == nil {
|
||||
return
|
||||
}
|
||||
@@ -752,25 +720,25 @@ func (ft *fileTypedefs) recordTypedefs1(dtype dwarf.Type, pos token.Pos, visited
|
||||
// Don't look inside builtin types. There be dragons.
|
||||
return
|
||||
}
|
||||
if !ft.typedefs[dt.Name] {
|
||||
ft.typedefs[dt.Name] = true
|
||||
ft.typedefList = append(ft.typedefList, typedefInfo{dt.Name, pos})
|
||||
ft.recordTypedefs1(dt.Type, pos, visited)
|
||||
if !p.typedefs[dt.Name] {
|
||||
p.typedefs[dt.Name] = true
|
||||
p.typedefList = append(p.typedefList, typedefInfo{dt.Name, pos})
|
||||
p.recordTypedefs1(dt.Type, pos, visited)
|
||||
}
|
||||
case *dwarf.PtrType:
|
||||
ft.recordTypedefs1(dt.Type, pos, visited)
|
||||
p.recordTypedefs1(dt.Type, pos, visited)
|
||||
case *dwarf.ArrayType:
|
||||
ft.recordTypedefs1(dt.Type, pos, visited)
|
||||
p.recordTypedefs1(dt.Type, pos, visited)
|
||||
case *dwarf.QualType:
|
||||
ft.recordTypedefs1(dt.Type, pos, visited)
|
||||
p.recordTypedefs1(dt.Type, pos, visited)
|
||||
case *dwarf.FuncType:
|
||||
ft.recordTypedefs1(dt.ReturnType, pos, visited)
|
||||
p.recordTypedefs1(dt.ReturnType, pos, visited)
|
||||
for _, a := range dt.ParamType {
|
||||
ft.recordTypedefs1(a, pos, visited)
|
||||
p.recordTypedefs1(a, pos, visited)
|
||||
}
|
||||
case *dwarf.StructType:
|
||||
for _, l := range dt.Field {
|
||||
ft.recordTypedefs1(l.Type, pos, visited)
|
||||
for _, f := range dt.Field {
|
||||
p.recordTypedefs1(f.Type, pos, visited)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1056,7 +1024,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
|
||||
func (p *Package) needsPointerCheck(f *File, t ast.Expr, arg ast.Expr) bool {
|
||||
// An untyped nil does not need a pointer check, and when
|
||||
// _cgoCheckPointer returns the untyped nil the type assertion we
|
||||
// are going to insert will fail. Easier to just skip nil arguments.
|
||||
// are going to insert will fail. Easier to just skip nil arguments.
|
||||
// TODO: Note that this fails if nil is shadowed.
|
||||
if id, ok := arg.(*ast.Ident); ok && id.Name == "nil" {
|
||||
return false
|
||||
@@ -1121,9 +1089,6 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
|
||||
if t.Name == "error" {
|
||||
return true
|
||||
}
|
||||
if t.Name == "any" {
|
||||
return true
|
||||
}
|
||||
if goTypes[t.Name] != nil {
|
||||
return false
|
||||
}
|
||||
@@ -1161,7 +1126,7 @@ func (p *Package) hasPointer(f *File, t ast.Expr, top bool) bool {
|
||||
// If addPosition is true, add position info to the idents of C names in arg.
|
||||
func (p *Package) mangle(f *File, arg *ast.Expr, addPosition bool) (ast.Expr, bool) {
|
||||
needsUnsafe := false
|
||||
f.walk(arg, ctxExpr, func(f *File, arg any, context astContext) {
|
||||
f.walk(arg, ctxExpr, func(f *File, arg interface{}, context astContext) {
|
||||
px, ok := arg.(*ast.Expr)
|
||||
if !ok {
|
||||
return
|
||||
@@ -1791,24 +1756,20 @@ func gccMachine() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
var n atomic.Int64
|
||||
|
||||
func gccTmp() string {
|
||||
c := strconv.Itoa(int(n.Add(1)))
|
||||
return *objDir + "_cgo_" + c + ".o"
|
||||
return *objDir + "_cgo_.o"
|
||||
}
|
||||
|
||||
// gccCmd returns the gcc command line to use for compiling
|
||||
// the input.
|
||||
// gccCommand is called concurrently for different files.
|
||||
func (p *Package) gccCmd(ofile string) []string {
|
||||
func (p *Package) gccCmd() []string {
|
||||
c := append(gccBaseCmd,
|
||||
"-w", // no warnings
|
||||
"-Wno-error", // warnings are not errors
|
||||
"-o"+ofile, // write object to tmp
|
||||
"-gdwarf-2", // generate DWARF v2 debugging symbols
|
||||
"-c", // do not link
|
||||
"-xc", // input language is C
|
||||
"-w", // no warnings
|
||||
"-Wno-error", // warnings are not errors
|
||||
"-o"+gccTmp(), // write object to tmp
|
||||
"-gdwarf-2", // generate DWARF v2 debugging symbols
|
||||
"-c", // do not link
|
||||
"-xc", // input language is C
|
||||
)
|
||||
if p.GccIsClang {
|
||||
c = append(c,
|
||||
@@ -1844,10 +1805,8 @@ func (p *Package) gccCmd(ofile string) []string {
|
||||
|
||||
// gccDebug runs gcc -gdwarf-2 over the C program stdin and
|
||||
// returns the corresponding DWARF data and, if present, debug data block.
|
||||
// gccDebug is called concurrently with different C programs.
|
||||
func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int64, floats []float64, strs []string) {
|
||||
ofile := gccTmp()
|
||||
runGcc(stdin, p.gccCmd(ofile))
|
||||
runGcc(stdin, p.gccCmd())
|
||||
|
||||
isDebugInts := func(s string) bool {
|
||||
// Some systems use leading _ to denote non-assembly symbols.
|
||||
@@ -1897,11 +1856,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
}
|
||||
}
|
||||
|
||||
if f, err := macho.Open(ofile); err == nil {
|
||||
if f, err := macho.Open(gccTmp()); err == nil {
|
||||
defer f.Close()
|
||||
d, err := f.DWARF()
|
||||
if err != nil {
|
||||
fatalf("cannot load DWARF output from %s: %v", ofile, err)
|
||||
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
|
||||
}
|
||||
bo := f.ByteOrder
|
||||
if f.Symtab != nil {
|
||||
@@ -1975,11 +1934,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
return d, ints, floats, strs
|
||||
}
|
||||
|
||||
if f, err := elf.Open(ofile); err == nil {
|
||||
if f, err := elf.Open(gccTmp()); err == nil {
|
||||
defer f.Close()
|
||||
d, err := f.DWARF()
|
||||
if err != nil {
|
||||
fatalf("cannot load DWARF output from %s: %v", ofile, err)
|
||||
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
|
||||
}
|
||||
bo := f.ByteOrder
|
||||
symtab, err := f.Symbols()
|
||||
@@ -2075,11 +2034,11 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
return d, ints, floats, strs
|
||||
}
|
||||
|
||||
if f, err := pe.Open(ofile); err == nil {
|
||||
if f, err := pe.Open(gccTmp()); err == nil {
|
||||
defer f.Close()
|
||||
d, err := f.DWARF()
|
||||
if err != nil {
|
||||
fatalf("cannot load DWARF output from %s: %v", ofile, err)
|
||||
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
|
||||
}
|
||||
bo := binary.LittleEndian
|
||||
for _, s := range f.Symbols {
|
||||
@@ -2147,17 +2106,17 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
return d, ints, floats, strs
|
||||
}
|
||||
|
||||
if f, err := xcoff.Open(ofile); err == nil {
|
||||
if f, err := xcoff.Open(gccTmp()); err == nil {
|
||||
defer f.Close()
|
||||
d, err := f.DWARF()
|
||||
if err != nil {
|
||||
fatalf("cannot load DWARF output from %s: %v", ofile, err)
|
||||
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
|
||||
}
|
||||
bo := binary.BigEndian
|
||||
for _, s := range f.Symbols {
|
||||
switch {
|
||||
case isDebugInts(s.Name):
|
||||
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
|
||||
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
|
||||
sect := f.Sections[i]
|
||||
if s.Value < sect.Size {
|
||||
if sdat, err := sect.Data(); err == nil {
|
||||
@@ -2170,7 +2129,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
}
|
||||
}
|
||||
case isDebugFloats(s.Name):
|
||||
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
|
||||
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
|
||||
sect := f.Sections[i]
|
||||
if s.Value < sect.Size {
|
||||
if sdat, err := sect.Data(); err == nil {
|
||||
@@ -2184,7 +2143,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
}
|
||||
default:
|
||||
if n := indexOfDebugStr(s.Name); n != -1 {
|
||||
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
|
||||
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
|
||||
sect := f.Sections[i]
|
||||
if s.Value < sect.Size {
|
||||
if sdat, err := sect.Data(); err == nil {
|
||||
@@ -2196,7 +2155,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
break
|
||||
}
|
||||
if n := indexOfDebugStrlen(s.Name); n != -1 {
|
||||
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
|
||||
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
|
||||
sect := f.Sections[i]
|
||||
if s.Value < sect.Size {
|
||||
if sdat, err := sect.Data(); err == nil {
|
||||
@@ -2217,7 +2176,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
|
||||
buildStrings()
|
||||
return d, ints, floats, strs
|
||||
}
|
||||
fatalf("cannot parse gcc output %s as ELF, Mach-O, PE, XCOFF object", ofile)
|
||||
fatalf("cannot parse gcc output %s as ELF, Mach-O, PE, XCOFF object", gccTmp())
|
||||
panic("not reached")
|
||||
}
|
||||
|
||||
@@ -2235,10 +2194,9 @@ func gccDefines(stdin []byte, gccOptions []string) string {
|
||||
// gccErrors runs gcc over the C program stdin and returns
|
||||
// the errors that gcc prints. That is, this function expects
|
||||
// gcc to fail.
|
||||
// gccErrors is called concurrently with different C programs.
|
||||
func (p *Package) gccErrors(stdin []byte, extraArgs ...string) string {
|
||||
// TODO(rsc): require failure
|
||||
args := p.gccCmd(gccTmp())
|
||||
args := p.gccCmd()
|
||||
|
||||
// Optimization options can confuse the error messages; remove them.
|
||||
nargs := make([]string, 0, len(args)+len(extraArgs))
|
||||
@@ -2442,7 +2400,7 @@ func (tr *TypeRepr) Empty() bool {
|
||||
// Set modifies the type representation.
|
||||
// If fargs are provided, repr is used as a format for fmt.Sprintf.
|
||||
// Otherwise, repr is used unprocessed as the type representation.
|
||||
func (tr *TypeRepr) Set(repr string, fargs ...any) {
|
||||
func (tr *TypeRepr) Set(repr string, fargs ...interface{}) {
|
||||
tr.Repr = repr
|
||||
tr.FormatArgs = fargs
|
||||
}
|
||||
@@ -2716,7 +2674,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
|
||||
// so execute the basic things that the struct case would do
|
||||
// other than try to determine a Go representation.
|
||||
tt := *t
|
||||
tt.C = &TypeRepr{"%s %s", []any{dt.Kind, tag}}
|
||||
tt.C = &TypeRepr{"%s %s", []interface{}{dt.Kind, tag}}
|
||||
// We don't know what the representation of this struct is, so don't let
|
||||
// anyone allocate one on the Go side. As a side effect of this annotation,
|
||||
// pointers to this type will not be considered pointers in Go. They won't
|
||||
@@ -2746,7 +2704,7 @@ func (c *typeConv) loadType(dtype dwarf.Type, pos token.Pos, parent string) *Typ
|
||||
t.Align = align
|
||||
tt := *t
|
||||
if tag != "" {
|
||||
tt.C = &TypeRepr{"struct %s", []any{tag}}
|
||||
tt.C = &TypeRepr{"struct %s", []interface{}{tag}}
|
||||
}
|
||||
tt.Go = g
|
||||
if c.incompleteStructs[tag] {
|
||||
@@ -3013,7 +2971,7 @@ func (c *typeConv) FuncType(dtype *dwarf.FuncType, pos token.Pos) *FuncType {
|
||||
for i, f := range dtype.ParamType {
|
||||
// gcc's DWARF generator outputs a single DotDotDotType parameter for
|
||||
// function pointers that specify no parameters (e.g. void
|
||||
// (*__cgo_0)()). Treat this special case as void. This case is
|
||||
// (*__cgo_0)()). Treat this special case as void. This case is
|
||||
// invalid according to ISO C anyway (i.e. void (*__cgo_1)(...) is not
|
||||
// legal).
|
||||
if _, ok := f.(*dwarf.DotDotDotType); ok && i == 0 {
|
||||
@@ -3084,7 +3042,7 @@ func (c *typeConv) Struct(dt *dwarf.StructType, pos token.Pos) (expr *ast.Struct
|
||||
off := int64(0)
|
||||
|
||||
// Rename struct fields that happen to be named Go keywords into
|
||||
// _{keyword}. Create a map from C ident -> Go ident. The Go ident will
|
||||
// _{keyword}. Create a map from C ident -> Go ident. The Go ident will
|
||||
// be mangled. Any existing identifier that already has the same name on
|
||||
// the C-side will cause the Go-mangled version to be prefixed with _.
|
||||
// (e.g. in a struct with fields '_type' and 'type', the latter would be
|
||||
@@ -3312,7 +3270,7 @@ func godefsFields(fld []*ast.Field) {
|
||||
// fieldPrefix returns the prefix that should be removed from all the
|
||||
// field names when generating the C or Go code. For generated
|
||||
// C, we leave the names as is (tv_sec, tv_usec), since that's what
|
||||
// people are used to seeing in C. For generated Go code, such as
|
||||
// people are used to seeing in C. For generated Go code, such as
|
||||
// package syscall's data structures, we drop a common prefix
|
||||
// (so sec, usec, which will get turned into Sec, Usec for exporting).
|
||||
func fieldPrefix(fld []*ast.Field) string {
|
||||
@@ -3459,7 +3417,7 @@ func (c *typeConv) badCFType(dt *dwarf.TypedefType) bool {
|
||||
// Tagged pointer support
|
||||
// Low-bit set means tagged object, next 3 bits (currently)
|
||||
// define the tagged object class, next 4 bits are for type
|
||||
// information for the specific tagged object class. Thus,
|
||||
// information for the specific tagged object class. Thus,
|
||||
// the low byte is for type info, and the rest of a pointer
|
||||
// (32 or 64-bit) is for payload, whatever the tagged class.
|
||||
//
|
||||
|
||||
@@ -117,7 +117,7 @@ func (p *Package) godefs(f *File, args []string) string {
|
||||
var gofmtBuf strings.Builder
|
||||
|
||||
// gofmt returns the gofmt-formatted string for an AST node.
|
||||
func gofmt(n any) string {
|
||||
func gofmt(n interface{}) string {
|
||||
gofmtBuf.Reset()
|
||||
err := printer.Fprint(&gofmtBuf, fset, n)
|
||||
if err != nil {
|
||||
|
||||
@@ -80,7 +80,7 @@ func mustHaveCxx(t *testing.T) {
|
||||
if len(args) == 0 {
|
||||
t.Skip("no C++ compiler")
|
||||
}
|
||||
testenv.MustHaveExecPath(t, args[0])
|
||||
testenv.MustHaveExecPath(t, string(args[0]))
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
package cgotest
|
||||
|
||||
// Test that we have no more than one build ID. In the past we used
|
||||
// Test that we have no more than one build ID. In the past we used
|
||||
// to generate a separate build ID for each package using cgo, and the
|
||||
// linker concatenated them all. We don't want that--we only want
|
||||
// linker concatenated them all. We don't want that--we only want
|
||||
// one.
|
||||
|
||||
import (
|
||||
@@ -42,7 +42,7 @@ sections:
|
||||
for len(d) > 0 {
|
||||
|
||||
// ELF standards differ as to the sizes in
|
||||
// note sections. Both the GNU linker and
|
||||
// note sections. Both the GNU linker and
|
||||
// gold always generate 32-bit sizes, so that
|
||||
// is what we assume here.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func nestedCall(f func()) {
|
||||
callbackMutex.Unlock()
|
||||
|
||||
// Pass the address of i because the C function was written to
|
||||
// take a pointer. We could pass an int if we felt like
|
||||
// take a pointer. We could pass an int if we felt like
|
||||
// rewriting the C code.
|
||||
C.callback(unsafe.Pointer(&i))
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
//go:build cgo && darwin
|
||||
|
||||
package cgotest
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIssue76023(t *testing.T) { issue76023(t) }
|
||||
@@ -12,105 +12,100 @@ import "testing"
|
||||
// so that they can use cgo (import "C").
|
||||
// These wrappers are here for gotest to find.
|
||||
|
||||
func Test1328(t *testing.T) { test1328(t) }
|
||||
func Test1560(t *testing.T) { test1560(t) }
|
||||
func Test1635(t *testing.T) { test1635(t) }
|
||||
func Test3250(t *testing.T) { test3250(t) }
|
||||
func Test3729(t *testing.T) { test3729(t) }
|
||||
func Test3775(t *testing.T) { test3775(t) }
|
||||
func Test4029(t *testing.T) { test4029(t) }
|
||||
func Test4339(t *testing.T) { test4339(t) }
|
||||
func Test5227(t *testing.T) { test5227(t) }
|
||||
func Test5242(t *testing.T) { test5242(t) }
|
||||
func Test5337(t *testing.T) { test5337(t) }
|
||||
func Test5548(t *testing.T) { test5548(t) }
|
||||
func Test5603(t *testing.T) { test5603(t) }
|
||||
func Test5986(t *testing.T) { test5986(t) }
|
||||
func Test6390(t *testing.T) { test6390(t) }
|
||||
func Test6833(t *testing.T) { test6833(t) }
|
||||
func Test6907(t *testing.T) { test6907(t) }
|
||||
func Test6907Go(t *testing.T) { test6907Go(t) }
|
||||
func Test7560(t *testing.T) { test7560(t) }
|
||||
func Test7665(t *testing.T) { test7665(t) }
|
||||
func Test7978(t *testing.T) { test7978(t) }
|
||||
func Test8092(t *testing.T) { test8092(t) }
|
||||
func Test8517(t *testing.T) { test8517(t) }
|
||||
func Test8694(t *testing.T) { test8694(t) }
|
||||
func Test8756(t *testing.T) { test8756(t) }
|
||||
func Test8811(t *testing.T) { test8811(t) }
|
||||
func Test9026(t *testing.T) { test9026(t) }
|
||||
func Test9510(t *testing.T) { test9510(t) }
|
||||
func Test9557(t *testing.T) { test9557(t) }
|
||||
func Test10303(t *testing.T) { test10303(t, 10) }
|
||||
func Test11925(t *testing.T) { test11925(t) }
|
||||
func Test12030(t *testing.T) { test12030(t) }
|
||||
func Test14838(t *testing.T) { test14838(t) }
|
||||
func Test17065(t *testing.T) { test17065(t) }
|
||||
func Test17537(t *testing.T) { test17537(t) }
|
||||
func Test18126(t *testing.T) { test18126(t) }
|
||||
func Test18720(t *testing.T) { test18720(t) }
|
||||
func Test20129(t *testing.T) { test20129(t) }
|
||||
func Test20266(t *testing.T) { test20266(t) }
|
||||
func Test20369(t *testing.T) { test20369(t) }
|
||||
func Test20910(t *testing.T) { test20910(t) }
|
||||
func Test21708(t *testing.T) { test21708(t) }
|
||||
func Test21809(t *testing.T) { test21809(t) }
|
||||
func Test21897(t *testing.T) { test21897(t) }
|
||||
func Test22906(t *testing.T) { test22906(t) }
|
||||
func Test23356(t *testing.T) { test23356(t) }
|
||||
func Test24206(t *testing.T) { test24206(t) }
|
||||
func Test25143(t *testing.T) { test25143(t) }
|
||||
func Test26066(t *testing.T) { test26066(t) }
|
||||
func Test26213(t *testing.T) { test26213(t) }
|
||||
func Test27660(t *testing.T) { test27660(t) }
|
||||
func Test28896(t *testing.T) { test28896(t) }
|
||||
func Test30065(t *testing.T) { test30065(t) }
|
||||
func Test32579(t *testing.T) { test32579(t) }
|
||||
func Test31891(t *testing.T) { test31891(t) }
|
||||
func Test42018(t *testing.T) { test42018(t) }
|
||||
func Test45451(t *testing.T) { test45451(t) }
|
||||
func Test49633(t *testing.T) { test49633(t) }
|
||||
func Test69086(t *testing.T) { test69086(t) }
|
||||
func TestAlign(t *testing.T) { testAlign(t) }
|
||||
func TestAtol(t *testing.T) { testAtol(t) }
|
||||
func TestBlocking(t *testing.T) { testBlocking(t) }
|
||||
func TestBoolAlign(t *testing.T) { testBoolAlign(t) }
|
||||
func TestCallGoWithString(t *testing.T) { testCallGoWithString(t) }
|
||||
func TestCallback(t *testing.T) { testCallback(t) }
|
||||
func TestCallbackCallers(t *testing.T) { testCallbackCallers(t) }
|
||||
func TestCallbackGC(t *testing.T) { testCallbackGC(t) }
|
||||
func TestCallbackPanic(t *testing.T) { testCallbackPanic(t) }
|
||||
func TestCallbackPanicLocked(t *testing.T) { testCallbackPanicLocked(t) }
|
||||
func TestCallbackPanicLoop(t *testing.T) { testCallbackPanicLoop(t) }
|
||||
func TestCallbackStack(t *testing.T) { testCallbackStack(t) }
|
||||
func TestCflags(t *testing.T) { testCflags(t) }
|
||||
func TestCheckConst(t *testing.T) { testCheckConst(t) }
|
||||
func TestConst(t *testing.T) { testConst(t) }
|
||||
func TestCthread(t *testing.T) { testCthread(t) }
|
||||
func TestEnum(t *testing.T) { testEnum(t) }
|
||||
func TestNamedEnum(t *testing.T) { testNamedEnum(t) }
|
||||
func TestCastToEnum(t *testing.T) { testCastToEnum(t) }
|
||||
func TestErrno(t *testing.T) { testErrno(t) }
|
||||
func TestFpVar(t *testing.T) { testFpVar(t) }
|
||||
func TestGCC68255(t *testing.T) { testGCC68255(t) }
|
||||
func TestHandle(t *testing.T) { testHandle(t) }
|
||||
func TestHelpers(t *testing.T) { testHelpers(t) }
|
||||
func TestLibgcc(t *testing.T) { testLibgcc(t) }
|
||||
func TestMultipleAssign(t *testing.T) { testMultipleAssign(t) }
|
||||
func TestNaming(t *testing.T) { testNaming(t) }
|
||||
func TestPanicFromC(t *testing.T) { testPanicFromC(t) }
|
||||
func TestPrintf(t *testing.T) { testPrintf(t) }
|
||||
func TestReturnAfterGrow(t *testing.T) { testReturnAfterGrow(t) }
|
||||
func TestReturnAfterGrowFromGo(t *testing.T) { testReturnAfterGrowFromGo(t) }
|
||||
func TestSetEnv(t *testing.T) { testSetEnv(t) }
|
||||
func TestThreadLock(t *testing.T) { testThreadLockFunc(t) }
|
||||
func TestUnsignedInt(t *testing.T) { testUnsignedInt(t) }
|
||||
func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) }
|
||||
func Test76340(t *testing.T) { test76340(t) }
|
||||
func TestDITCgo(t *testing.T) { testDITCgo(t) }
|
||||
func TestDITCgoCallback(t *testing.T) { testDITCgoCallback(t) }
|
||||
func TestDITCgoCallbackEnableDIT(t *testing.T) { testDITCgoCallbackEnableDIT(t) }
|
||||
func TestDITCgoCallbackDisableDIT(t *testing.T) { testDITCgoCallbackDisableDIT(t) }
|
||||
func Test1328(t *testing.T) { test1328(t) }
|
||||
func Test1560(t *testing.T) { test1560(t) }
|
||||
func Test1635(t *testing.T) { test1635(t) }
|
||||
func Test3250(t *testing.T) { test3250(t) }
|
||||
func Test3729(t *testing.T) { test3729(t) }
|
||||
func Test3775(t *testing.T) { test3775(t) }
|
||||
func Test4029(t *testing.T) { test4029(t) }
|
||||
func Test4339(t *testing.T) { test4339(t) }
|
||||
func Test5227(t *testing.T) { test5227(t) }
|
||||
func Test5242(t *testing.T) { test5242(t) }
|
||||
func Test5337(t *testing.T) { test5337(t) }
|
||||
func Test5548(t *testing.T) { test5548(t) }
|
||||
func Test5603(t *testing.T) { test5603(t) }
|
||||
func Test5986(t *testing.T) { test5986(t) }
|
||||
func Test6390(t *testing.T) { test6390(t) }
|
||||
func Test6833(t *testing.T) { test6833(t) }
|
||||
func Test6907(t *testing.T) { test6907(t) }
|
||||
func Test6907Go(t *testing.T) { test6907Go(t) }
|
||||
func Test7560(t *testing.T) { test7560(t) }
|
||||
func Test7665(t *testing.T) { test7665(t) }
|
||||
func Test7978(t *testing.T) { test7978(t) }
|
||||
func Test8092(t *testing.T) { test8092(t) }
|
||||
func Test8517(t *testing.T) { test8517(t) }
|
||||
func Test8694(t *testing.T) { test8694(t) }
|
||||
func Test8756(t *testing.T) { test8756(t) }
|
||||
func Test8811(t *testing.T) { test8811(t) }
|
||||
func Test9026(t *testing.T) { test9026(t) }
|
||||
func Test9510(t *testing.T) { test9510(t) }
|
||||
func Test9557(t *testing.T) { test9557(t) }
|
||||
func Test10303(t *testing.T) { test10303(t, 10) }
|
||||
func Test11925(t *testing.T) { test11925(t) }
|
||||
func Test12030(t *testing.T) { test12030(t) }
|
||||
func Test14838(t *testing.T) { test14838(t) }
|
||||
func Test17065(t *testing.T) { test17065(t) }
|
||||
func Test17537(t *testing.T) { test17537(t) }
|
||||
func Test18126(t *testing.T) { test18126(t) }
|
||||
func Test18720(t *testing.T) { test18720(t) }
|
||||
func Test20129(t *testing.T) { test20129(t) }
|
||||
func Test20266(t *testing.T) { test20266(t) }
|
||||
func Test20369(t *testing.T) { test20369(t) }
|
||||
func Test20910(t *testing.T) { test20910(t) }
|
||||
func Test21708(t *testing.T) { test21708(t) }
|
||||
func Test21809(t *testing.T) { test21809(t) }
|
||||
func Test21897(t *testing.T) { test21897(t) }
|
||||
func Test22906(t *testing.T) { test22906(t) }
|
||||
func Test23356(t *testing.T) { test23356(t) }
|
||||
func Test24206(t *testing.T) { test24206(t) }
|
||||
func Test25143(t *testing.T) { test25143(t) }
|
||||
func Test26066(t *testing.T) { test26066(t) }
|
||||
func Test26213(t *testing.T) { test26213(t) }
|
||||
func Test27660(t *testing.T) { test27660(t) }
|
||||
func Test28896(t *testing.T) { test28896(t) }
|
||||
func Test30065(t *testing.T) { test30065(t) }
|
||||
func Test32579(t *testing.T) { test32579(t) }
|
||||
func Test31891(t *testing.T) { test31891(t) }
|
||||
func Test42018(t *testing.T) { test42018(t) }
|
||||
func Test45451(t *testing.T) { test45451(t) }
|
||||
func Test49633(t *testing.T) { test49633(t) }
|
||||
func Test69086(t *testing.T) { test69086(t) }
|
||||
func TestAlign(t *testing.T) { testAlign(t) }
|
||||
func TestAtol(t *testing.T) { testAtol(t) }
|
||||
func TestBlocking(t *testing.T) { testBlocking(t) }
|
||||
func TestBoolAlign(t *testing.T) { testBoolAlign(t) }
|
||||
func TestCallGoWithString(t *testing.T) { testCallGoWithString(t) }
|
||||
func TestCallback(t *testing.T) { testCallback(t) }
|
||||
func TestCallbackCallers(t *testing.T) { testCallbackCallers(t) }
|
||||
func TestCallbackGC(t *testing.T) { testCallbackGC(t) }
|
||||
func TestCallbackPanic(t *testing.T) { testCallbackPanic(t) }
|
||||
func TestCallbackPanicLocked(t *testing.T) { testCallbackPanicLocked(t) }
|
||||
func TestCallbackPanicLoop(t *testing.T) { testCallbackPanicLoop(t) }
|
||||
func TestCallbackStack(t *testing.T) { testCallbackStack(t) }
|
||||
func TestCflags(t *testing.T) { testCflags(t) }
|
||||
func TestCheckConst(t *testing.T) { testCheckConst(t) }
|
||||
func TestConst(t *testing.T) { testConst(t) }
|
||||
func TestCthread(t *testing.T) { testCthread(t) }
|
||||
func TestEnum(t *testing.T) { testEnum(t) }
|
||||
func TestNamedEnum(t *testing.T) { testNamedEnum(t) }
|
||||
func TestCastToEnum(t *testing.T) { testCastToEnum(t) }
|
||||
func TestErrno(t *testing.T) { testErrno(t) }
|
||||
func TestFpVar(t *testing.T) { testFpVar(t) }
|
||||
func TestGCC68255(t *testing.T) { testGCC68255(t) }
|
||||
func TestHandle(t *testing.T) { testHandle(t) }
|
||||
func TestHelpers(t *testing.T) { testHelpers(t) }
|
||||
func TestLibgcc(t *testing.T) { testLibgcc(t) }
|
||||
func TestMultipleAssign(t *testing.T) { testMultipleAssign(t) }
|
||||
func TestNaming(t *testing.T) { testNaming(t) }
|
||||
func TestPanicFromC(t *testing.T) { testPanicFromC(t) }
|
||||
func TestPrintf(t *testing.T) { testPrintf(t) }
|
||||
func TestReturnAfterGrow(t *testing.T) { testReturnAfterGrow(t) }
|
||||
func TestReturnAfterGrowFromGo(t *testing.T) { testReturnAfterGrowFromGo(t) }
|
||||
func TestSetEnv(t *testing.T) { testSetEnv(t) }
|
||||
func TestThreadLock(t *testing.T) { testThreadLockFunc(t) }
|
||||
func TestUnsignedInt(t *testing.T) { testUnsignedInt(t) }
|
||||
func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) }
|
||||
|
||||
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
|
||||
func BenchmarkGoString(b *testing.B) { benchGoString(b) }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test that it's OK to have C code that does nothing other than
|
||||
// initialize a global variable. This used to fail with gccgo.
|
||||
// initialize a global variable. This used to fail with gccgo.
|
||||
|
||||
package gcc68255
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
//go:build darwin
|
||||
|
||||
package cgotest
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -Wl,-undefined,dynamic_lookup
|
||||
|
||||
extern void __gotest_cgo_null_api(void) __attribute__((weak_import));
|
||||
|
||||
int issue76023(void) {
|
||||
if (__gotest_cgo_null_api) return 1;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
import "testing"
|
||||
|
||||
func issue76023(t *testing.T) {
|
||||
r := C.issue76023()
|
||||
if r != 0 {
|
||||
t.Error("found __gotest_cgo_null_api")
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
//go:build cgo
|
||||
|
||||
package cgotest
|
||||
|
||||
// Issue 43639: No runtime test needed, make sure package
|
||||
// cmd/cgo/internal/test/issue76861 compiles without error.
|
||||
|
||||
import _ "cmd/cgo/internal/test/issue76861"
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package issue76861
|
||||
|
||||
// #cgo CFLAGS: -Wall -Werror
|
||||
// void issue76861(void) {}
|
||||
import "C"
|
||||
|
||||
func Issue76861() {
|
||||
C.issue76861()
|
||||
}
|
||||
@@ -245,7 +245,7 @@ static void *thread(void *p) {
|
||||
return NULL;
|
||||
}
|
||||
void testSendSIG() {
|
||||
enum { N = 20 };
|
||||
const int N = 20;
|
||||
int i;
|
||||
pthread_t tid[N];
|
||||
for (i = 0; i < N; i++) {
|
||||
@@ -953,61 +953,13 @@ typedef struct {
|
||||
} issue69086struct;
|
||||
static int issue690861(issue69086struct* p) { p->b = 1234; return p->c; }
|
||||
static int issue690862(unsigned long ul1, unsigned long ul2, unsigned int u, issue69086struct s) { return (int)(s.b); }
|
||||
|
||||
char issue75751v = 1;
|
||||
char * const issue75751p = &issue75751v;
|
||||
#define issue75751m issue75751p
|
||||
char * const volatile issue75751p2 = &issue75751v;
|
||||
#define issue75751m2 issue75751p2
|
||||
|
||||
typedef struct { void *t; void *v; } GoInterface;
|
||||
extern int exportAny76340Param(GoInterface);
|
||||
extern GoInterface exportAny76340Return(int);
|
||||
|
||||
int issue76340testFromC(GoInterface obj) {
|
||||
return exportAny76340Param(obj);
|
||||
}
|
||||
|
||||
GoInterface issue76340returnFromC(int val) {
|
||||
return exportAny76340Return(val);
|
||||
}
|
||||
|
||||
static void enableDIT() {
|
||||
#ifdef __arm64__
|
||||
__asm__ __volatile__("msr dit, #1");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void disableDIT() {
|
||||
#ifdef __arm64__
|
||||
__asm__ __volatile__("msr dit, #0");
|
||||
#endif
|
||||
}
|
||||
|
||||
extern uint8_t ditCallback();
|
||||
|
||||
static uint8_t ditCallbackTest() {
|
||||
return ditCallback();
|
||||
}
|
||||
|
||||
static void ditCallbackEnableDIT() {
|
||||
enableDIT();
|
||||
ditCallback();
|
||||
}
|
||||
|
||||
static void ditCallbackDisableDIT() {
|
||||
disableDIT();
|
||||
ditCallback();
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/subtle"
|
||||
"fmt"
|
||||
"internal/asan"
|
||||
"internal/runtime/sys"
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -1144,12 +1096,6 @@ func testErrno(t *testing.T) {
|
||||
}
|
||||
|
||||
func testMultipleAssign(t *testing.T) {
|
||||
if runtime.GOOS == "windows" && usesUCRT(t) {
|
||||
// UCRT's strtol throws an unrecoverable crash when
|
||||
// using an invalid base (that is, not 0 or 2..36).
|
||||
// See go.dev/issue/62887.
|
||||
t.Skip("skipping test on Windows when linking with UCRT")
|
||||
}
|
||||
p := C.CString("234")
|
||||
n, m := C.strtol(p, nil, 345), C.strtol(p, nil, 10)
|
||||
defer C.free(unsafe.Pointer(p))
|
||||
@@ -2444,100 +2390,3 @@ func test69086(t *testing.T) {
|
||||
t.Errorf("call: got %d, want 1234", got)
|
||||
}
|
||||
}
|
||||
|
||||
// Issue 75751: no runtime test, just make sure it compiles.
|
||||
func test75751() int {
|
||||
return int(*C.issue75751m) + int(*C.issue75751m2)
|
||||
}
|
||||
|
||||
// Issue 76340.
|
||||
func test76340(t *testing.T) {
|
||||
var emptyInterface C.GoInterface
|
||||
r1 := C.issue76340testFromC(emptyInterface)
|
||||
if r1 != 0 {
|
||||
t.Errorf("issue76340testFromC with nil interface: got %d, want 0", r1)
|
||||
}
|
||||
|
||||
r2 := C.issue76340returnFromC(42)
|
||||
if r2.t == nil && r2.v == nil {
|
||||
t.Error("issue76340returnFromC(42) returned nil interface")
|
||||
}
|
||||
|
||||
r3 := C.issue76340returnFromC(0)
|
||||
if r3.t != nil || r3.v != nil {
|
||||
t.Errorf("issue76340returnFromC(0) returned non-nil interface: got %v, want nil", r3)
|
||||
}
|
||||
}
|
||||
|
||||
func testDITCgo(t *testing.T) {
|
||||
if !sys.DITSupported {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
C.enableDIT()
|
||||
|
||||
if ditAlreadyEnabled != sys.DITEnabled() {
|
||||
t.Fatalf("DIT state not preserved across cgo call: before %t, after %t", ditAlreadyEnabled, sys.DITEnabled())
|
||||
}
|
||||
|
||||
subtle.WithDataIndependentTiming(func() {
|
||||
C.disableDIT()
|
||||
|
||||
if !sys.DITEnabled() {
|
||||
t.Fatal("DIT disabled after disabling in cgo call")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func testDITCgoCallback(t *testing.T) {
|
||||
if !sys.DITSupported {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
|
||||
subtle.WithDataIndependentTiming(func() {
|
||||
if C.ditCallbackTest() != 1 {
|
||||
t.Fatal("DIT not enabled in cgo callback within WithDataIndependentTiming")
|
||||
}
|
||||
})
|
||||
|
||||
if ditAlreadyEnabled != sys.DITEnabled() {
|
||||
t.Fatalf("DIT state not preserved across cgo callback: before %t, after %t", ditAlreadyEnabled, sys.DITEnabled())
|
||||
}
|
||||
}
|
||||
|
||||
func testDITCgoCallbackEnableDIT(t *testing.T) {
|
||||
if !sys.DITSupported {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
|
||||
C.ditCallbackEnableDIT()
|
||||
|
||||
if ditAlreadyEnabled != sys.DITEnabled() {
|
||||
t.Fatalf("DIT state not preserved across cgo callback: before %t, after %t", ditAlreadyEnabled, sys.DITEnabled())
|
||||
}
|
||||
}
|
||||
|
||||
func testDITCgoCallbackDisableDIT(t *testing.T) {
|
||||
if !sys.DITSupported {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
|
||||
subtle.WithDataIndependentTiming(func() {
|
||||
C.ditCallbackDisableDIT()
|
||||
|
||||
if !sys.DITEnabled() {
|
||||
t.Fatal("DIT disabled after disabling in cgo call")
|
||||
}
|
||||
})
|
||||
|
||||
if ditAlreadyEnabled != sys.DITEnabled() {
|
||||
t.Fatalf("DIT state not preserved across cgo callback: before %t, after %t", ditAlreadyEnabled, sys.DITEnabled())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
|
||||
package cgotest
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"testing"
|
||||
)
|
||||
import "syscall"
|
||||
|
||||
var syscall_dot_SIGCHLD = syscall.SIGCHLD
|
||||
|
||||
func usesUCRT(t *testing.T) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -4,20 +4,6 @@
|
||||
|
||||
package cgotest
|
||||
|
||||
import (
|
||||
"internal/syscall/windows"
|
||||
"syscall"
|
||||
"testing"
|
||||
)
|
||||
import "syscall"
|
||||
|
||||
var syscall_dot_SIGCHLD syscall.Signal
|
||||
|
||||
// usesUCRT reports whether the test is using the Windows UCRT (Universal C Runtime).
|
||||
func usesUCRT(t *testing.T) bool {
|
||||
name, err := syscall.UTF16PtrFromString("ucrtbase.dll")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h, err := windows.GetModuleHandle(name)
|
||||
return err == nil && h != 0
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package cgotest
|
||||
|
||||
import (
|
||||
"internal/runtime/sys"
|
||||
"runtime"
|
||||
"runtime/cgo"
|
||||
"runtime/debug"
|
||||
@@ -448,7 +447,7 @@ func issue7978check(t *testing.T, wantFunc string, badFunc string, depth int) {
|
||||
runtime.GC()
|
||||
buf := make([]byte, 65536)
|
||||
trace := string(buf[:runtime.Stack(buf, true)])
|
||||
for goroutine := range strings.SplitSeq(trace, "\n\n") {
|
||||
for _, goroutine := range strings.Split(trace, "\n\n") {
|
||||
if strings.Contains(goroutine, "test.issue7978go") {
|
||||
trace := strings.Split(goroutine, "\n")
|
||||
// look for the expected function in the stack
|
||||
@@ -596,29 +595,3 @@ func test49633(t *testing.T) {
|
||||
t.Errorf("msg = %q, want 'hello'", v.msg)
|
||||
}
|
||||
}
|
||||
|
||||
//export exportAny76340Param
|
||||
func exportAny76340Param(obj any) C.int {
|
||||
if obj == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
//export exportAny76340Return
|
||||
func exportAny76340Return(val C.int) any {
|
||||
if val == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return int(val)
|
||||
}
|
||||
|
||||
//export ditCallback
|
||||
func ditCallback() uint8 {
|
||||
if sys.DITEnabled() {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func testMain(m *testing.M) int {
|
||||
if testing.Short() && testenv.Builder() == "" {
|
||||
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
|
||||
globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
|
||||
return m.Run()
|
||||
}
|
||||
@@ -102,14 +102,14 @@ func testMain(m *testing.M) int {
|
||||
bin = cmdToRun("./testp")
|
||||
|
||||
ccOut := goEnv("CC")
|
||||
cc = []string{ccOut}
|
||||
cc = []string{string(ccOut)}
|
||||
|
||||
out := goEnv("GOGCCFLAGS")
|
||||
quote := '\000'
|
||||
start := 0
|
||||
lastSpace := true
|
||||
backslash := false
|
||||
s := out
|
||||
s := string(out)
|
||||
for i, c := range s {
|
||||
if quote == '\000' && unicode.IsSpace(c) {
|
||||
if !lastSpace {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"cmd/cgo/internal/cgotest"
|
||||
"cmp"
|
||||
"debug/elf"
|
||||
"debug/pe"
|
||||
"encoding/binary"
|
||||
@@ -45,7 +44,7 @@ func TestMain(m *testing.M) {
|
||||
func testMain(m *testing.M) int {
|
||||
log.SetFlags(log.Lshortfile)
|
||||
flag.Parse()
|
||||
if testing.Short() && testenv.Builder() == "" {
|
||||
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
|
||||
globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
|
||||
return m.Run()
|
||||
}
|
||||
@@ -76,7 +75,7 @@ func testMain(m *testing.M) int {
|
||||
start := 0
|
||||
lastSpace := true
|
||||
backslash := false
|
||||
s := out
|
||||
s := string(out)
|
||||
for i, c := range s {
|
||||
if quote == '\000' && unicode.IsSpace(c) {
|
||||
if !lastSpace {
|
||||
@@ -273,7 +272,7 @@ func createHeaders() error {
|
||||
// which results in the linkers output implib getting overwritten at each step. So instead build the
|
||||
// import library the traditional way, using a def file.
|
||||
err = os.WriteFile("libgo.def",
|
||||
[]byte("LIBRARY libgo.dll\nEXPORTS\n\tDidInitRun\n\tDidMainRun\n\tDivu\n\tFromPkg\n"),
|
||||
[]byte("LIBRARY libgo.dll\nEXPORTS\n\tDidInitRun\n\tDidMainRun\n\tDivu\n\tFromPkg\n\t_cgo_dummy_export\n"),
|
||||
0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to write def file: %v", err)
|
||||
@@ -376,22 +375,27 @@ func TestExportedSymbols(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func checkNumberOfExportedSymbolsWindows(t *testing.T, exportedSymbols int, wantAll bool) {
|
||||
t.Parallel()
|
||||
tmpdir := t.TempDir()
|
||||
|
||||
prog := `
|
||||
func checkNumberOfExportedFunctionsWindows(t *testing.T, exportAllSymbols bool) {
|
||||
const prog = `
|
||||
package main
|
||||
|
||||
import "C"
|
||||
func main() {}
|
||||
|
||||
//export GoFunc
|
||||
func GoFunc() {
|
||||
println(42)
|
||||
}
|
||||
|
||||
//export GoFunc2
|
||||
func GoFunc2() {
|
||||
println(24)
|
||||
}
|
||||
|
||||
func main() {
|
||||
}
|
||||
`
|
||||
|
||||
for i := range exportedSymbols {
|
||||
prog += fmt.Sprintf(`
|
||||
//export GoFunc%d
|
||||
func GoFunc%d() {}
|
||||
`, i, i)
|
||||
}
|
||||
tmpdir := t.TempDir()
|
||||
|
||||
srcfile := filepath.Join(tmpdir, "test.go")
|
||||
objfile := filepath.Join(tmpdir, "test.dll")
|
||||
@@ -399,7 +403,7 @@ func GoFunc%d() {}
|
||||
t.Fatal(err)
|
||||
}
|
||||
argv := []string{"build", "-buildmode=c-shared"}
|
||||
if wantAll {
|
||||
if exportAllSymbols {
|
||||
argv = append(argv, "-ldflags", "-extldflags=-Wl,--export-all-symbols")
|
||||
}
|
||||
argv = append(argv, "-o", objfile, srcfile)
|
||||
@@ -413,36 +417,10 @@ func GoFunc%d() {}
|
||||
t.Fatalf("pe.Open failed: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, pe64 := f.OptionalHeader.(*pe.OptionalHeader64)
|
||||
// grab the export data directory entry
|
||||
var idd pe.DataDirectory
|
||||
if pe64 {
|
||||
idd = f.OptionalHeader.(*pe.OptionalHeader64).DataDirectory[pe.IMAGE_DIRECTORY_ENTRY_EXPORT]
|
||||
} else {
|
||||
idd = f.OptionalHeader.(*pe.OptionalHeader32).DataDirectory[pe.IMAGE_DIRECTORY_ENTRY_EXPORT]
|
||||
}
|
||||
|
||||
// figure out which section contains the import directory table
|
||||
var section *pe.Section
|
||||
for _, s := range f.Sections {
|
||||
if s.Offset == 0 {
|
||||
continue
|
||||
}
|
||||
if s.VirtualAddress <= idd.VirtualAddress && idd.VirtualAddress-s.VirtualAddress < s.VirtualSize {
|
||||
section = s
|
||||
break
|
||||
}
|
||||
}
|
||||
section := f.Section(".edata")
|
||||
if section == nil {
|
||||
t.Fatal("no section contains export directory")
|
||||
t.Skip(".edata section is not present")
|
||||
}
|
||||
d, err := section.Data()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// seek to the virtual address specified in the export data directory
|
||||
d = d[idd.VirtualAddress-section.VirtualAddress:]
|
||||
|
||||
// TODO: deduplicate this struct from cmd/link/internal/ld/pe.go
|
||||
type IMAGE_EXPORT_DIRECTORY struct {
|
||||
@@ -454,23 +432,26 @@ func GoFunc%d() {}
|
||||
_ [3]uint32
|
||||
}
|
||||
var e IMAGE_EXPORT_DIRECTORY
|
||||
if err := binary.Read(bytes.NewReader(d), binary.LittleEndian, &e); err != nil {
|
||||
if err := binary.Read(section.Open(), binary.LittleEndian, &e); err != nil {
|
||||
t.Fatalf("binary.Read failed: %v", err)
|
||||
}
|
||||
|
||||
exportedSymbols = cmp.Or(exportedSymbols, 1) // _cgo_stub_export is exported if there are no other symbols exported
|
||||
// Only the two exported functions and _cgo_dummy_export should be exported
|
||||
expectedNumber := uint32(3)
|
||||
|
||||
// NumberOfNames is the number of functions exported with a unique name.
|
||||
// NumberOfFunctions can be higher than that because it also counts
|
||||
// functions exported only by ordinal, a unique number asigned by the linker,
|
||||
// and linkers might add an unknown number of their own ordinal-only functions.
|
||||
if wantAll {
|
||||
if e.NumberOfNames <= uint32(exportedSymbols) {
|
||||
t.Errorf("got %d exported names, want > %d", e.NumberOfNames, exportedSymbols)
|
||||
if exportAllSymbols {
|
||||
if e.NumberOfFunctions <= expectedNumber {
|
||||
t.Fatalf("missing exported functions: %v", e.NumberOfFunctions)
|
||||
}
|
||||
if e.NumberOfNames <= expectedNumber {
|
||||
t.Fatalf("missing exported names: %v", e.NumberOfNames)
|
||||
}
|
||||
} else {
|
||||
if e.NumberOfNames != uint32(exportedSymbols) {
|
||||
t.Errorf("got %d exported names, want %d", e.NumberOfNames, exportedSymbols)
|
||||
if e.NumberOfFunctions != expectedNumber {
|
||||
t.Fatalf("got %d exported functions; want %d", e.NumberOfFunctions, expectedNumber)
|
||||
}
|
||||
if e.NumberOfNames != expectedNumber {
|
||||
t.Fatalf("got %d exported names; want %d", e.NumberOfNames, expectedNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,14 +467,12 @@ func TestNumberOfExportedFunctions(t *testing.T) {
|
||||
|
||||
t.Parallel()
|
||||
|
||||
for i := range 3 {
|
||||
t.Run(fmt.Sprintf("OnlyExported/%d", i), func(t *testing.T) {
|
||||
checkNumberOfExportedSymbolsWindows(t, i, false)
|
||||
})
|
||||
t.Run(fmt.Sprintf("All/%d", i), func(t *testing.T) {
|
||||
checkNumberOfExportedSymbolsWindows(t, i, true)
|
||||
})
|
||||
}
|
||||
t.Run("OnlyExported", func(t *testing.T) {
|
||||
checkNumberOfExportedFunctionsWindows(t, false)
|
||||
})
|
||||
t.Run("All", func(t *testing.T) {
|
||||
checkNumberOfExportedFunctionsWindows(t, true)
|
||||
})
|
||||
}
|
||||
|
||||
// test1: shared library can be dynamically loaded and exported symbols are accessible.
|
||||
|
||||
@@ -186,7 +186,7 @@ func cCompilerCmd(t *testing.T) []string {
|
||||
start := 0
|
||||
lastSpace := true
|
||||
backslash := false
|
||||
s := out
|
||||
s := string(out)
|
||||
for i, c := range s {
|
||||
if quote == '\000' && unicode.IsSpace(c) {
|
||||
if !lastSpace {
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
@@ -25,16 +24,15 @@ var tmp = flag.String("tmp", "", "use `dir` for temporary files and do not clean
|
||||
|
||||
// ptrTest is the tests without the boilerplate.
|
||||
type ptrTest struct {
|
||||
name string // for reporting
|
||||
c string // the cgo comment
|
||||
c1 string // cgo comment forced into non-export cgo file
|
||||
imports []string // a list of imports
|
||||
support string // supporting functions
|
||||
body string // the body of the main function
|
||||
extra []extra // extra files
|
||||
fail bool // whether the test should fail
|
||||
expensive bool // whether the test requires the expensive check
|
||||
errTextRegexp string // error text regexp; if empty, use the pattern `.*unpinned Go.*`
|
||||
name string // for reporting
|
||||
c string // the cgo comment
|
||||
c1 string // cgo comment forced into non-export cgo file
|
||||
imports []string // a list of imports
|
||||
support string // supporting functions
|
||||
body string // the body of the main function
|
||||
extra []extra // extra files
|
||||
fail bool // whether the test should fail
|
||||
expensive bool // whether the test requires the expensive check
|
||||
}
|
||||
|
||||
type extra struct {
|
||||
@@ -491,27 +489,6 @@ var ptrTests = []ptrTest{
|
||||
body: `i := 0; a := &[2]unsafe.Pointer{nil, unsafe.Pointer(&i)}; C.f45(&a[0])`,
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
// Passing a Go map as argument to C.
|
||||
name: "argmap",
|
||||
c: `void f46(void* p) {}`,
|
||||
imports: []string{"unsafe"},
|
||||
body: `m := map[int]int{0: 1,}; C.f46(unsafe.Pointer(&m))`,
|
||||
fail: true,
|
||||
errTextRegexp: `.*argument of cgo function has Go pointer to unpinned Go map`,
|
||||
},
|
||||
{
|
||||
// Returning a Go map to C.
|
||||
name: "retmap",
|
||||
c: `extern void f47();`,
|
||||
support: `//export GoMap47
|
||||
func GoMap47() map[int]int { return map[int]int{0: 1,} }`,
|
||||
body: `C.f47()`,
|
||||
c1: `extern void* GoMap47();
|
||||
void f47() { GoMap47(); }`,
|
||||
fail: true,
|
||||
errTextRegexp: `.*result of Go function GoMap47 called from cgo is unpinned Go map or points to unpinned Go map.*`,
|
||||
},
|
||||
}
|
||||
|
||||
func TestPointerChecks(t *testing.T) {
|
||||
@@ -542,6 +519,7 @@ func TestPointerChecks(t *testing.T) {
|
||||
// after testOne finishes.
|
||||
var pending int32
|
||||
for _, pt := range ptrTests {
|
||||
pt := pt
|
||||
t.Run(pt.name, func(t *testing.T) {
|
||||
atomic.AddInt32(&pending, +1)
|
||||
defer func() {
|
||||
@@ -712,17 +690,11 @@ func testOne(t *testing.T, pt ptrTest, exe, exe2 string) {
|
||||
}
|
||||
|
||||
buf, err := runcmd(cgocheck)
|
||||
|
||||
var pattern string = pt.errTextRegexp
|
||||
if pt.errTextRegexp == "" {
|
||||
pattern = `.*unpinned Go.*`
|
||||
}
|
||||
|
||||
if pt.fail {
|
||||
if err == nil {
|
||||
t.Logf("%s", buf)
|
||||
t.Fatalf("did not fail as expected")
|
||||
} else if ok, _ := regexp.Match(pattern, buf); !ok {
|
||||
} else if !bytes.Contains(buf, []byte("Go pointer")) {
|
||||
t.Logf("%s", buf)
|
||||
t.Fatalf("did not print expected error (failed with %v)", err)
|
||||
}
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package out_test
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"internal/goarch"
|
||||
"internal/testenv"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type methodAlign struct {
|
||||
Method string
|
||||
Align int
|
||||
}
|
||||
|
||||
var wantAligns = map[string]int{
|
||||
"ReturnEmpty": 1,
|
||||
"ReturnOnlyUint8": 1,
|
||||
"ReturnOnlyUint16": 2,
|
||||
"ReturnOnlyUint32": 4,
|
||||
"ReturnOnlyUint64": goarch.PtrSize,
|
||||
"ReturnOnlyInt": goarch.PtrSize,
|
||||
"ReturnOnlyPtr": goarch.PtrSize,
|
||||
"ReturnByteSlice": goarch.PtrSize,
|
||||
"ReturnString": goarch.PtrSize,
|
||||
"InputAndReturnUint8": 1,
|
||||
"MixedTypes": goarch.PtrSize,
|
||||
}
|
||||
|
||||
// TestAligned tests that the generated _cgo_export.c file has the wanted
|
||||
// align attributes for struct types used as arguments or results of
|
||||
// //exported functions.
|
||||
func TestAligned(t *testing.T) {
|
||||
testenv.MustHaveGoRun(t)
|
||||
testenv.MustHaveCGO(t)
|
||||
|
||||
testdata, err := filepath.Abs("testdata")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
objDir := t.TempDir()
|
||||
|
||||
cmd := testenv.Command(t, testenv.GoToolPath(t), "tool", "cgo",
|
||||
"-objdir", objDir,
|
||||
filepath.Join(testdata, "aligned.go"))
|
||||
cmd.Stderr = new(bytes.Buffer)
|
||||
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
t.Fatalf("%#q: %v\n%s", cmd, err, cmd.Stderr)
|
||||
}
|
||||
|
||||
haveAligns, err := parseAlign(filepath.Join(objDir, "_cgo_export.c"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Check that we have all the wanted methods
|
||||
if len(haveAligns) != len(wantAligns) {
|
||||
t.Fatalf("have %d methods with aligned, want %d", len(haveAligns), len(wantAligns))
|
||||
}
|
||||
|
||||
for i := range haveAligns {
|
||||
method := haveAligns[i].Method
|
||||
haveAlign := haveAligns[i].Align
|
||||
|
||||
wantAlign, ok := wantAligns[method]
|
||||
if !ok {
|
||||
t.Errorf("method %s: have aligned %d, want missing entry", method, haveAlign)
|
||||
} else if haveAlign != wantAlign {
|
||||
t.Errorf("method %s: have aligned %d, want %d", method, haveAlign, wantAlign)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parseAlign(filename string) ([]methodAlign, error) {
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
var results []methodAlign
|
||||
scanner := bufio.NewScanner(file)
|
||||
|
||||
// Regex to match function declarations like "struct MethodName_return MethodName("
|
||||
funcRegex := regexp.MustCompile(`^struct\s+(\w+)_return\s+(\w+)\(`)
|
||||
// Regex to match simple function declarations like "GoSlice MethodName("
|
||||
simpleFuncRegex := regexp.MustCompile(`^Go\w+\s+(\w+)\(`)
|
||||
// Regex to match void-returning exported functions like "void ReturnEmpty("
|
||||
voidFuncRegex := regexp.MustCompile(`^void\s+(\w+)\(`)
|
||||
// Regex to match align attributes like "__attribute__((aligned(8)))"
|
||||
alignRegex := regexp.MustCompile(`__attribute__\(\(aligned\((\d+)\)\)\)`)
|
||||
|
||||
var currentMethod string
|
||||
|
||||
for scanner.Scan() {
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
|
||||
// Check if this line declares a function with struct return type
|
||||
if matches := funcRegex.FindStringSubmatch(line); matches != nil {
|
||||
currentMethod = matches[2] // Extract the method name
|
||||
} else if matches := simpleFuncRegex.FindStringSubmatch(line); matches != nil {
|
||||
// Check if this line declares a function with simple return type (like GoSlice)
|
||||
currentMethod = matches[1] // Extract the method name
|
||||
} else if matches := voidFuncRegex.FindStringSubmatch(line); matches != nil {
|
||||
// Check if this line declares a void-returning function
|
||||
currentMethod = matches[1] // Extract the method name
|
||||
}
|
||||
|
||||
// Check if this line contains align information
|
||||
if alignMatches := alignRegex.FindStringSubmatch(line); alignMatches != nil && currentMethod != "" {
|
||||
alignStr := alignMatches[1]
|
||||
align, err := strconv.Atoi(alignStr)
|
||||
if err != nil {
|
||||
// Skip this entry if we can't parse the align as integer
|
||||
currentMethod = ""
|
||||
continue
|
||||
}
|
||||
results = append(results, methodAlign{
|
||||
Method: currentMethod,
|
||||
Align: align,
|
||||
})
|
||||
currentMethod = "" // Reset for next method
|
||||
}
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
return nil, fmt.Errorf("error reading file: %w", err)
|
||||
}
|
||||
|
||||
return results, nil
|
||||
}
|
||||
63
src/cmd/cgo/internal/testout/testdata/aligned.go
vendored
63
src/cmd/cgo/internal/testout/testdata/aligned.go
vendored
@@ -1,63 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package main
|
||||
|
||||
import "C"
|
||||
|
||||
//export ReturnEmpty
|
||||
func ReturnEmpty() {
|
||||
return
|
||||
}
|
||||
|
||||
//export ReturnOnlyUint8
|
||||
func ReturnOnlyUint8() (uint8, uint8, uint8) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
//export ReturnOnlyUint16
|
||||
func ReturnOnlyUint16() (uint16, uint16, uint16) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
//export ReturnOnlyUint32
|
||||
func ReturnOnlyUint32() (uint32, uint32, uint32) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
//export ReturnOnlyUint64
|
||||
func ReturnOnlyUint64() (uint64, uint64, uint64) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
//export ReturnOnlyInt
|
||||
func ReturnOnlyInt() (int, int, int) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
//export ReturnOnlyPtr
|
||||
func ReturnOnlyPtr() (*int, *int, *int) {
|
||||
a, b, c := 1, 2, 3
|
||||
return &a, &b, &c
|
||||
}
|
||||
|
||||
//export ReturnString
|
||||
func ReturnString() string {
|
||||
return "hello"
|
||||
}
|
||||
|
||||
//export ReturnByteSlice
|
||||
func ReturnByteSlice() []byte {
|
||||
return []byte{1, 2, 3}
|
||||
}
|
||||
|
||||
//export InputAndReturnUint8
|
||||
func InputAndReturnUint8(a, b, c uint8) (uint8, uint8, uint8) {
|
||||
return a, b, c
|
||||
}
|
||||
|
||||
//export MixedTypes
|
||||
func MixedTypes(a uint8, b uint16, c uint32, d uint64, e int, f *int) (uint8, uint16, uint32, uint64, int, *int) {
|
||||
return a, b, c, d, e, f
|
||||
}
|
||||
@@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
|
||||
var tmpDir string
|
||||
|
||||
// prettyPrintf prints lines with tmpDir sanitized.
|
||||
func prettyPrintf(format string, args ...any) {
|
||||
func prettyPrintf(format string, args ...interface{}) {
|
||||
s := fmt.Sprintf(format, args...)
|
||||
if tmpDir != "" {
|
||||
s = strings.ReplaceAll(s, tmpDir, "$TMPDIR")
|
||||
@@ -46,7 +46,7 @@ func prettyPrintf(format string, args ...any) {
|
||||
}
|
||||
|
||||
func testMain(m *testing.M) int {
|
||||
if testing.Short() && testenv.Builder() == "" {
|
||||
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
|
||||
globalSkip = func(t *testing.T) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
|
||||
return m.Run()
|
||||
}
|
||||
@@ -422,11 +422,3 @@ func TestIssue67976(t *testing.T) {
|
||||
globalSkip(t)
|
||||
goCmd(t, "build", "-buildmode=plugin", "-o", "issue67976.so", "./issue67976/plugin.go")
|
||||
}
|
||||
|
||||
func TestIssue75102(t *testing.T) {
|
||||
globalSkip(t)
|
||||
// add gcflags different from the executable file to trigger plugin open failed.
|
||||
goCmd(t, "build", "-gcflags=all=-N -l", "-buildmode=plugin", "-o", "issue75102.so", "./issue75102/plugin.go")
|
||||
goCmd(t, "build", "-o", "issue75102.exe", "./issue75102/main.go")
|
||||
run(t, "./issue75102.exe")
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"plugin"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, err := plugin.Open("issue75102.so")
|
||||
if err == nil {
|
||||
panic("unexpected success to open a different version plugin")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("done")
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package main
|
||||
|
||||
func init() {
|
||||
panic("unexpected call to init")
|
||||
}
|
||||
|
||||
func main() {}
|
||||
@@ -1,78 +0,0 @@
|
||||
// Copyright 2025 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.
|
||||
|
||||
package main
|
||||
|
||||
/*
|
||||
// Defined in tracebackctxt_c.c.
|
||||
extern void C1(void);
|
||||
extern void C2(void);
|
||||
extern void tcContext(void*);
|
||||
extern void tcTraceback(void*);
|
||||
extern void tcSymbolizer(void*);
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Regression test for https://go.dev/issue/73949. TSAN should not report races
|
||||
// on writes to the argument passed to the symbolizer function.
|
||||
//
|
||||
// Triggering this race requires calls to the symbolizer function with the same
|
||||
// argument pointer on multiple threads. The runtime passes a stack variable to
|
||||
// this function, so that means we need to get a single goroutine to execute on
|
||||
// two threads, calling the symbolizer function on each.
|
||||
//
|
||||
// runtime.CallersFrames / Next will call the symbolizer function (if there are
|
||||
// C frames). So the approach here is, with GOMAXPROCS=2, have 2 goroutines
|
||||
// that use CallersFrames over and over, both frequently calling Gosched in an
|
||||
// attempt to get picked up by the other P.
|
||||
|
||||
var tracebackOK bool
|
||||
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(2)
|
||||
runtime.SetCgoTraceback(0, unsafe.Pointer(C.tcTraceback), unsafe.Pointer(C.tcContext), unsafe.Pointer(C.tcSymbolizer))
|
||||
C.C1()
|
||||
if tracebackOK {
|
||||
fmt.Println("OK")
|
||||
}
|
||||
}
|
||||
|
||||
//export G1
|
||||
func G1() {
|
||||
C.C2()
|
||||
}
|
||||
|
||||
//export G2
|
||||
func G2() {
|
||||
pc := make([]uintptr, 32)
|
||||
n := runtime.Callers(0, pc)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for range 2 {
|
||||
wg.Go(func() {
|
||||
for range 1000 {
|
||||
cf := runtime.CallersFrames(pc[:n])
|
||||
var frames []runtime.Frame
|
||||
for {
|
||||
frame, more := cf.Next()
|
||||
frames = append(frames, frame)
|
||||
if !more {
|
||||
break
|
||||
}
|
||||
}
|
||||
runtime.Gosched()
|
||||
}
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
tracebackOK = true
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright 2025 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 tracebackctxt.go. That file uses //export so
|
||||
// it can't put function definitions in the "C" import comment.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Functions exported from Go.
|
||||
extern void G1(void);
|
||||
extern void G2(void);
|
||||
|
||||
void C1() {
|
||||
G1();
|
||||
}
|
||||
|
||||
void C2() {
|
||||
G2();
|
||||
}
|
||||
|
||||
struct cgoContextArg {
|
||||
uintptr_t context;
|
||||
};
|
||||
|
||||
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 tcContext(void* parg) {
|
||||
struct cgoContextArg* arg = (struct cgoContextArg*)(parg);
|
||||
if (arg->context == 0) {
|
||||
arg->context = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void tcTraceback(void* parg) {
|
||||
int base, i;
|
||||
struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg);
|
||||
if (arg->max < 1) {
|
||||
return;
|
||||
}
|
||||
arg->buf[0] = 6; // Chosen by fair dice roll.
|
||||
}
|
||||
|
||||
void tcSymbolizer(void *parg) {
|
||||
struct cgoSymbolizerArg* arg = (struct cgoSymbolizerArg*)(parg);
|
||||
if (arg->pc == 0) {
|
||||
return;
|
||||
}
|
||||
// Report two lines per PC returned by traceback, to test more handling.
|
||||
arg->more = arg->file == NULL;
|
||||
arg->file = "tracebackctxt.go";
|
||||
arg->func = "cFunction";
|
||||
arg->lineno = arg->pc + (arg->more << 16);
|
||||
}
|
||||
@@ -56,7 +56,6 @@ func TestTSAN(t *testing.T) {
|
||||
{src: "tsan13.go", needsRuntime: true},
|
||||
{src: "tsan14.go", needsRuntime: true},
|
||||
{src: "tsan15.go", needsRuntime: true},
|
||||
{src: "tsan_tracebackctxt", needsRuntime: true}, // Subdirectory
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
@@ -68,7 +67,7 @@ func TestTSAN(t *testing.T) {
|
||||
defer dir.RemoveAll(t)
|
||||
|
||||
outPath := dir.Join(name)
|
||||
mustRun(t, config.goCmd("build", "-o", outPath, "./"+srcPath(tc.src)))
|
||||
mustRun(t, config.goCmd("build", "-o", outPath, srcPath(tc.src)))
|
||||
|
||||
cmdArgs := []string{outPath}
|
||||
if goos == "linux" {
|
||||
|
||||
@@ -96,7 +96,7 @@ func goCmd(t *testing.T, args ...string) string {
|
||||
|
||||
// TestMain calls testMain so that the latter can use defer (TestMain exits with os.Exit).
|
||||
func testMain(m *testing.M) (int, error) {
|
||||
if testing.Short() && testenv.Builder() == "" {
|
||||
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
|
||||
globalSkip = func(t testing.TB) { t.Skip("short mode and $GO_BUILDER_NAME not set") }
|
||||
return m.Run(), nil
|
||||
}
|
||||
@@ -554,7 +554,7 @@ func checkPIE(t *testing.T, name string) {
|
||||
}
|
||||
|
||||
func TestTrivialPIE(t *testing.T) {
|
||||
if strings.Contains(testenv.Builder(), "-alpine") {
|
||||
if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-alpine") {
|
||||
t.Skip("skipping on alpine until issue #54354 resolved")
|
||||
}
|
||||
globalSkip(t)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//go:build test_run
|
||||
|
||||
// Compute Fibonacci numbers with two goroutines
|
||||
// that pass integers back and forth. No actual
|
||||
// that pass integers back and forth. No actual
|
||||
// concurrency, just threads and synchronization
|
||||
// and foreign code on multiple pthreads.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user