This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bug (and fix) in gas: frags.c @ frag_align
- To: Serge Nikulin <nikulin at actsw dot amat dot com>
- Subject: Re: Bug (and fix) in gas: frags.c @ frag_align
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Sat, 22 Jul 2000 14:24:36 +1000 (EST)
- cc: Serge Nikulin <Serge_Nikulin at amat dot com>, binutils at sourceware dot cygnus dot com
On Fri, 21 Jul 2000, Serge Nikulin wrote:
> I found the bug in frags.c file in frag_align function.
>
> new_off = ((abs_section_offset + alignment - 1)
> &~ ((1 << alignment) - 1));
Yes, that's broken. I'm checking in the following to fix it.
Thanks, Alan Modra
--
Linuxcare. Support for the Revolution.
gas/ChangeLog
* frags.c (frag_align): Correct absolute section alignment.
Index: frags.c
===================================================================
RCS file: /cvs/src/src/gas/frags.c,v
retrieving revision 1.5
diff -u -p -r1.5 frags.c
--- frags.c 2000/05/23 05:07:47 1.5
+++ frags.c 2000/07/22 04:11:36
@@ -303,9 +303,10 @@ frag_align (alignment, fill_character, m
if (now_seg == absolute_section)
{
addressT new_off;
+ addressT mask;
- new_off = ((abs_section_offset + alignment - 1)
- &~ ((1 << alignment) - 1));
+ mask = (~ (addressT) 0) << alignment;
+ new_off = (abs_section_offset + ~ mask) & mask;
if (max == 0 || new_off - abs_section_offset <= (addressT) max)
abs_section_offset = new_off;
}