aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2010-10-20 14:06:00 +1100
committerAlex Brainman <alex.brainman@gmail.com>2010-10-20 14:06:00 +1100
commit5e4963d9e8952d2f527746df3dd51dbde2354700 (patch)
treebc17b99ee13147f79bfa4ee31bde7b202e67b7a7
parenta9725396c00b876a9e59d3b35e71c7bde7b19e70 (diff)
downloadgo-5e4963d9e8952d2f527746df3dd51dbde2354700.tar.gz
go-5e4963d9e8952d2f527746df3dd51dbde2354700.zip
8l: fix windows build
R=rsc CC=golang-dev https://golang.org/cl/2595041
-rw-r--r--src/cmd/ld/pe.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd/ld/pe.c b/src/cmd/ld/pe.c
index 4351c7c57c..025782f872 100644
--- a/src/cmd/ld/pe.c
+++ b/src/cmd/ld/pe.c
@@ -86,6 +86,7 @@ pewrite(void)
{
int i, j;
+ seek(cout, 0, 0);
ewrite(cout, dosstub, sizeof dosstub);
strnput("PE", 4);
@@ -102,7 +103,7 @@ pewrite(void)
void
dope(void)
{
- textsect = new_section(".text", textsize, 0);
+ textsect = new_section(".text", segtext.len, 0);
textsect->Characteristics = IMAGE_SCN_CNT_CODE|
IMAGE_SCN_CNT_INITIALIZED_DATA|
IMAGE_SCN_MEM_EXECUTE|IMAGE_SCN_MEM_READ;
@@ -167,7 +168,6 @@ add_import_table(void)
for(f=fs; f->name; f++)
f->thunk += va;
- vlong off = seek(cout, 0, 1);
seek(cout, 0, 2);
for(d=ds; ; d++) {
lputl(d->OriginalFirstThunk);
@@ -187,12 +187,13 @@ add_import_table(void)
lputl(f->thunk);
strnput("", isect->SizeOfRawData - size);
cflush();
- seek(cout, off, 0);
}
void
asmbpe(void)
{
+ vlong eof;
+
switch(thechar) {
default:
diag("unknown PE architecture");
@@ -205,6 +206,10 @@ asmbpe(void)
break;
}
+ // make sure the end of file is INITRND-aligned.
+ eof = seek(cout, 0, 2);
+ strnput("", rnd(eof, INITRND) - eof);
+
add_import_table();
fh.NumberOfSections = nsect;