[PATCH V2] ldso: fix fdpic support broken from prelink patch

Filippo ARCIDIACONO filippo.arcidiacono at st.com
Tue Mar 27 08:59:18 UTC 2012



> -----Original Message-----
> From: Mike Frysinger [mailto:vapier at gentoo.org]
> Sent: Tuesday, March 27, 2012 5:13 AM
> To: Filippo ARCIDIACONO
> Cc: uclibc at uclibc.org; 'Bernhard Reutner-Fischer'
> Subject: Re: [PATCH V2] ldso: fix fdpic support broken from prelink
> patch
> 
> On Monday 26 March 2012 10:36:54 Filippo ARCIDIACONO wrote:
> > From: Mike Frysinger [mailto:vapier at gentoo.org]
> > > On Wednesday 07 March 2012 04:07:01 Filippo ARCIDIACONO wrote:
> > > > --- a/ldso/ldso/c6x/dl-sysdep.h
> > > > +++ b/ldso/ldso/c6x/dl-sysdep.h
> > > >
> > > > +/* Define this to set the library offset. */ #ifndef
> > > > +DL_SET_LIB_OFFSET # define DL_SET_LIB_OFFSET(offset)
> > > > +(_dl_library_offset = 0) #endif
> > > > +
> > > > +/* Define this to get the real object's load address. */ #ifndef
> > > > +DL_GET_LOADADDR_MAPADDR # define
> > > > +DL_GET_LOADADDR_MAPADDR(loadaddr,
> > > > +mapaddr) (loadaddr) #endif
> > >
> > > using ifndef in these arch files doesn't make much sense.  just
> drop
> > > those checks.
> >
> > You are right. I missed.
> >
> > > also, seems like _dl_library_offset is always set to 0.
> >
> > _dl_library_offset is 0 for fdpic and c6x archs only.
> 
> yes ... i was quoting the arch-specific headers when pointing this out
> 
> > > would make more sense i think to have the macro read:
> > > #define DL_SET_LIB_OFFSET(offset)
> > >
> > > and then add a new macro for declaring the _dl_library_offset
> > > variable which the common code would use to setup a static, and
> > > these arches would define to 0
> >
> > IIUC, I should add something like:
> >
> > #define DEF_LIBRARY_OFFSET() static unsigned long _dl_library_offset
> >
> > For common code, while for c6x and fdpic:
> >
> > #define DEF_LIBRARY_OFFSET() unsigned long _dl_library_offset = 0
> >
> > Is this what you mean?
> 
> for common code that is correct.  for c6x/fdpic, it should just be:
> #define DEF_LIBRARY_OFFSET()

In this way it needs another macro to be used in place of
_dl_library_offset,
To avoid undefined reference when compile for fdpic/c6x, let me say:
#define GET_LIB_OFFSET _dl_library_offset
For common arch and
#define GET_LIB_OFFSET 0
For fdpic/c6x arch.

> -mike

Filippo.



More information about the uClibc mailing list