This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: [BFD PATCH] File truncation in objcopy for hppa2.0w-hp-hpux11.11 in binutils-2.13.1


sdowning@fame.com (Stuart F. Downing) writes:

> "John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:
> 
> > > --- src/bfd/configure.host      22 Jan 2002 00:47:21 -0000      1.9
> > > +++ src/bfd/configure.host      20 May 2003 19:24:17 -0000
> > > @@ -23,6 +23,7 @@
> > >  
> > > hppa*64*-*-hpux*)	HDEFINES=-DHOST_HPPAHPUX;
> > > 			host64=true; HOST_64BIT_TYPE=long ;;
> > > +hppa2*-*-hpux*)	HDEFINES="-DHOST_HPPAHPUX -DPA_2_0" ;;
> > 
> > I'm thinking that we should add the following to bfd/som.h before
> > including a.out.h:
> > 
> > #define PA_2_0
> > 
> > After including a.out.h:
> > 
> > #ifndef R_SHORT_PCREL_MODE
> > #define R_SHORT_PCREL_MODE 0x3e
> > #endif
> > 
> > #ifndef R_LONG_PCREL_MODE
> > #define R_LONG_PCREL_MODE 0x3f
> > #endif
> > 
> > I don't think support for these relocs and the other PA_2_0 defines
> > in reloc.h should be host dependent.  You should be able to operate
> > on a PA 2.0 file on a PA 1.X host.
> 
> I agree.
> 
> And perhaps the code conditional upon NO_PCREL_MODES (and the annoying
> double-negative #ifndef NO_PCREL_MODES) can be changed to
> be unconditionally included.
> 
> I will make these changes and submit another patch.
> -- 
> Stuart Downing

On second thought, it's not that straightforward and I'm not sure how
to change this without breaking PA1.X.  

The problem is the code in som.c already contains this...

/* And these first appeared in hpux10.  */
#ifndef R_SHORT_PCREL_MODE
#define NO_PCREL_MODES
#define R_SHORT_PCREL_MODE 0x3e
#endif

#ifndef R_LONG_PCREL_MODE
#define R_LONG_PCREL_MODE 0x3f
#endif

to define these relocations.  The NO_PCREL_MODES prevents the module
from emitting these relocations in hppa_som_gen_reloc_type here...
  switch (base_type)
    {
...
    case R_HPPA_PCREL_CALL:
      {
#ifndef NO_PCREL_MODES
	/* If we have short and long pcrel modes, then generate the proper
	   mode selector, then the pcrel relocation.  Redundant selectors
	   will be eliminted as the relocs are sized and emitted.  */
...


If we just define R_SHORT_PCREL_MODE and R_LONG_PCREL_MODE as
proposed, the code as it stands will incorrectly emit unsupported
relocations on PA1.X systems.

Someone with more knowledge than me needs to take a stab.
-- 
Stuart Downing


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