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: Special names tha ld needs to recognize for hppa64-hp-hpux11.X


> This change makes me a little nervous, even though I can't see anything
> wrong with it.  Are you sure an asm like the following will still work?
> I think it will, but I'm not sure and recall being caught out before
> when I used L'/R' selectors instead of LR'/RR' in plt stubs.

I believe the issue was loading the function address and gp value in stubs.
You need LR/RR here if you want a common high value for both operations.

>  bl 0f,%0
>  depi 0,31,2,%0
> 0:
>  addil L'foo - ($PIC_pcrel$0 - 8),%0
>  ldo R'foo - ($PIC_pcrel$0 - 12)(%%r1),%1

Still works.  There is a better way to write the L and R
operators to make this clear:

PCREL21L		L(symbol - PC - 8 + addend)
PCREL14R		R(symbol - PC - 8 + addend)

These are the relocations that the above code generates.
Note that the L and R operators are applied to the sum
"symbol - PC - 8 + addend".  In your example, the sums for
the addil and ldo instructions are identical.  Thus, there
is no problem.  However, pc relative relocations are not
suitable for accessing an array or structure using a common
L value.

Compare this to the situation for the LR and RR operators.

DIR21L			LR(symbol, addend)
DIR14R			RR(symbol, addend)

These relocations are a function of both the symbol and the
addend, not just the sum.  The rounding that is done in these
relocations is applied only to the addend.  Thus, these
can't be reduced but you can access locations near symbol.

The relocations R_PARISC_PLABEL14R and R_PARISC_PLABEL21L
appear to be gnu extensions for the e_rpsel and e_lpsel selectors.
They are not documented as HP relocations.  As far as I can tell,
R_PARISC_PLABEL14R, R_PARISC_PLABEL21L and R_PARISC_PLABEL32 are
only used with an addend of 0.  Thus, it doesn't really matter
which selector type is used.  However, all DLTIND and LTOFF
relocations specified in the HP ELF spec use L and R selectors.
Thus, for consistency the R_PARISC_PLABEL21L and R_PARISC_PLABEL14R
relocations should use L and R selectors, respectively.

As I understand it, the definitions for the PLABEL relocations
used in elf32-hppa.c are:

R_PARISC_PLABEL32	fptr(symbol)
R_PARISC_PLABEL21L	L(fptr(symbol))
R_PARISC_PLABEL14R	R(fptr(symbol))

where fptr(symbol) evaluates to the official procedure descriptor for
symbol.  There is no addend for these relocations and they are only
for 32-bit code.

Hope this clarifies things.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


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