Created
February 15, 2016 03:11
-
-
Save oshimaya/a47325e23316ec72e24c to your computer and use it in GitHub Desktop.
Patch for building go1.4 with x86/x86_64 newabi , GNU binutils 2.26 uses it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c | |
index 18b5aa3..2e9d339 100644 | |
--- a/src/cmd/6l/asm.c | |
+++ b/src/cmd/6l/asm.c | |
@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r) | |
return; | |
case 256 + R_X86_64_GOTPCREL: | |
+ case 256 + R_X86_64_GOTPCRELX: | |
+ case 256 + R_X86_64_REX_GOTPCRELX: | |
if(targ->type != SDYNIMPORT) { | |
// have symbol | |
if(r->off >= 2 && s->p[r->off-2] == 0x8b) { | |
diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c | |
index 98c0424..cff2948 100644 | |
--- a/src/cmd/8l/asm.c | |
+++ b/src/cmd/8l/asm.c | |
@@ -115,6 +115,7 @@ adddynrel(LSym *s, Reloc *r) | |
return; | |
case 256 + R_386_GOT32: | |
+ case 256 + R_386_GOT32X: | |
if(targ->type != SDYNIMPORT) { | |
// have symbol | |
if(r->off >= 2 && s->p[r->off-2] == 0x8b) { | |
diff --git a/src/cmd/ld/elf.h b/src/cmd/ld/elf.h | |
index e84d996..cc9ba79 100644 | |
--- a/src/cmd/ld/elf.h | |
+++ b/src/cmd/ld/elf.h | |
@@ -502,8 +502,24 @@ typedef struct { | |
#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ | |
#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ | |
#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ | |
+#define R_X86_64_PC64 24 | |
+#define R_X86_64_GOTOFF64 25 | |
+#define R_X86_64_GOTPC32 26 | |
+#define R_X86_64_GOT64 27 | |
+#define R_X86_64_GOTPCREL64 28 | |
+#define R_X86_64_GOTPC64 29 | |
+#define R_X86_64_GOTPLT64 30 | |
+#define R_X86_64_PLTOFF64 31 | |
+#define R_X86_64_SIZE32 32 | |
+#define R_X86_64_SIZE64 33 | |
+#define R_X86_64_GOTPC32_TLSDEC 34 | |
+#define R_X86_64_TLSDESC_CALL 35 | |
+#define R_X86_64_TLSDESC 36 | |
+#define R_X86_64_IRELATIVE 37 | |
+#define R_X86_64_PC32_BND 40 | |
+#define R_X86_64_GOTPCRELX 41 | |
+#define R_X86_64_REX_GOTPCRELX 42 | |
-#define R_X86_64_COUNT 24 /* Count of defined relocation types. */ | |
#define R_ALPHA_NONE 0 /* No reloc */ | |
@@ -535,7 +551,6 @@ typedef struct { | |
#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ | |
#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ | |
-#define R_ALPHA_COUNT 28 | |
#define R_ARM_NONE 0 /* No relocation. */ | |
@@ -578,7 +593,6 @@ typedef struct { | |
#define R_ARM_RPC24 254 | |
#define R_ARM_RBASE 255 | |
-#define R_ARM_COUNT 38 /* Count of defined relocation types. */ | |
#define R_386_NONE 0 /* No relocation. */ | |
@@ -612,8 +626,12 @@ typedef struct { | |
#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ | |
#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ | |
#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ | |
+#define R_386_TLS_GOTDESC 39 | |
+#define R_386_TLS_DESC_CALL 40 | |
+#define R_386_TLS_DESC 41 | |
+#define R_386_IRELATIVE 42 | |
+#define R_386_GOT32X 43 | |
-#define R_386_COUNT 38 /* Count of defined relocation types. */ | |
#define R_PPC_NONE 0 /* No relocation. */ | |
#define R_PPC_ADDR32 1 | |
@@ -653,7 +671,6 @@ typedef struct { | |
#define R_PPC_SECTOFF_HI 35 | |
#define R_PPC_SECTOFF_HA 36 | |
-#define R_PPC_COUNT 37 /* Count of defined relocation types. */ | |
#define R_PPC_TLS 67 | |
#define R_PPC_DTPMOD32 68 | |
@@ -698,7 +715,6 @@ typedef struct { | |
#define R_PPC_EMB_RELSDA 116 | |
/* Count of defined relocation types. */ | |
-#define R_PPC_EMB_COUNT (R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1) | |
#define R_SPARC_NONE 0 | |
diff --git a/src/cmd/ld/ldelf.c b/src/cmd/ld/ldelf.c | |
index dd5fa0d..2e2fbd1 100644 | |
--- a/src/cmd/ld/ldelf.c | |
+++ b/src/cmd/ld/ldelf.c | |
@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *siz) | |
case R('6', R_X86_64_PC32): | |
case R('6', R_X86_64_PLT32): | |
case R('6', R_X86_64_GOTPCREL): | |
+ case R('6', R_X86_64_GOTPCRELX): | |
+ case R('6', R_X86_64_REX_GOTPCRELX): | |
case R('8', R_386_32): | |
case R('8', R_386_PC32): | |
case R('8', R_386_GOT32): | |
case R('8', R_386_PLT32): | |
case R('8', R_386_GOTOFF): | |
case R('8', R_386_GOTPC): | |
+ case R('8', R_386_GOT32X): | |
*siz = 4; | |
break; | |
case R('6', R_X86_64_64): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment