1
0
mirror of https://github.com/golang/go synced 2024-11-17 18:44:44 -07:00

cmd/internal/objabi: define Go relocation types for loong64

Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
https://github.com/loongson/go

Updates #46229

Change-Id: I8d31b3cd827325aa0ff748ca8c0c0da6df6ed99f
Reviewed-on: https://go-review.googlesource.com/c/go/+/396734
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Xiaodong Liu 2022-03-30 15:47:04 +08:00 committed by Gopher Robot
parent d922c0a8f5
commit af99c2092a
2 changed files with 42 additions and 8 deletions

View File

@ -250,6 +250,32 @@ const (
// TODO(mundaym): remove once variants can be serialized - see issue 14218. // TODO(mundaym): remove once variants can be serialized - see issue 14218.
R_PCRELDBL R_PCRELDBL
// Loong64.
// R_ADDRLOONG64 resolves to the low 12 bits of an external address, by encoding
// it into the instruction.
R_ADDRLOONG64
// R_ADDRLOONG64U resolves to the sign-adjusted "upper" 20 bits (bit 5-24) of an
// external address, by encoding it into the instruction.
R_ADDRLOONG64U
// R_ADDRLOONG64TLS resolves to the low 12 bits of a TLS address (offset from
// thread pointer), by encoding it into the instruction.
R_ADDRLOONG64TLS
// R_ADDRLOONG64TLSU resolves to the high 20 bits of a TLS address (offset from
// thread pointer), by encoding it into the instruction.
R_ADDRLOONG64TLSU
// R_CALLLOONG64 resolves to non-PC-relative target address of a CALL (BL/JIRL)
// instruction, by encoding the address into the instruction.
R_CALLLOONG64
// R_JMPLOONG64 resolves to non-PC-relative target address of a JMP instruction,
// by encoding the address into the instruction.
R_JMPLOONG64
// R_ADDRMIPSU (only used on mips/mips64) resolves to the sign-adjusted "upper" 16 // R_ADDRMIPSU (only used on mips/mips64) resolves to the sign-adjusted "upper" 16
// bits (bit 16-31) of an external address, by encoding it into the instruction. // bits (bit 16-31) of an external address, by encoding it into the instruction.
R_ADDRMIPSU R_ADDRMIPSU
@ -286,7 +312,7 @@ const (
// the target address in register or memory. // the target address in register or memory.
func (r RelocType) IsDirectCall() bool { func (r RelocType) IsDirectCall() bool {
switch r { switch r {
case R_CALL, R_CALLARM, R_CALLARM64, R_CALLMIPS, R_CALLPOWER, R_RISCV_CALL, R_RISCV_CALL_TRAMP: case R_CALL, R_CALLARM, R_CALLARM64, R_CALLLOONG64, R_CALLMIPS, R_CALLPOWER, R_RISCV_CALL, R_RISCV_CALL_TRAMP:
return true return true
} }
return false return false
@ -301,6 +327,8 @@ func (r RelocType) IsDirectJump() bool {
switch r { switch r {
case R_JMPMIPS: case R_JMPMIPS:
return true return true
case R_JMPLOONG64:
return true
} }
return false return false
} }

View File

@ -65,16 +65,22 @@ func _() {
_ = x[R_RISCV_TLS_IE_ITYPE-55] _ = x[R_RISCV_TLS_IE_ITYPE-55]
_ = x[R_RISCV_TLS_IE_STYPE-56] _ = x[R_RISCV_TLS_IE_STYPE-56]
_ = x[R_PCRELDBL-57] _ = x[R_PCRELDBL-57]
_ = x[R_ADDRMIPSU-58] _ = x[R_ADDRLOONG64-58]
_ = x[R_ADDRMIPSTLS-59] _ = x[R_ADDRLOONG64U-59]
_ = x[R_ADDRCUOFF-60] _ = x[R_ADDRLOONG64TLS-60]
_ = x[R_WASMIMPORT-61] _ = x[R_ADDRLOONG64TLSU-61]
_ = x[R_XCOFFREF-62] _ = x[R_CALLLOONG64-62]
_ = x[R_JMPLOONG64-63]
_ = x[R_ADDRMIPSU-64]
_ = x[R_ADDRMIPSTLS-65]
_ = x[R_ADDRCUOFF-66]
_ = x[R_WASMIMPORT-67]
_ = x[R_XCOFFREF-68]
} }
const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_USEGENERICIFACEMETHODR_METHODOFFR_KEEPR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_CALLR_RISCV_CALL_TRAMPR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF" const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_USEIFACER_USEIFACEMETHODR_USEGENERICIFACEMETHODR_METHODOFFR_KEEPR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST16R_ARM64_LDST32R_ARM64_LDST64R_ARM64_LDST128R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_RISCV_CALLR_RISCV_CALL_TRAMPR_RISCV_PCREL_ITYPER_RISCV_PCREL_STYPER_RISCV_TLS_IE_ITYPER_RISCV_TLS_IE_STYPER_PCRELDBLR_ADDRLOONG64R_ADDRLOONG64UR_ADDRLOONG64TLSR_ADDRLOONG64TLSUR_CALLLOONG64R_JMPLOONG64R_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 53, 59, 68, 79, 88, 99, 109, 116, 123, 131, 139, 147, 153, 159, 165, 175, 184, 194, 210, 233, 244, 250, 261, 271, 280, 293, 307, 321, 335, 351, 362, 375, 388, 402, 416, 430, 445, 459, 473, 484, 498, 513, 530, 548, 569, 581, 599, 618, 637, 657, 677, 687, 698, 711, 722, 734, 744} var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 53, 59, 68, 79, 88, 99, 109, 116, 123, 131, 139, 147, 153, 159, 165, 175, 184, 194, 210, 233, 244, 250, 261, 271, 280, 293, 307, 321, 335, 351, 362, 375, 388, 402, 416, 430, 445, 459, 473, 484, 498, 513, 530, 548, 569, 581, 599, 618, 637, 657, 677, 687, 700, 714, 730, 747, 760, 772, 783, 796, 807, 819, 829}
func (i RelocType) String() string { func (i RelocType) String() string {
i -= 1 i -= 1