Commit 033585d6 authored by Anthony Martin's avatar Anthony Martin Committed by Russ Cox

5l, 6l, 8l: correct ELFRESERVE diagnostic

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
parent 4566868b
...@@ -632,8 +632,8 @@ asmb(void) ...@@ -632,8 +632,8 @@ asmb(void)
a += elfwritehdr(); a += elfwritehdr();
a += elfwritephdrs(); a += elfwritephdrs();
a += elfwriteshdrs(); a += elfwriteshdrs();
cflush(); a += elfwriteinterp();
if(a+elfwriteinterp() > ELFRESERVE) if(a > ELFRESERVE)
diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE); diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
break; break;
} }
......
...@@ -1095,8 +1095,8 @@ asmb(void) ...@@ -1095,8 +1095,8 @@ asmb(void)
a += elfwritehdr(); a += elfwritehdr();
a += elfwritephdrs(); a += elfwritephdrs();
a += elfwriteshdrs(); a += elfwriteshdrs();
cflush(); a += elfwriteinterp();
if(a+elfwriteinterp() > ELFRESERVE) if(a > ELFRESERVE)
diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE); diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
break; break;
case Hwindows: case Hwindows:
......
...@@ -1160,8 +1160,8 @@ asmb(void) ...@@ -1160,8 +1160,8 @@ asmb(void)
a += elfwritehdr(); a += elfwritehdr();
a += elfwritephdrs(); a += elfwritephdrs();
a += elfwriteshdrs(); a += elfwriteshdrs();
cflush(); a += elfwriteinterp();
if(a+elfwriteinterp() > ELFRESERVE) if(a > ELFRESERVE)
diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE); diag("ELFRESERVE too small: %d > %d", a, ELFRESERVE);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment