]> Cypherpunks repositories - gostls13.git/commitdiff
5l, 6l, 8l: correct ELFRESERVE diagnostic
authorAnthony Martin <ality@pbrane.org>
Tue, 18 Oct 2011 20:05:38 +0000 (16:05 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 18 Oct 2011 20:05:38 +0000 (16:05 -0400)
If the length of the interpreter string
pushes us over the ELFRESERVE limit, the
resulting error message will be comical.

I was doing some ELF tinkering with a
modified version of 8l when I hit this.

To be clear, the stock linkers wouldn't
hit this without adding about forty more
section headers.  We're safe for now. ;)

Also, remove a redundant call to cflush.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5268044

src/cmd/5l/asm.c
src/cmd/6l/asm.c
src/cmd/8l/asm.c

index 46fb6b63236ee098a9bd523865bd0549e2f804bf..f7fa688be19dde916bc3a693dfe0fea1cd7052b0 100644 (file)
@@ -632,8 +632,8 @@ asmb(void)
                a += elfwritehdr();
                a += elfwritephdrs();
                a += elfwriteshdrs();
-               cflush();
-               if(a+elfwriteinterp() > ELFRESERVE)     
+               a += elfwriteinterp();
+               if(a > ELFRESERVE)      
                        diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
                break;
        }
index dfb065e51cd9a9f7b16fc2de610db0f3c8b877c1..8c6bab83997678cc1c8845f45eb6e1100d8f5d93 100644 (file)
@@ -1095,8 +1095,8 @@ asmb(void)
                a += elfwritehdr();
                a += elfwritephdrs();
                a += elfwriteshdrs();
-               cflush();
-               if(a+elfwriteinterp() > ELFRESERVE)     
+               a += elfwriteinterp();
+               if(a > ELFRESERVE)      
                        diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
                break;
        case Hwindows:
index 119c8364b0a24c1228c85e24717314e30683a6e2..948d4889ca7d42b59cb4fa2eec37156ba146d257 100644 (file)
@@ -1160,8 +1160,8 @@ asmb(void)
                a += elfwritehdr();
                a += elfwritephdrs();
                a += elfwriteshdrs();
-               cflush();
-               if(a+elfwriteinterp() > ELFRESERVE)     
+               a += elfwriteinterp();
+               if(a > ELFRESERVE)      
                        diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
                break;