diff options
author | Frank Kotler <fbkotler@users.sourceforge.net> | 2004-04-25 02:57:00 +0000 |
---|---|---|
committer | Frank Kotler <fbkotler@users.sourceforge.net> | 2004-04-25 02:57:00 +0000 |
commit | 7c4dada951d062c50d3fd7752483ec733327e5d9 (patch) | |
tree | 7dd7c6e11c4660b4783b4f72e67218a1c02bdc4d | |
parent | 86f9e6a784bcd0ea652b6bfc95e88689df8857b0 (diff) | |
download | nasm-7c4dada951d062c50d3fd7752483ec733327e5d9.tar.gz |
fix as86 .bss handling per John Coffman's patch
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | output/outas86.c | 22 |
2 files changed, 20 insertions, 3 deletions
@@ -1,5 +1,6 @@ 0.98.39 ------- +* fix outas86's .bss handling * "make spotless" no longer deletes config.h.in. * %(el)if(n)idn insensitivity to string quotes difference (#809300). * (nasm.c) __OUTPUT_FORMAT__ changed to string value instead of symbol. diff --git a/output/outas86.c b/output/outas86.c index 3026ad9e..fa1514c4 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -395,7 +395,7 @@ static void as86_write(void) fwritelong (0x000186A3L, as86fp); fputc (0x2A, as86fp); fwritelong (27+symlen+seglen+strslen, as86fp); /* header length */ - fwritelong (stext.len+sdata.len, as86fp); + fwritelong (stext.len+sdata.len+bsslen, as86fp); fwriteshort (strslen, as86fp); fwriteshort (0, as86fp); /* class = revision = 0 */ fwritelong (0x55555555L, as86fp); /* segment max sizes: always this */ @@ -405,9 +405,9 @@ static void as86_write(void) else fwriteshort (stext.len, as86fp); if (segsize & 0x40000000L) - fwritelong (sdata.len, as86fp); + fwritelong (sdata.len+bsslen, as86fp); else - fwriteshort (sdata.len, as86fp); + fwriteshort (sdata.len+bsslen, as86fp); fwriteshort (nsyms, as86fp); /* @@ -437,6 +437,22 @@ static void as86_write(void) as86_reloc_size = -1; as86_write_section (&stext, SECT_TEXT); as86_write_section (&sdata, SECT_DATA); + /* + * Append the BSS section to the .data section + */ + if (bsslen > 65535L) { + fputc (0x13, as86fp); + fwritelong (bsslen, as86fp); + } + else if (bsslen > 255) { + fputc (0x12, as86fp); + fwriteshort (bsslen, as86fp); + } + else if (bsslen) { + fputc (0x11, as86fp); + fputc (bsslen, as86fp); + } + fputc (0, as86fp); /* termination */ } |