[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/248] "ignoring least significant bits in branch offset"

From: amodra at bigpond dot net dot au
Subject: [Bug gas/248] "ignoring least significant bits in branch offset"
Date: 2 Jul 2004 00:41:53 -0000

------- Additional Comments From amodra at bigpond dot net dot au  2004-07-02 
00:41 -------
The error message is correct as is.  A problem with an offset might be due to
either source or destination, or both.

Really, what you're asking for is a check that powerpc insns are always properly
aligned.  I agree that this might be useful, but it's not trivial to implement.
The trouble is that at parsing and insn forming stage of gas we don't have much
idea of where the insn addresses happen to be.  Gas uses a data structure called
a frag when packaging insns.  frags don't make it easy to keep track of
addresses.  By the time you *do* know the address, it's too late to fix, since a
frag can easily contain many data and insn bytes intermixed.

See http://lists.gnu.org/archive/html/bug-binutils/2004-06/msg00103.html for
Jim's analysis of a similar request for ia64.

An approach that might work without introducing too much overhead or using
fragile schemes such as the alpha one is:
a) In the back-end, check that each emitted insn is at a proper offset from the
start of a frag.  You can get the offset with frag_now_fix ().
b) Have the back-end mark a frag as code-bearing when it contains insns.
c) Add a hook to the end of cvt_frag_to_fill that allows a back-end to check the
start address of code-bearing frags.

To handle weird code like
 .space 3
 .byte 0
you'd need to store insn offset mod 4 in step a) and complain if some other
remainder was used in the same frag.

This won't magically fix code, but it should allow a suitable error message to
be given.

           What    |Removed                     |Added
                 CC|                            |amodra at bigpond dot net
                   |                            |dot au, wilson at sources
                   |                            |dot redhat dot com
           Severity|minor                       |enhancement


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]