Commit 75d77956 authored by Russ Cox's avatar Russ Cox

runtime/cgo: make compatible with race detector

Some routines run without and m or g and cannot invoke the
race detector runtime. They must be opaque to the runtime.
That used to be true because they were written in C.
Now that they are written in Go, disable the race detector
annotations for those functions explicitly.

Add test.

Fixes #10874.

Change-Id: Ia8cc28d51e7051528f9f9594b75634e6bb66a785
Reviewed-on: https://go-review.googlesource.com/12534Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 0acecb71
......@@ -809,6 +809,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
fmt.Fprintf(fgo2, "//go:linkname _cgoexp%s_%s _cgoexp%s_%s\n", cPrefix, exp.ExpName, cPrefix, exp.ExpName)
fmt.Fprintf(fgo2, "//go:cgo_export_static _cgoexp%s_%s\n", cPrefix, exp.ExpName)
fmt.Fprintf(fgo2, "//go:nosplit\n") // no split stack, so no use of m or g
fmt.Fprintf(fgo2, "//go:norace\n") // must not have race detector calls inserted
fmt.Fprintf(fgo2, "func _cgoexp%s_%s(a unsafe.Pointer, n int32) {", cPrefix, exp.ExpName)
fmt.Fprintf(fgo2, "\tfn := %s\n", goname)
// The indirect here is converting from a Go function pointer to a C function pointer.
......
......@@ -660,6 +660,7 @@ var (
nosplit bool
nowritebarrier bool
systemstack bool
norace bool
)
var debuglive int
......
......@@ -1390,6 +1390,7 @@ xfndcl:
$$.Nbody = $3;
$$.Func.Endlineno = lineno;
$$.Noescape = noescape;
$$.Func.Norace = norace;
$$.Func.Nosplit = nosplit;
$$.Func.Nowritebarrier = nowritebarrier;
$$.Func.Systemstack = systemstack;
......@@ -1579,6 +1580,7 @@ xdcl_list:
}
nointerface = false
noescape = false
norace = false
nosplit = false
nowritebarrier = false
systemstack = false
......
......@@ -1612,6 +1612,11 @@ func getlinepragma() int {
return c
}
if verb == "go:norace" {
norace = true
return c
}
if verb == "go:nosplit" {
nosplit = true
return c
......
......@@ -42,6 +42,7 @@ func ispkgin(pkgs []string) bool {
return false
}
// TODO(rsc): Remove. Put //go:norace on forkAndExecInChild instead.
func isforkfunc(fn *Node) bool {
// Special case for syscall.forkAndExecInChild.
// In the child, this function must not acquire any locks, because
......@@ -52,7 +53,7 @@ func isforkfunc(fn *Node) bool {
}
func racewalk(fn *Node) {
if ispkgin(omit_pkgs) || isforkfunc(fn) {
if ispkgin(omit_pkgs) || isforkfunc(fn) || fn.Func.Norace {
return
}
......
......@@ -169,6 +169,7 @@ type Func struct {
Endlineno int32
Norace bool // func must not have race detector annotations
Nosplit bool // func should not execute on separate stack
Nowritebarrier bool // emit compiler error instead of write barrier
Dupok bool // duplicate definitions ok
......
......@@ -154,7 +154,7 @@ const yyEofCode = 1
const yyErrCode = 2
const yyMaxDepth = 200
//line go.y:2306
//line go.y:2308
func fixlbrace(lbr int) {
// If the opening brace was an LBODY,
// set up for another one now that we're done.
......@@ -2538,6 +2538,7 @@ yydefault:
yyVAL.node.Nbody = yyDollar[3].list
yyVAL.node.Func.Endlineno = lineno
yyVAL.node.Noescape = noescape
yyVAL.node.Func.Norace = norace
yyVAL.node.Func.Nosplit = nosplit
yyVAL.node.Func.Nowritebarrier = nowritebarrier
yyVAL.node.Func.Systemstack = systemstack
......@@ -2545,7 +2546,7 @@ yydefault:
}
case 205:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1401
//line go.y:1402
{
var t *Node
......@@ -2578,7 +2579,7 @@ yydefault:
}
case 206:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:1432
//line go.y:1433
{
var rcvr, t *Node
......@@ -2616,7 +2617,7 @@ yydefault:
}
case 207:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1470
//line go.y:1471
{
var s *Sym
var t *Type
......@@ -2643,7 +2644,7 @@ yydefault:
}
case 208:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:1495
//line go.y:1496
{
yyVAL.node = methodname1(newname(yyDollar[4].sym), yyDollar[2].list.N.Right)
yyVAL.node.Type = functype(yyDollar[2].list.N, yyDollar[6].list, yyDollar[8].list)
......@@ -2661,7 +2662,7 @@ yydefault:
}
case 209:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1513
//line go.y:1514
{
yyDollar[3].list = checkarglist(yyDollar[3].list, 1)
yyVAL.node = Nod(OTFUNC, nil, nil)
......@@ -2670,13 +2671,13 @@ yydefault:
}
case 210:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1521
//line go.y:1522
{
yyVAL.list = nil
}
case 211:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1525
//line go.y:1526
{
yyVAL.list = yyDollar[2].list
if yyVAL.list == nil {
......@@ -2685,51 +2686,51 @@ yydefault:
}
case 212:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1534
//line go.y:1535
{
yyVAL.list = nil
}
case 213:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1538
//line go.y:1539
{
yyVAL.list = list1(Nod(ODCLFIELD, nil, yyDollar[1].node))
}
case 214:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1542
//line go.y:1543
{
yyDollar[2].list = checkarglist(yyDollar[2].list, 0)
yyVAL.list = yyDollar[2].list
}
case 215:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1549
//line go.y:1550
{
closurehdr(yyDollar[1].node)
}
case 216:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1555
//line go.y:1556
{
yyVAL.node = closurebody(yyDollar[3].list)
fixlbrace(yyDollar[2].i)
}
case 217:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1560
//line go.y:1561
{
yyVAL.node = closurebody(nil)
}
case 218:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1571
//line go.y:1572
{
yyVAL.list = nil
}
case 219:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1575
//line go.y:1576
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[2].list)
if nsyntaxerrors == 0 {
......@@ -2737,55 +2738,56 @@ yydefault:
}
nointerface = false
noescape = false
norace = false
nosplit = false
nowritebarrier = false
systemstack = false
}
case 221:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1590
//line go.y:1592
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 223:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1597
//line go.y:1599
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 224:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1603
//line go.y:1605
{
yyVAL.list = list1(yyDollar[1].node)
}
case 225:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1607
//line go.y:1609
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 227:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1614
//line go.y:1616
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 228:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1620
//line go.y:1622
{
yyVAL.list = list1(yyDollar[1].node)
}
case 229:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1624
//line go.y:1626
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 230:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1630
//line go.y:1632
{
var l *NodeList
......@@ -2811,14 +2813,14 @@ yydefault:
}
case 231:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1654
//line go.y:1656
{
yyDollar[1].node.SetVal(yyDollar[2].val)
yyVAL.list = list1(yyDollar[1].node)
}
case 232:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1659
//line go.y:1661
{
yyDollar[2].node.SetVal(yyDollar[4].val)
yyVAL.list = list1(yyDollar[2].node)
......@@ -2826,7 +2828,7 @@ yydefault:
}
case 233:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1665
//line go.y:1667
{
yyDollar[2].node.Right = Nod(OIND, yyDollar[2].node.Right, nil)
yyDollar[2].node.SetVal(yyDollar[3].val)
......@@ -2834,7 +2836,7 @@ yydefault:
}
case 234:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1671
//line go.y:1673
{
yyDollar[3].node.Right = Nod(OIND, yyDollar[3].node.Right, nil)
yyDollar[3].node.SetVal(yyDollar[5].val)
......@@ -2843,7 +2845,7 @@ yydefault:
}
case 235:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1678
//line go.y:1680
{
yyDollar[3].node.Right = Nod(OIND, yyDollar[3].node.Right, nil)
yyDollar[3].node.SetVal(yyDollar[5].val)
......@@ -2852,7 +2854,7 @@ yydefault:
}
case 236:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1687
//line go.y:1689
{
var n *Node
......@@ -2864,7 +2866,7 @@ yydefault:
}
case 237:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1697
//line go.y:1699
{
var pkg *Pkg
......@@ -2879,33 +2881,33 @@ yydefault:
}
case 238:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1712
//line go.y:1714
{
yyVAL.node = embedded(yyDollar[1].sym, localpkg)
}
case 239:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1718
//line go.y:1720
{
yyVAL.node = Nod(ODCLFIELD, yyDollar[1].node, yyDollar[2].node)
ifacedcl(yyVAL.node)
}
case 240:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1723
//line go.y:1725
{
yyVAL.node = Nod(ODCLFIELD, nil, oldname(yyDollar[1].sym))
}
case 241:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1727
//line go.y:1729
{
yyVAL.node = Nod(ODCLFIELD, nil, oldname(yyDollar[2].sym))
Yyerror("cannot parenthesize embedded type")
}
case 242:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1734
//line go.y:1736
{
// without func keyword
yyDollar[2].list = checkarglist(yyDollar[2].list, 1)
......@@ -2915,7 +2917,7 @@ yydefault:
}
case 244:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1748
//line go.y:1750
{
yyVAL.node = Nod(ONONAME, nil, nil)
yyVAL.node.Sym = yyDollar[1].sym
......@@ -2923,7 +2925,7 @@ yydefault:
}
case 245:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1754
//line go.y:1756
{
yyVAL.node = Nod(ONONAME, nil, nil)
yyVAL.node.Sym = yyDollar[1].sym
......@@ -2931,56 +2933,56 @@ yydefault:
}
case 247:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1763
//line go.y:1765
{
yyVAL.list = list1(yyDollar[1].node)
}
case 248:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1767
//line go.y:1769
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 249:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1772
//line go.y:1774
{
yyVAL.list = nil
}
case 250:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1776
//line go.y:1778
{
yyVAL.list = yyDollar[1].list
}
case 251:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1784
//line go.y:1786
{
yyVAL.node = nil
}
case 253:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1789
//line go.y:1791
{
yyVAL.node = liststmt(yyDollar[1].list)
}
case 255:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1794
//line go.y:1796
{
yyVAL.node = nil
}
case 261:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1805
//line go.y:1807
{
yyDollar[1].node = Nod(OLABEL, yyDollar[1].node, nil)
yyDollar[1].node.Sym = dclstack // context, for goto restrictions
}
case 262:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1810
//line go.y:1812
{
var l *NodeList
......@@ -2993,7 +2995,7 @@ yydefault:
}
case 263:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1821
//line go.y:1823
{
// will be converted to OFALL
yyVAL.node = Nod(OXFALL, nil, nil)
......@@ -3001,38 +3003,38 @@ yydefault:
}
case 264:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1827
//line go.y:1829
{
yyVAL.node = Nod(OBREAK, yyDollar[2].node, nil)
}
case 265:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1831
//line go.y:1833
{
yyVAL.node = Nod(OCONTINUE, yyDollar[2].node, nil)
}
case 266:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1835
//line go.y:1837
{
yyVAL.node = Nod(OPROC, yyDollar[2].node, nil)
}
case 267:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1839
//line go.y:1841
{
yyVAL.node = Nod(ODEFER, yyDollar[2].node, nil)
}
case 268:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1843
//line go.y:1845
{
yyVAL.node = Nod(OGOTO, yyDollar[2].node, nil)
yyVAL.node.Sym = dclstack // context, for goto restrictions
}
case 269:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1848
//line go.y:1850
{
yyVAL.node = Nod(ORETURN, nil, nil)
yyVAL.node.List = yyDollar[2].list
......@@ -3054,7 +3056,7 @@ yydefault:
}
case 270:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1870
//line go.y:1872
{
yyVAL.list = nil
if yyDollar[1].node != nil {
......@@ -3063,7 +3065,7 @@ yydefault:
}
case 271:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1877
//line go.y:1879
{
yyVAL.list = yyDollar[1].list
if yyDollar[3].node != nil {
......@@ -3072,163 +3074,163 @@ yydefault:
}
case 272:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1886
//line go.y:1888
{
yyVAL.list = list1(yyDollar[1].node)
}
case 273:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1890
//line go.y:1892
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 274:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1896
//line go.y:1898
{
yyVAL.list = list1(yyDollar[1].node)
}
case 275:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1900
//line go.y:1902
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 276:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1906
//line go.y:1908
{
yyVAL.list = list1(yyDollar[1].node)
}
case 277:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1910
//line go.y:1912
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 278:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1916
//line go.y:1918
{
yyVAL.list = list1(yyDollar[1].node)
}
case 279:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1920
//line go.y:1922
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 280:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1929
//line go.y:1931
{
yyVAL.list = list1(yyDollar[1].node)
}
case 281:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1933
//line go.y:1935
{
yyVAL.list = list1(yyDollar[1].node)
}
case 282:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1937
//line go.y:1939
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 283:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1941
//line go.y:1943
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 284:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1946
//line go.y:1948
{
yyVAL.list = nil
}
case 285:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1950
//line go.y:1952
{
yyVAL.list = yyDollar[1].list
}
case 290:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1964
//line go.y:1966
{
yyVAL.node = nil
}
case 292:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1970
//line go.y:1972
{
yyVAL.list = nil
}
case 294:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1976
//line go.y:1978
{
yyVAL.node = nil
}
case 296:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1982
//line go.y:1984
{
yyVAL.list = nil
}
case 298:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1988
//line go.y:1990
{
yyVAL.list = nil
}
case 300:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1994
//line go.y:1996
{
yyVAL.list = nil
}
case 302:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:2000
//line go.y:2002
{
yyVAL.val.U = nil
}
case 304:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2010
//line go.y:2012
{
importimport(yyDollar[2].sym, yyDollar[3].val.U.(string))
}
case 305:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2014
//line go.y:2016
{
importvar(yyDollar[2].sym, yyDollar[3].typ)
}
case 306:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2018
//line go.y:2020
{
importconst(yyDollar[2].sym, Types[TIDEAL], yyDollar[4].node)
}
case 307:
yyDollar = yyS[yypt-6 : yypt+1]
//line go.y:2022
//line go.y:2024
{
importconst(yyDollar[2].sym, yyDollar[3].typ, yyDollar[5].node)
}
case 308:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2026
//line go.y:2028
{
importtype(yyDollar[2].typ, yyDollar[3].typ)
}
case 309:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2030
//line go.y:2032
{
if yyDollar[2].node == nil {
dclcontext = PEXTERN // since we skip the funcbody below
......@@ -3249,27 +3251,27 @@ yydefault:
}
case 310:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2051
//line go.y:2053
{
yyVAL.sym = yyDollar[1].sym
structpkg = yyVAL.sym.Pkg
}
case 311:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2058
//line go.y:2060
{
yyVAL.typ = pkgtype(yyDollar[1].sym)
importsym(yyDollar[1].sym, OTYPE)
}
case 317:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2078
//line go.y:2080
{
yyVAL.typ = pkgtype(yyDollar[1].sym)
}
case 318:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2082
//line go.y:2084
{
// predefined name like uint8
yyDollar[1].sym = Pkglookup(yyDollar[1].sym.Name, builtinpkg)
......@@ -3282,43 +3284,43 @@ yydefault:
}
case 319:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2093
//line go.y:2095
{
yyVAL.typ = aindex(nil, yyDollar[3].typ)
}
case 320:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2097
//line go.y:2099
{
yyVAL.typ = aindex(nodlit(yyDollar[2].val), yyDollar[4].typ)
}
case 321:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2101
//line go.y:2103
{
yyVAL.typ = maptype(yyDollar[3].typ, yyDollar[5].typ)
}
case 322:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2105
//line go.y:2107
{
yyVAL.typ = tostruct(yyDollar[3].list)
}
case 323:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2109
//line go.y:2111
{
yyVAL.typ = tointerface(yyDollar[3].list)
}
case 324:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2113
//line go.y:2115
{
yyVAL.typ = Ptrto(yyDollar[2].typ)
}
case 325:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2117
//line go.y:2119
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[2].typ
......@@ -3326,7 +3328,7 @@ yydefault:
}
case 326:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2123
//line go.y:2125
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
......@@ -3334,7 +3336,7 @@ yydefault:
}
case 327:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2129
//line go.y:2131
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
......@@ -3342,7 +3344,7 @@ yydefault:
}
case 328:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2137
//line go.y:2139
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
......@@ -3350,13 +3352,13 @@ yydefault:
}
case 329:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2145
//line go.y:2147
{
yyVAL.typ = functype(nil, yyDollar[3].list, yyDollar[5].list)
}
case 330:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2151
//line go.y:2153
{
yyVAL.node = Nod(ODCLFIELD, nil, typenod(yyDollar[2].typ))
if yyDollar[1].sym != nil {
......@@ -3366,7 +3368,7 @@ yydefault:
}
case 331:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2159
//line go.y:2161
{
var t *Type
......@@ -3383,7 +3385,7 @@ yydefault:
}
case 332:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2176
//line go.y:2178
{
var s *Sym
var p *Pkg
......@@ -3407,43 +3409,43 @@ yydefault:
}
case 333:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2200
//line go.y:2202
{
yyVAL.node = Nod(ODCLFIELD, newname(yyDollar[1].sym), typenod(functype(fakethis(), yyDollar[3].list, yyDollar[5].list)))
}
case 334:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2204
//line go.y:2206
{
yyVAL.node = Nod(ODCLFIELD, nil, typenod(yyDollar[1].typ))
}
case 335:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:2209
//line go.y:2211
{
yyVAL.list = nil
}
case 337:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2216
//line go.y:2218
{
yyVAL.list = yyDollar[2].list
}
case 338:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2220
//line go.y:2222
{
yyVAL.list = list1(Nod(ODCLFIELD, nil, typenod(yyDollar[1].typ)))
}
case 339:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2230
//line go.y:2232
{
yyVAL.node = nodlit(yyDollar[1].val)
}
case 340:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2234
//line go.y:2236
{
yyVAL.node = nodlit(yyDollar[2].val)
switch yyVAL.node.Val().Ctype() {
......@@ -3463,7 +3465,7 @@ yydefault:
}
case 341:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2252
//line go.y:2254
{
yyVAL.node = oldname(Pkglookup(yyDollar[1].sym.Name, builtinpkg))
if yyVAL.node.Op != OLITERAL {
......@@ -3472,7 +3474,7 @@ yydefault:
}
case 343:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2262
//line go.y:2264
{
if yyDollar[2].node.Val().Ctype() == CTRUNE && yyDollar[4].node.Val().Ctype() == CTINT {
yyVAL.node = yyDollar[2].node
......@@ -3485,37 +3487,37 @@ yydefault:
}
case 346:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2278
//line go.y:2280
{
yyVAL.list = list1(yyDollar[1].node)
}
case 347:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2282
//line go.y:2284
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 348:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2288
//line go.y:2290
{
yyVAL.list = list1(yyDollar[1].node)
}
case 349:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2292
//line go.y:2294
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 350:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2298
//line go.y:2300
{
yyVAL.list = list1(yyDollar[1].node)
}
case 351:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2302
//line go.y:2304
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
......
......@@ -822,6 +822,14 @@ func (t *tester) raceTest() error {
if err := t.dirCmd("src", "go", "test", "-race", "-short", "flag", "os/exec").Run(); err != nil {
return err
}
if t.cgoEnabled {
env := mergeEnvLists([]string{"GOTRACEBACK=2"}, os.Environ())
cmd := t.dirCmd("misc/cgo/test", "go", "test", "-race", "-short")
cmd.Env = env
if err := cmd.Run(); err != nil {
return err
}
}
if t.extLink() {
// Test with external linking; see issue 9133.
if err := t.dirCmd("src", "go", "test", "-race", "-short", "-ldflags=-linkmode=external", "flag", "os/exec").Run(); err != nil {
......
......@@ -37,6 +37,7 @@ var _runtime_cgo_panic_internal byte
//go:cgo_export_static _cgo_panic
//go:cgo_export_dynamic _cgo_panic
//go:nosplit
//go:norace
func _cgo_panic(a unsafe.Pointer, n int32) {
_runtime_cgocallback(unsafe.Pointer(&_runtime_cgo_panic_internal), a, uintptr(n))
}
......
......@@ -164,6 +164,7 @@ func signal_ignore(s uint32) {
// This runs on a foreign stack, without an m or a g. No stack split.
//go:nosplit
//go:norace
func badsignal(sig uintptr) {
cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment