This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Do solib address arithmetic with appropriate truncation


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]