From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Modra To: Serge Nikulin Cc: Serge Nikulin , binutils@sourceware.cygnus.com Subject: Re: Bug (and fix) in gas: frags.c @ frag_align Date: Fri, 21 Jul 2000 21:25:00 -0000 Message-id: References: <001601bff365$3d3b5bd0$35758798@mis.amat.com> X-SW-Source: 2000-07/msg00406.html 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; }