go 1.3: fix build on i686 (ZHF)
This commit is contained in:
parent
5c57369fc4
commit
33da6ac765
@ -66,7 +66,7 @@ stdenv.mkDerivation {
|
||||
sed -i 's,/lib/ld-linux.so.2,${loader386},' src/cmd/8l/asm.c
|
||||
'';
|
||||
|
||||
patches = [ ./cacert-1.2.patch ];
|
||||
patches = [ ./cacert-1.2.patch ./R_386_GOT32.patch ];
|
||||
|
||||
GOOS = if stdenv.isDarwin then "darwin" else "linux";
|
||||
GOARCH = if stdenv.isDarwin then "amd64"
|
||||
|
46
pkgs/development/compilers/go/R_386_GOT32.patch
Normal file
46
pkgs/development/compilers/go/R_386_GOT32.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 609d996fac7f68b34032572b7bde627f658b95f2 Mon Sep 17 00:00:00 2001
|
||||
From: Russ Cox <rsc@golang.org>
|
||||
Date: Mon, 6 Oct 2014 14:17:48 -0400
|
||||
Subject: [PATCH] cmd/8l: accept R_386_GOT32 in push instruction
|
||||
|
||||
Fixes #8382.
|
||||
|
||||
LGTM=iant
|
||||
R=iant
|
||||
CC=golang-codereviews
|
||||
https://golang.org/cl/149540045
|
||||
---
|
||||
src/cmd/8l/asm.c | 18 +++++++++++++-----
|
||||
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c
|
||||
index c135dce..98c0424 100644
|
||||
--- a/src/cmd/8l/asm.c
|
||||
+++ b/src/cmd/8l/asm.c
|
||||
@@ -117,13 +117,21 @@ adddynrel(LSym *s, Reloc *r)
|
||||
case 256 + R_386_GOT32:
|
||||
if(targ->type != SDYNIMPORT) {
|
||||
// have symbol
|
||||
- // turn MOVL of GOT entry into LEAL of symbol itself
|
||||
- if(r->off < 2 || s->p[r->off-2] != 0x8b) {
|
||||
- diag("unexpected GOT reloc for non-dynamic symbol %s", targ->name);
|
||||
+ if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
|
||||
+ // turn MOVL of GOT entry into LEAL of symbol address, relative to GOT.
|
||||
+ s->p[r->off-2] = 0x8d;
|
||||
+ r->type = R_GOTOFF;
|
||||
return;
|
||||
}
|
||||
- s->p[r->off-2] = 0x8d;
|
||||
- r->type = R_GOTOFF;
|
||||
+ if(r->off >= 2 && s->p[r->off-2] == 0xff && s->p[r->off-1] == 0xb3) {
|
||||
+ // turn PUSHL of GOT entry into PUSHL of symbol itself.
|
||||
+ // use unnecessary SS prefix to keep instruction same length.
|
||||
+ s->p[r->off-2] = 0x36;
|
||||
+ s->p[r->off-1] = 0x68;
|
||||
+ r->type = R_ADDR;
|
||||
+ return;
|
||||
+ }
|
||||
+ diag("unexpected GOT reloc for non-dynamic symbol %s", targ->name);
|
||||
return;
|
||||
}
|
||||
addgotsym(ctxt, targ);
|
Loading…
Reference in New Issue
Block a user