From 5330499f720d8c00c89d9468dac9bcb34f2ac010 Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Fri, 7 Jan 1994 21:33:00 +0000 Subject: [PATCH] * aoutx.h (adjust_z_magic): Don't merge the start of bss with the end of data if they are not contiguous. --- bfd/ChangeLog | 3 +++ bfd/aoutx.h | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8816836be1e..100a2bf76de 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,8 @@ Fri Jan 7 10:27:27 1994 David J. Mackenzie (djm@rtl.cygnus.com) + * aoutx.h (adjust_z_magic): Don't merge the start of bss with the + end of data if they are not contiguous. + * aoutf1.h (sunos4_aout_backend): Comment the fields' meanings. Fri Jan 7 15:40:16 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 1e2daa27c65..feb2072541e 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 -- 2.30.2