aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2013-04-30 09:49:36 -0700
committerRob Pike <r@golang.org>2013-04-30 09:49:36 -0700
commit5c0d782ab8a5bffab7de9c91ebfb7fe3f32de1bd (patch)
tree8c879f47c2f48e97b326d34fbe13ee298558fa5e
parent700a126c64948f91822dcc0380f32438dad6fc71 (diff)
downloadgo-5c0d782ab8a5bffab7de9c91ebfb7fe3f32de1bd.tar.gz
go-5c0d782ab8a5bffab7de9c91ebfb7fe3f32de1bd.zip
cmd/ld: another attempt at the relocation overflow fix
R=golang-dev, iant CC=golang-dev https://golang.org/cl/9036046
-rw-r--r--src/cmd/ld/data.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c
index 263dd25828..37ad2f8c87 100644
--- a/src/cmd/ld/data.c
+++ b/src/cmd/ld/data.c
@@ -259,9 +259,12 @@ relocsym(Sym *s)
cursym = s;
diag("bad reloc size %#ux for %s", siz, r->sym->name);
case 4:
- if((r->type == D_PCREL && o != (int32)o) || (r->type != D_PCREL && o != (uint32)o)) {
- cursym = S;
- diag("relocation address is too big: %#llx", o);
+ if(r->type == D_PCREL) {
+ if(o != (int32)o)
+ diag("pc-relative relocation address is too big: %#llx", o);
+ } else {
+ if(o != (int32)o && o != (uint32)o)
+ diag("non-pc-relative relocation address is too big: %#llux", o);
}
fl = o;
cast = (uchar*)&fl;