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: Andrew Cagney <ac131313 at cygnus dot com>
- To: Jim Blandy <jimb at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sun, 03 Feb 2002 12:37:33 -0500
- Subject: Re: RFA: Do solib address arithmetic with appropriate truncation
- References: <20020203013131.C26295E9DE@zwingli.cygnus.com>
> + /* 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.
Andrew