Replaced by Ctxt.ByteOrder, which uses the standard binary.ByteOrder type.
Change-Id: I06cec0674c153a9ad75ff937f7eb934891effd0b
Reviewed-on: https://go-review.googlesource.com/6450
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
import (
"cmd/internal/obj"
+ "encoding/binary"
"fmt"
"log"
)
r.Sym = plt
r.Add = int64(targ.Plt)
r.Siz = 2
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
r.Off += int32(r.Siz)
}
r.Type = ld.R_POWER_TOC
r.Sym = plt
r.Add = int64(targ.Plt)
r.Siz = 2
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
r.Off += int32(r.Siz)
}
r.Type = ld.R_POWER_TOC
o2 = o2&0xffff0000 | uint32(t)&0xffff
// when laid out, the instruction order must always be o1, o2.
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
*val = int64(o1)<<32 | int64(o2)
} else {
*val = int64(o2)<<32 | int64(o1)
case ld.R_CALLPOWER:
// Bits 6 through 29 = (S + A - P) >> 2
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = ld.Be32(s.P[r.Off:])
} else {
o1 = ld.Le32(s.P[r.Off:])
if r.Variant&ld.RV_CHECK_OVERFLOW != 0 {
// Whether to check for signed or unsigned
// overflow depends on the instruction
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = ld.Be32(s.P[r.Off-2:])
} else {
o1 = ld.Le32(s.P[r.Off:])
if r.Variant&ld.RV_CHECK_OVERFLOW != 0 {
// Whether to check for signed or unsigned
// overflow depends on the instruction
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = ld.Be32(s.P[r.Off-2:])
} else {
o1 = ld.Le32(s.P[r.Off:])
return int64(int16(t))
case ld.RV_POWER_DS:
- if ld.Ctxt.Arch.Endian == ld.BigEndian {
+ if ld.Ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = uint32(ld.Be16(s.P[r.Off:]))
} else {
o1 = uint32(ld.Le16(s.P[r.Off:]))
ByteOrder: binary.LittleEndian,
Name: "arm",
Thechar: '5',
- Endian: LittleEndian,
Minlc: 4,
Ptrsize: 4,
Regsize: 4,
ByteOrder: binary.LittleEndian,
Name: "amd64",
Thechar: '6',
- Endian: LittleEndian,
Minlc: 1,
Ptrsize: 8,
Regsize: 8,
ByteOrder: binary.LittleEndian,
Name: "amd64p32",
Thechar: '6',
- Endian: LittleEndian,
Minlc: 1,
Ptrsize: 4,
Regsize: 8,
ByteOrder: binary.LittleEndian,
Name: "386",
Thechar: '8',
- Endian: LittleEndian,
Minlc: 1,
Ptrsize: 4,
Regsize: 4,
ByteOrder: binary.BigEndian,
Name: "ppc64",
Thechar: '9',
- Endian: BigEndian,
Minlc: 4,
Ptrsize: 8,
Regsize: 8,
ByteOrder: binary.LittleEndian,
Name: "ppc64le",
Thechar: '9',
- Endian: LittleEndian,
Minlc: 4,
Ptrsize: 8,
Regsize: 8,
package ld
import (
+ "encoding/binary"
"fmt"
"os"
)
switch Thearch.Thechar {
// 64-bit architectures
case '9':
- if Ctxt.Arch.Endian == BigEndian {
+ if Ctxt.Arch.ByteOrder == binary.BigEndian {
ehdr.flags = 1 /* Version 1 ABI */
} else {
ehdr.flags = 2 /* Version 2 ABI */
} else {
eh.ident[EI_CLASS] = ELFCLASS32
}
- if Ctxt.Arch.Endian == BigEndian {
+ if Ctxt.Arch.ByteOrder == binary.BigEndian {
eh.ident[EI_DATA] = ELFDATA2MSB
} else {
eh.ident[EI_DATA] = ELFDATA2LSB
// Link holds the context for writing object code from a compiler
// to be linker input or for reading that input into the linker.
-const (
- LittleEndian = 0x04030201
- BigEndian = 0x01020304
-)
-
// LinkArch is the definition of a single architecture.
/* executable header types */
Pconv: Pconv,
Name: "arm",
Thechar: '5',
- Endian: obj.LittleEndian,
Preprocess: preprocess,
Assemble: span5,
Follow: follow,
Pconv: Pconv,
Name: "386",
Thechar: '8',
- Endian: obj.LittleEndian,
Preprocess: preprocess,
Assemble: span8,
Follow: follow,
ByteOrder binary.ByteOrder
Name string
Thechar int
- Endian int32
Preprocess func(*Link, *LSym)
Assemble func(*Link, *LSym)
Follow func(*Link, *LSym)
// Link holds the context for writing object code from a compiler
// to be linker input or for reading that input into the linker.
-const (
- LittleEndian = 0x04030201
- BigEndian = 0x01020304
-)
-
// LinkArch is the definition of a single architecture.
/* executable header types */
import (
"cmd/internal/obj"
+ "encoding/binary"
"fmt"
"log"
"sort"
case 31: /* dword */
d = vregoff(ctxt, &p.From)
- if ctxt.Arch.Endian == obj.BigEndian {
+ if ctxt.Arch.ByteOrder == binary.BigEndian {
o1 = uint32(d >> 32)
o2 = uint32(d)
} else {
Pconv: Pconv,
Name: "ppc64",
Thechar: '9',
- Endian: obj.BigEndian,
Preprocess: preprocess,
Assemble: span9,
Follow: follow,
Pconv: Pconv,
Name: "ppc64le",
Thechar: '9',
- Endian: obj.LittleEndian,
Preprocess: preprocess,
Assemble: span9,
Follow: follow,
Pconv: Pconv,
Name: "amd64",
Thechar: '6',
- Endian: obj.LittleEndian,
Preprocess: preprocess,
Assemble: span6,
Follow: follow,
Pconv: Pconv,
Name: "amd64p32",
Thechar: '6',
- Endian: obj.LittleEndian,
Preprocess: preprocess,
Assemble: span6,
Follow: follow,