]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: another attempt at the relocation overflow fix
authorRob Pike <r@golang.org>
Tue, 30 Apr 2013 16:49:36 +0000 (09:49 -0700)
committerRob Pike <r@golang.org>
Tue, 30 Apr 2013 16:49:36 +0000 (09:49 -0700)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9036046

src/cmd/ld/data.c

index 263dd25828cd05fa42de9b336c4572c07ea046ec..37ad2f8c87d5e8b9cd867ba232f1f9ad587193a1 100644 (file)
@@ -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;