public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Bug in gas: frags.c @ frag_align (absolute section alignment)
@ 2000-07-21 17:17 Serge Nikulin
  0 siblings, 0 replies; only message in thread
From: Serge Nikulin @ 2000-07-21 17:17 UTC (permalink / raw)
  To: binutils; +Cc: mark_golden

Hi,

As I reported already, I had a problem with alignment in absolute section.
I found the bug in frags.c file in frag_align function.

Old buggy code:
---------
      new_off = ((abs_section_offset + alignment - 1)
   &~ ((1 << alignment) - 1));
---------

When abs_section_offset == 1 and alignment == 1 then new_off should be == 2

In the above code new_off == 0

The proposed new code:
-------------------
if ((abs_section_offset & ((1 << alignment) - 1)) != 0)
    new_off = ((abs_section_offset  >> alignment) + 1) << alignment;
else
    new_off = abs_section_offset;    /* aligned already */
-------------------

Serge



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-21 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-21 17:17 Bug in gas: frags.c @ frag_align (absolute section alignment) Serge Nikulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).