This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: Do solib address arithmetic with appropriate truncation
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Andrew Cagney <ac131313 at cygnus dot com>, Jim Blandy <jimb at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 4 Feb 2002 09:14:25 -0700
- Subject: Re: RFA: Do solib address arithmetic with appropriate truncation
- References: <20020203013131.C26295E9DE@zwingli.cygnus.com> <3C5D755D.4030201@cygnus.com>
On Feb 3, 12:37pm, Andrew Cagney wrote:
> > + /* Clear any bits of ADDR that wouldn't fit in a target-format
> > + data pointer. "Data pointer" here refers to whatever sort of
> > + address the dynamic linker uses to manage its sections. At the
> > + moment, we don't support shared libraries on any processors where
> > + code and data pointers are different sizes. */
> > + static CORE_ADDR
> > + svr4_truncate_ptr (CORE_ADDR addr)
> > + {
> > + if (TARGET_PTR_BIT == sizeof (CORE_ADDR) * 8)
> > + /* We don't need to truncate anything, and the bit twiddling below
> > + will fail due to overflow problems. */
> > + return addr;
> > + else
> > + return addr & (((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1);
> > + }
>
>
> There must be something around that this code can use. On something
> like a mips, this would be wrong - remember the sign extension problem.
I've never really understood the MIPS sign extension problem. Does it
occur when TARGET_PTR_BIT is smaller than the size of one or more of
the registers used to hold addresses?
Kevin