aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorDavid MacKenzie <djm@cygnus>1994-01-07 21:33:00 +0000
committerDavid MacKenzie <djm@cygnus>1994-01-07 21:33:00 +0000
commit5330499f720d8c00c89d9468dac9bcb34f2ac010 (patch)
tree8cfcb912bf135903775375fab736284a0befd0a8 /bfd/aoutx.h
parentf0d2557ca41c45e3e39b5a1e9f92877f1f882005 (diff)
downloadgdb-5330499f720d8c00c89d9468dac9bcb34f2ac010.zip
gdb-5330499f720d8c00c89d9468dac9bcb34f2ac010.tar.gz
gdb-5330499f720d8c00c89d9468dac9bcb34f2ac010.tar.bz2
* aoutx.h (adjust_z_magic): Don't merge the start of bss with the
end of data if they are not contiguous.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 1e2daa2..feb2072 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -788,10 +788,8 @@ adjust_z_magic (abfd, execp)
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
execp->a_text += adata(abfd).exec_bytes_size;
N_SET_MAGIC (*execp, ZMAGIC);
+
/* Spec says data section should be rounded up to page boundary. */
- /* If extra space in page is left after data section, fudge data
- in the header so that the bss section looks smaller by that
- amount. We'll start the bss section there, and lie to the OS. */
obj_datasec(abfd)->_raw_size
= align_power (obj_datasec(abfd)->_raw_size,
obj_bsssec(abfd)->alignment_power);
@@ -803,8 +801,19 @@ adjust_z_magic (abfd, execp)
if (!obj_bsssec(abfd)->user_set_vma)
obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma
+ obj_datasec(abfd)->_raw_size);
- execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 :
- obj_bsssec(abfd)->_raw_size - data_pad;
+ /* If the BSS immediately follows the data section and extra space
+ in the page is left after the data section, fudge data
+ in the header so that the bss section looks smaller by that
+ amount. We'll start the bss section there, and lie to the OS.
+ (Note that a linker script, as well as the above assignment,
+ could have explicitly set the BSS vma to immediately follow
+ the data section.) */
+ if (align_power (obj_bsssec(abfd)->vma, obj_bsssec(abfd)->alignment_power)
+ == obj_datasec(abfd)->vma + obj_datasec(abfd)->_raw_size)
+ execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 :
+ obj_bsssec(abfd)->_raw_size - data_pad;
+ else
+ execp->a_bss = obj_bsssec(abfd)->_raw_size;
}
static void