1
0
mirror of https://github.com/golang/go synced 2024-11-07 09:36:11 -07:00
go/test/linkx.go
Cherry Zhang 5caac2f73e [dev.link] cmd: default to new object files
Switch the default to new object files.

Internal linking cgo is disabled for now, as it does not work yet
in newobj mode.

Shared libraries are also broken.

Disable some tests that are known broken for now.

Change-Id: I8ca74793423861d607a2aa7b0d89a4f4d4ca7671
Reviewed-on: https://go-review.googlesource.com/c/go/+/200161
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-16 15:57:07 +00:00

41 lines
844 B
Go

// skip
// Copyright 2012 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.
// Test the -X facility of the gc linker (6l etc.).
// This test is run by linkx_run.go.
package main
import "fmt"
var tbd string
var overwrite string = "dibs"
var tbdcopy = tbd
var overwritecopy = overwrite
var arraycopy = [2]string{tbd, overwrite}
var b bool
var x int
func main() {
fmt.Println(tbd)
fmt.Println(tbdcopy)
fmt.Println(arraycopy[0])
fmt.Println(overwrite)
fmt.Println(overwritecopy)
fmt.Println(arraycopy[1])
// Check non-string symbols are not overwritten.
// This also make them used.
// TODO: decide if we need to issue an error if -X
// is applied to a non-string unreachable symbol.
if b || x != 0 {
panic("b or x overwritten")
}
}