diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2007-08-02 16:02:01 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2007-08-02 16:02:01 +0000 |
commit | bd33be6e270cc4e725aa785c0db7fd172a6aa273 (patch) | |
tree | dcbd2ed2f926acee5e74813e3addaaefc1f041aa /bfd | |
parent | 7a3c21c92f0369b5d18c5c76dc4ba61dbb1f8dd2 (diff) | |
download | fsf-binutils-gdb-bd33be6e270cc4e725aa785c0db7fd172a6aa273.zip fsf-binutils-gdb-bd33be6e270cc4e725aa785c0db7fd172a6aa273.tar.gz fsf-binutils-gdb-bd33be6e270cc4e725aa785c0db7fd172a6aa273.tar.bz2 |
bfd/
2007-08-02 H.J. Lu <hongjiu.lu@intel.com>
* coffcode.h (ALIGN_SET): Removed.
(ELIFALIGN_SET): Likewise.
(coff_set_alignment_hook): Handle IMAGE_SCN_ALIGN_128BYTES,
IMAGE_SCN_ALIGN_256BYTES, IMAGE_SCN_ALIGN_512BYTES,
IMAGE_SCN_ALIGN_1024BYTES, IMAGE_SCN_ALIGN_2048BYTES,
IMAGE_SCN_ALIGN_4096BYTES and IMAGE_SCN_ALIGN_8192BYTES.
include/coff/
2007-08-02 H.J. Lu <hongjiu.lu@intel.com>
* pe.h (IMAGE_SCN_ALIGN_POWER_BIT_POS): New.
(IMAGE_SCN_ALIGN_POWER_BIT_MASK): Likewise.
(IMAGE_SCN_ALIGN_POWER_NUM): Likewise.
(IMAGE_SCN_ALIGN_POWER_CONST): Likewise.
(IMAGE_SCN_ALIGN_128BYTES): Likewise.
(IMAGE_SCN_ALIGN_256BYTES): Likewise.
(IMAGE_SCN_ALIGN_512BYTES): Likewise.
(IMAGE_SCN_ALIGN_1024BYTES): Likewise.
(IMAGE_SCN_ALIGN_2048BYTES): Likewise.
(IMAGE_SCN_ALIGN_4096BYTES): Likewise.
(IMAGE_SCN_ALIGN_8192BYTES): Likewise.
(IMAGE_SCN_ALIGN_1BYTES): Redefined with
IMAGE_SCN_ALIGN_POWER_CONST.
(IMAGE_SCN_ALIGN_2BYTES): Likewise.
(IMAGE_SCN_ALIGN_4BYTES): Likewise.
(IMAGE_SCN_ALIGN_8BYTES): Likewise.
(IMAGE_SCN_ALIGN_16BYTES): Likewise.
(IMAGE_SCN_ALIGN_32BYTES): Likewise.
(IMAGE_SCN_ALIGN_64BYTES): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/coffcode.h | 44 |
2 files changed, 33 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 68a9ef3..16690a5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2007-08-02 H.J. Lu <hongjiu.lu@intel.com> + + * coffcode.h (ALIGN_SET): Removed. + (ELIFALIGN_SET): Likewise. + (coff_set_alignment_hook): Handle IMAGE_SCN_ALIGN_128BYTES, + IMAGE_SCN_ALIGN_256BYTES, IMAGE_SCN_ALIGN_512BYTES, + IMAGE_SCN_ALIGN_1024BYTES, IMAGE_SCN_ALIGN_2048BYTES, + IMAGE_SCN_ALIGN_4096BYTES and IMAGE_SCN_ALIGN_8192BYTES. + 2007-08-01 Michael Snyder <msnyder@access-company.com> * vms-tir.c (new_section): Fix cut and paste error. diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 043e929..3d92ee5 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1628,19 +1628,6 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, #else /* ! COFF_ALIGN_IN_SECTION_HEADER */ #ifdef COFF_WITH_PE -/* A couple of macros to help setting the alignment power field. */ -#define ALIGN_SET(field, x, y) \ - if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x)\ - {\ - section->alignment_power = y;\ - } - -#define ELIFALIGN_SET(field, x, y) \ - else if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x) \ - {\ - section->alignment_power = y;\ - } - static void coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, asection * section, @@ -1648,14 +1635,31 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; bfd_size_type amt; + unsigned int alignment_power_const + = hdr->s_flags & IMAGE_SCN_ALIGN_POWER_BIT_MASK; - ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_16BYTES, 4) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_8BYTES, 3) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_4BYTES, 2) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES, 1) - ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES, 0) + switch (alignment_power_const) + { + case IMAGE_SCN_ALIGN_8192BYTES: + case IMAGE_SCN_ALIGN_4096BYTES: + case IMAGE_SCN_ALIGN_2048BYTES: + case IMAGE_SCN_ALIGN_1024BYTES: + case IMAGE_SCN_ALIGN_512BYTES: + case IMAGE_SCN_ALIGN_256BYTES: + case IMAGE_SCN_ALIGN_128BYTES: + case IMAGE_SCN_ALIGN_64BYTES: + case IMAGE_SCN_ALIGN_32BYTES: + case IMAGE_SCN_ALIGN_16BYTES: + case IMAGE_SCN_ALIGN_8BYTES: + case IMAGE_SCN_ALIGN_4BYTES: + case IMAGE_SCN_ALIGN_2BYTES: + case IMAGE_SCN_ALIGN_1BYTES: + section->alignment_power + = IMAGE_SCN_ALIGN_POWER_NUM (alignment_power_const); + break; + default: + break; + } /* In a PE image file, the s_paddr field holds the virtual size of a section, while the s_size field holds the raw size. We also keep |