Do not allow BFD_ALIGN to wrap

This commit is contained in:
Michael Meissner 1998-02-05 19:29:29 +00:00
parent fa1a1b3235
commit 29b7118aec
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Thu Feb 5 14:21:34 1998 Michael Meissner <meissner@cygnus.com>
* libbfd.h (BFD_ALIGN): If rounding up would cause the address to
wrap, just return all 1's bits instead.
Thu Feb 5 11:51:05 1998 Ian Lance Taylor <ian@cygnus.com>
* elf64-mips.c (mips_elf64_swap_reloca_out): Swap out r_addend,

View File

@ -24,9 +24,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Align an address upward to a boundary, expressed as a number of bytes.
E.g. align to an 8-byte boundary with argument of 8. */
#define BFD_ALIGN(this, boundary) \
((( (this) + ((boundary) -1)) & (~((boundary)-1))))
E.g. align to an 8-byte boundary with argument of 8. Take care never
to wrap around if the address is within boundary-1 of the end of the
address space. */
#define BFD_ALIGN(this, boundary) \
((((this) + (boundary) - 1) >= (this)) \
? (((this) + ((boundary) - 1)) & (~((boundary)-1))) \
: ~ (bfd_vma) 0)
/* If you want to read and write large blocks, you might want to do it
in quanta of this amount */
@ -808,6 +812,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MN10300_32_PCREL",
"BFD_RELOC_MN10300_16_PCREL",
"BFD_RELOC_TIC30_LDP",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif