aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi
diff options
context:
space:
mode:
authorerifan01 <eric.fang@arm.com>2018-09-26 10:12:18 +0000
committerCherry Zhang <cherryyz@google.com>2019-05-02 15:38:36 +0000
commitd2765de863355f8ae6e4354ae64c2099cd850382 (patch)
treef8c3562a56efc355dc190adb7802bee4cfeb545e /src/cmd/internal/objabi
parentd2c12634dedad9976dae0621d863d2cfb3a040bc (diff)
downloadgo-d2765de863355f8ae6e4354ae64c2099cd850382.tar.xz
cmd/link: support PIE mode with internal link on linux arm64
This CL improves internal link to provide basic support for cgo and PIE: 1, add support for GOT, PLT and GOTPLT. 2, add support for following ELF relocation types which have been used by std packages: R_AARCH64_ADR_GOT_PAGE R_AARCH64_LD64_GOT_LO12_NC R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64_ADD_ABS_LO12_NC R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64_JUMP26 R_AARCH64_ABS64 R_AARCH64_PREL32 R_AARCH64_PREL64 With this change, Go toolchain can be built in internal linking mode, and pure Go programs can be built with PIE mode in internal linking mode on arm64. Updates #10373 The prototype of this CL is contributed by Wei Xiao <wei.xiao@arm.com> Change-Id: I2253923c69e855fd1524d54def309a961dce6247 Reviewed-on: https://go-review.googlesource.com/c/go/+/163579 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/objabi')
-rw-r--r--src/cmd/internal/objabi/reloctype.go17
-rw-r--r--src/cmd/internal/objabi/reloctype_string.go6
2 files changed, 20 insertions, 3 deletions
diff --git a/src/cmd/internal/objabi/reloctype.go b/src/cmd/internal/objabi/reloctype.go
index 94d5469d9c..a28b48ba50 100644
--- a/src/cmd/internal/objabi/reloctype.go
+++ b/src/cmd/internal/objabi/reloctype.go
@@ -132,6 +132,23 @@ const (
// slot of the referenced symbol.
R_ARM64_GOTPCREL
+ // R_ARM64_GOT resolves a GOT-relative instruction sequence, usually an adrp
+ // followed by another ld instruction.
+ R_ARM64_GOT
+
+ // R_ARM64_PCREL resolves a PC-relative addresses instruction sequence, usually an
+ // adrp followed by another add instruction.
+ R_ARM64_PCREL
+
+ // R_ARM64_LDST8 sets a LD/ST immediate value to bits [11:0] of a local address.
+ R_ARM64_LDST8
+
+ // R_ARM64_LDST32 sets a LD/ST immediate value to bits [11:2] of a local address.
+ R_ARM64_LDST32
+
+ // R_ARM64_LDST64 sets a LD/ST immediate value to bits [11:3] of a local address.
+ R_ARM64_LDST64
+
// PPC64.
// R_POWER_TLS_LE is used to implement the "local exec" model for tls
diff --git a/src/cmd/internal/objabi/reloctype_string.go b/src/cmd/internal/objabi/reloctype_string.go
index 2cd3a94045..bd6d285617 100644
--- a/src/cmd/internal/objabi/reloctype_string.go
+++ b/src/cmd/internal/objabi/reloctype_string.go
@@ -1,12 +1,12 @@
-// Code generated by "stringer -type=RelocType"; DO NOT EDIT.
+// Code generated by "stringer -type RelocType"; DO NOT EDIT.
package objabi
import "strconv"
-const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORT"
+const _RelocType_name = "R_ADDRR_ADDRPOWERR_ADDRARM64R_ADDRMIPSR_ADDROFFR_WEAKADDROFFR_SIZER_CALLR_CALLARMR_CALLARM64R_CALLINDR_CALLPOWERR_CALLMIPSR_CONSTR_PCRELR_TLS_LER_TLS_IER_GOTOFFR_PLT0R_PLT1R_PLT2R_USEFIELDR_USETYPER_METHODOFFR_POWER_TOCR_GOTPCRELR_JMPMIPSR_DWARFSECREFR_DWARFFILEREFR_ARM64_TLS_LER_ARM64_TLS_IER_ARM64_GOTPCRELR_ARM64_GOTR_ARM64_PCRELR_ARM64_LDST8R_ARM64_LDST32R_ARM64_LDST64R_POWER_TLS_LER_POWER_TLS_IER_POWER_TLSR_ADDRPOWER_DSR_ADDRPOWER_GOTR_ADDRPOWER_PCRELR_ADDRPOWER_TOCRELR_ADDRPOWER_TOCREL_DSR_PCRELDBLR_ADDRMIPSUR_ADDRMIPSTLSR_ADDRCUOFFR_WASMIMPORTR_XCOFFREF"
-var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 129, 136, 144, 152, 160, 166, 172, 178, 188, 197, 208, 219, 229, 238, 251, 265, 279, 293, 309, 323, 337, 348, 362, 377, 394, 412, 433, 443, 454, 467, 478, 490}
+var _RelocType_index = [...]uint16{0, 6, 17, 28, 38, 47, 60, 66, 72, 81, 92, 101, 112, 122, 129, 136, 144, 152, 160, 166, 172, 178, 188, 197, 208, 219, 229, 238, 251, 265, 279, 293, 309, 320, 333, 346, 360, 374, 388, 402, 413, 427, 442, 459, 477, 498, 508, 519, 532, 543, 555, 565}
func (i RelocType) String() string {
i -= 1