Skip to content

Commit

Permalink
all: power64 is now ppc64
Browse files Browse the repository at this point in the history
Fixes golang#8654.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/180600043
  • Loading branch information
rsc committed Dec 6, 2014
1 parent dcb2ec3 commit 09d92b6
Show file tree
Hide file tree
Showing 74 changed files with 131 additions and 135 deletions.
10 changes: 5 additions & 5 deletions include/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ struct Prog

// operands
Addr from;
uchar reg; // arm, power64 only (e.g., ADD from, reg, to);
uchar reg; // arm, ppc64 only (e.g., ADD from, reg, to);
// starts at 0 for both GPRs and FPRs;
// also used for ADATA width on arm, power64
Addr from3; // power64 only (e.g., RLWM/FMADD from, reg, from3, to)
// also used for ADATA width on arm, ppc64
Addr from3; // ppc64 only (e.g., RLWM/FMADD from, reg, from3, to)
Addr to;

// for 5g, 6g, 8g internal use
Expand Down Expand Up @@ -636,8 +636,8 @@ extern LinkArch link386;
extern LinkArch linkamd64;
extern LinkArch linkamd64p32;
extern LinkArch linkarm;
extern LinkArch linkpower64;
extern LinkArch linkpower64le;
extern LinkArch linkppc64;
extern LinkArch linkppc64le;

#pragma varargck type "A" int
#pragma varargck type "E" uint
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/9a/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Go-specific considerations are documented at
http://golang.org/doc/asm
Its target architecture is the Power64, referred to by these tools as
power64 (big endian) or power64le (little endian).
Its target architecture is 64-bit PowerPC and Power Architecture processors,
referred to by these tools as ppc64 (big endian) or ppc64le (little endian).
*/
package main
8 changes: 4 additions & 4 deletions src/cmd/9a/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dodef(char *p)
Dlist[nDlist++] = p;
}

LinkArch* thelinkarch = &linkpower64;
LinkArch* thelinkarch = &linkppc64;

void
usage(void)
Expand All @@ -87,15 +87,15 @@ main(int argc, char *argv[])
char *p;

thechar = '9';
thestring = "power64";
thestring = "ppc64";

// Allow GOARCH=thestring or GOARCH=thestringsuffix,
// but not other values.
p = getgoarch();
if(strncmp(p, thestring, strlen(thestring)) != 0)
sysfatal("cannot use %cc with GOARCH=%s", thechar, p);
if(strcmp(p, "power64le") == 0)
thelinkarch = &linkpower64le;
if(strcmp(p, "ppc64le") == 0)
thelinkarch = &linkppc64le;

ctxt = linknew(thelinkarch);
ctxt->diag = yyerror;
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/9g/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

/*
9g is the version of the gc compiler for the Power64.
The $GOARCH for these tools is power64 (big endian) or
power64le (little endian).
9g is the version of the gc compiler for 64-bit PowerPC or Power Architecture processors.
The $GOARCH for these tools is ppc64 (big endian) or
ppc64le (little endian).
It reads .go files and outputs .9 files. The flags are documented in ../gc/doc.go.
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/9g/galign.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
#include "gg.h"

int thechar = '9';
char* thestring = "power64";
char* thestring = "ppc64";
LinkArch* thelinkarch;

void
linkarchinit(void)
{
thestring = getgoarch();
if(strcmp(thestring, "power64le") == 0)
thelinkarch = &linkpower64le;
if(strcmp(thestring, "ppc64le") == 0)
thelinkarch = &linkppc64le;
else
thelinkarch = &linkpower64;
thelinkarch = &linkppc64;
}

vlong MAXWIDTH = 1LL<<50;
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/9g/ggen.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ ginscall(Node *f, int proc)
// However, the stack trace code will show the line
// of the instruction byte before the return PC.
// To avoid that being an unrelated instruction,
// insert a Power64 NOP that we will have the right line number.
// Power64 NOP is really or r0, r0, r0; use that description
// insert a ppc64 NOP that we will have the right line number.
// The ppc64 NOP is really or r0, r0, r0; use that description
// because the NOP pseudo-instruction would be removed by
// the linker.
nodreg(&reg, types[TINT], D_R0);
Expand Down Expand Up @@ -953,7 +953,7 @@ clearfat(Node *nl)
f = sysfunc("duffzero");
p = gins(ADUFFZERO, N, f);
afunclit(&p->to, f);
// 4 and 128 = magic constants: see ../../runtime/asm_power64x.s
// 4 and 128 = magic constants: see ../../runtime/asm_ppc64x.s
p->to.offset = 4*(128-q);
// duffzero leaves R3 on the last zeroed dword
boff = 8;
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/9g/peep.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ copyau1(Prog *p, Addr *v)
}

// copysub replaces v with s in a if f!=0 or indicates it if could if f==0.
// Returns 1 on failure to substitute (it always succeeds on power64).
// Returns 1 on failure to substitute (it always succeeds on ppc64).
static int
copysub(Addr *a, Addr *v, Addr *s, int f)
{
Expand All @@ -946,7 +946,7 @@ copysub(Addr *a, Addr *v, Addr *s, int f)
}

// copysub1 replaces v with s in p1->reg if f!=0 or indicates if it could if f==0.
// Returns 1 on failure to substitute (it always succeeds on power64).
// Returns 1 on failure to substitute (it always succeeds on ppc64).
static int
copysub1(Prog *p1, Addr *v, Addr *s, int f)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/9l/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ archreloc(Reloc *r, LSym *s, vlong *val)
*val = symaddr(r->sym) + r->add - symaddr(linklookup(ctxt, ".got", 0));
return 0;
case R_ADDRPOWER:
// r->add is two power64 instructions holding an immediate 32-bit constant.
// r->add is two ppc64 instructions holding an immediate 32-bit constant.
// We want to add r->sym's address to that constant.
// The encoding of the immediate x<<16 + y,
// where x is the low 16 bits of the first instruction and y is the low 16
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/9l/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

/*
9l is the linker for the Power64.
The $GOARCH for these tools is power64 (big endian) or
power64le (little endian).
9l is the linker for 64-bit PowerPC and Power Architecture processors.
The $GOARCH for these tools is ppc64 (big endian) or
ppc64le (little endian).
The flags are documented in ../ld/doc.go.
Expand Down
10 changes: 5 additions & 5 deletions src/cmd/9l/obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
#include "../ld/dwarf.h"
#include <ar.h>

char *thestring = "power64";
char *thestring = "ppc64";
LinkArch *thelinkarch;

void
linkarchinit(void)
{
thestring = getgoarch();
if(strcmp(thestring, "power64le") == 0)
thelinkarch = &linkpower64le;
if(strcmp(thestring, "ppc64le") == 0)
thelinkarch = &linkppc64le;
else
thelinkarch = &linkpower64;
thelinkarch = &linkppc64;
}

void
Expand Down Expand Up @@ -79,7 +79,7 @@ archinit(void)
if(INITRND == -1)
INITRND = 4096;
break;
case Hlinux: /* power64 elf */
case Hlinux: /* ppc64 elf */
debug['d'] = 1; // TODO(minux): dynamic linking is not supported yet.
elfinit();
HEADR = ELFRESERVE;
Expand Down
24 changes: 10 additions & 14 deletions src/cmd/cgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,19 @@ func usage() {
}

var ptrSizeMap = map[string]int64{
"386": 4,
"amd64": 8,
"arm": 4,
"ppc64": 8,
"ppc64le": 8,
"power64": 8,
"power64le": 8,
"386": 4,
"amd64": 8,
"arm": 4,
"ppc64": 8,
"ppc64le": 8,
}

var intSizeMap = map[string]int64{
"386": 4,
"amd64": 8,
"arm": 4,
"ppc64": 8,
"ppc64le": 8,
"power64": 8,
"power64le": 8,
"386": 4,
"amd64": 8,
"arm": 4,
"ppc64": 8,
"ppc64le": 8,
}

var cPrefix string
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static char *okgoarch[] = {
"amd64",
"amd64p32",
"386",
"power64",
"power64le",
"ppc64",
"ppc64le",
};

// The known operating systems.
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,9 @@ main(int argc, char **argv)
else if(contains(u.machine, "arm"))
gohostarch = "arm";
else if(contains(u.machine, "ppc64le"))
gohostarch = "power64le";
gohostarch = "ppc64le";
else if(contains(u.machine, "ppc64"))
gohostarch = "power64";
gohostarch = "ppc64";
else
fatal("unknown architecture: %s", u.machine);
}
Expand Down
10 changes: 5 additions & 5 deletions src/cmd/internal/objfile/disasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ var disasms = map[string]disasmFunc{
}

var byteOrders = map[string]binary.ByteOrder{
"386": binary.LittleEndian,
"amd64": binary.LittleEndian,
"arm": binary.LittleEndian,
"power64": binary.BigEndian,
"power64le": binary.LittleEndian,
"386": binary.LittleEndian,
"amd64": binary.LittleEndian,
"arm": binary.LittleEndian,
"ppc64": binary.BigEndian,
"ppc64le": binary.LittleEndian,
}
2 changes: 1 addition & 1 deletion src/cmd/internal/objfile/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (f *elfFile) goarch() string {
case elf.EM_ARM:
return "arm"
case elf.EM_PPC64:
return "power64"
return "ppc64"
}
return ""
}
2 changes: 1 addition & 1 deletion src/cmd/internal/objfile/macho.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (f *machoFile) goarch() string {
case macho.CpuArm:
return "arm"
case macho.CpuPpc64:
return "power64"
return "ppc64"
}
return ""
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/ld/ldelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum
ElfMachSparc32Plus, /* SPARC V8+ */
ElfMach960, /* Intel 80960 */
ElfMachPower, /* PowerPC */
ElfMachPower64, /* PowerPC 64 */
ElfMachPower64, /* PowerPC 64-bit */
ElfMachS390, /* IBM System/390 */
ElfMachV800 = 36, /* NEC V800 */
ElfMachFr20, /* Fujitsu FR20 */
Expand Down Expand Up @@ -438,7 +438,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
break;
case '9':
if(obj->machine != ElfMachPower64 || hdr->ident[4] != ElfClass64) {
diag("%s: elf object but not power64", pn);
diag("%s: elf object but not ppc64", pn);
return;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/objdump/objdump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func testDisasm(t *testing.T, flags ...string) {

func TestDisasm(t *testing.T) {
switch runtime.GOARCH {
case "power64", "power64le":
case "ppc64", "ppc64le":
t.Skipf("skipping on %s, issue 9039", runtime.GOARCH)
}
testDisasm(t)
Expand All @@ -114,7 +114,7 @@ func TestDisasmExtld(t *testing.T) {
t.Skipf("skipping on %s", runtime.GOOS)
}
switch runtime.GOARCH {
case "power64", "power64le":
case "ppc64", "ppc64le":
t.Skipf("skipping on %s, no support for external linking, issue 9038", runtime.GOARCH)
}
testDisasm(t, "-ldflags=-linkmode=external")
Expand Down
2 changes: 1 addition & 1 deletion src/debug/elf/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ var rppcStrings = []intName{
func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) }
func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) }

// Relocation types for PowerPC 64.
// Relocation types for 64-bit PowerPC or Power Architecture processors.
type R_PPC64 int

const (
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ func ArchChar(goarch string) (string, error) {
return "6", nil
case "arm":
return "5", nil
case "power64", "power64le":
case "ppc64", "ppc64le":
return "9", nil
}
return "", errors.New("unsupported GOARCH " + goarch)
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/syslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
package build

const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows "
const goarchList = "386 amd64 amd64p32 arm power64 power64le "
const goarchList = "386 amd64 amd64p32 arm ppc64 ppc64le "
2 changes: 1 addition & 1 deletion src/hash/crc32/crc32_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build 386 arm power64 power64le
// +build 386 arm ppc64 ppc64le

package crc32

Expand Down
10 changes: 5 additions & 5 deletions src/liblink/obj9.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ addstacksplit(Link *ctxt, LSym *cursym)
// NOP
//
// The NOP is needed to give the jumps somewhere to land.
// It is a liblink NOP, not a Power64 NOP: it encodes to 0 instruction bytes.
// It is a liblink NOP, not a ppc64 NOP: it encodes to 0 instruction bytes.


q = appendp(ctxt, q);
Expand Down Expand Up @@ -988,8 +988,8 @@ prg(void)
return p;
}

LinkArch linkpower64 = {
.name = "power64",
LinkArch linkppc64 = {
.name = "ppc64",
.thechar = '9',
.endian = BigEndian,

Expand Down Expand Up @@ -1035,8 +1035,8 @@ LinkArch linkpower64 = {
.AUSEFIELD = AUSEFIELD,
};

LinkArch linkpower64le = {
.name = "power64le",
LinkArch linkppc64le = {
.name = "ppc64le",
.thechar = '9',
.endian = LittleEndian,

Expand Down
2 changes: 1 addition & 1 deletion src/math/abs_power64x.s → src/math/abs_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build power64 power64le
// +build ppc64 ppc64le

#include "textflag.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build power64 power64le
// +build ppc64 ppc64le

#include "textflag.h"

Expand Down
Loading

0 comments on commit 09d92b6

Please sign in to comment.