[pkg-golang-devel] [PATCH 1/4] New binutils defines new relocations that go doesn't know how to handle.

Michael Hudson-Doyle michael.hudson at canonical.com
Thu Nov 26 00:48:44 UTC 2015


This patch will be in Go 1.5.2 which will be released in a week or so, so
perhaps this could wait until then.
---
 debian/patches/series                        |  1 +
 debian/patches/support-new-relocations.patch | 84 ++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 debian/patches/support-new-relocations.patch

diff --git a/debian/patches/series b/debian/patches/series
index e69de29..e7c92b7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1 @@
+support-new-relocations.patch
diff --git a/debian/patches/support-new-relocations.patch b/debian/patches/support-new-relocations.patch
new file mode 100644
index 0000000..6241a28
--- /dev/null
+++ b/debian/patches/support-new-relocations.patch
@@ -0,0 +1,84 @@
+Description: support new 386/amd64 relocations generated by new bintuils
+Origin: https://go.googlesource.com/go/+/914db9f060b1fd3eb1f74d48f3bd46a73d4ae9c7
+Bug: https://github.com/golang/go/issues/13114
+Applied-Upstream: commit:914db9f060b1fd3eb1f74d48f3bd46a73d4ae9c7
+
+--- a/src/cmd/link/internal/amd64/asm.go
++++ b/src/cmd/link/internal/amd64/asm.go
+@@ -141,7 +141,7 @@
+ 
+ 		return
+ 
+-	case 256 + ld.R_X86_64_GOTPCREL:
++	case 256 + ld.R_X86_64_GOTPCREL, 256 + ld.R_X86_64_GOTPCRELX, 256 + ld.R_X86_64_REX_GOTPCRELX:
+ 		if targ.Type != obj.SDYNIMPORT {
+ 			// have symbol
+ 			if r.Off >= 2 && s.P[r.Off-2] == 0x8b {
+--- a/src/cmd/link/internal/ld/elf.go
++++ b/src/cmd/link/internal/ld/elf.go
+@@ -349,6 +349,23 @@
+ 	R_X86_64_GOTTPOFF          = 22
+ 	R_X86_64_TPOFF32           = 23
+ 	R_X86_64_COUNT             = 24
++	R_X86_64_PC64              = 24
++	R_X86_64_GOTOFF64          = 25
++	R_X86_64_GOTPC32           = 26
++	R_X86_64_GOT64             = 27
++	R_X86_64_GOTPCREL64        = 28
++	R_X86_64_GOTPC64           = 29
++	R_X86_64_GOTPLT64          = 30
++	R_X86_64_PLTOFF64          = 31
++	R_X86_64_SIZE32            = 32
++	R_X86_64_SIZE64            = 33
++	R_X86_64_GOTPC32_TLSDEC    = 34
++	R_X86_64_TLSDESC_CALL      = 35
++	R_X86_64_TLSDESC           = 36
++	R_X86_64_IRELATIVE         = 37
++	R_X86_64_PC32_BND          = 40
++	R_X86_64_GOTPCRELX         = 41
++	R_X86_64_REX_GOTPCRELX     = 42
+ 	R_AARCH64_ABS64            = 257
+ 	R_AARCH64_ABS32            = 258
+ 	R_AARCH64_CALL26           = 283
+@@ -454,7 +471,11 @@
+ 	R_386_TLS_DTPMOD32         = 35
+ 	R_386_TLS_DTPOFF32         = 36
+ 	R_386_TLS_TPOFF32          = 37
+-	R_386_COUNT                = 38
++	R_386_TLS_GOTDESC          = 39
++	R_386_TLS_DESC_CALL        = 40
++	R_386_TLS_DESC             = 41
++	R_386_IRELATIVE            = 42
++	R_386_GOT32X               = 43
+ 	R_PPC_NONE                 = 0
+ 	R_PPC_ADDR32               = 1
+ 	R_PPC_ADDR24               = 2
+--- a/src/cmd/link/internal/ld/ldelf.go
++++ b/src/cmd/link/internal/ld/ldelf.go
+@@ -1001,12 +1001,15 @@
+ 		'6' | R_X86_64_PC32<<24,
+ 		'6' | R_X86_64_PLT32<<24,
+ 		'6' | R_X86_64_GOTPCREL<<24,
++		'6' | R_X86_64_GOTPCRELX<<24,
++		'6' | R_X86_64_REX_GOTPCRELX<<24,
+ 		'8' | R_386_32<<24,
+ 		'8' | R_386_PC32<<24,
+ 		'8' | R_386_GOT32<<24,
+ 		'8' | R_386_PLT32<<24,
+ 		'8' | R_386_GOTOFF<<24,
+ 		'8' | R_386_GOTPC<<24,
++		'8' | R_386_GOT32X<<24,
+ 		'9' | R_PPC64_REL24<<24:
+ 		*siz = 4
+ 
+--- a/src/cmd/link/internal/x86/asm.go
++++ b/src/cmd/link/internal/x86/asm.go
+@@ -78,7 +78,7 @@
+ 
+ 		return
+ 
+-	case 256 + ld.R_386_GOT32:
++	case 256 + ld.R_386_GOT32, 256 + ld.R_386_GOT32X:
+ 		if targ.Type != obj.SDYNIMPORT {
+ 			// have symbol
+ 			if r.Off >= 2 && s.P[r.Off-2] == 0x8b {
-- 
2.5.0




More information about the pkg-golang-devel mailing list