This is the mail archive of the binutils@sourceware.org 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: [MIPS] R_MIPS_GOT_DISP interferes with lazy binding


On Tue, May 7, 2013 at 6:32 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Lee Duhem <lee.duhem@gmail.com> writes:
>> My questions are:
>> 1. Are the relocation types of DRIBlockHandler and DRIWakeupHandler correct?
>
> It depends on what the source code is doing.  The two DRIBlockHandler
> R_MIPS_CALL16s sites are obviously direct calls to the function, but is
> the R_MIPS_GOT_DISP site too?  Or is the code taking the address of
> DRIBlockHandler, e.g. to use it as a callback?
>

There is only one direct call for DRIBlockHandler in glxdri.c. If it is compiled
with -O0, gcc will generate one R_MIPS_CALL16 relocation for it, but with -O2,
three relocations, two R_MIPS_CALL16 and one R_MIPS_GOT_DISP, will be
generated.

For DRIWakeupHandler, there is also only one direct call in glxdri.c. And gcc
with -O0 generates one R_MIPS_CALL16 relocation for it, but with -O2, two
R_MIPS_GOT_DISP relocations.

Does this mean that it is a gcc bug?

> It's a bug if the compiler is generating a R_MIPS_GOT_DISP for
> a direct call.  (This might happen, e.g., due to overly aggressive
> hoisting or CSE.)  On the other hand, R_MIPS_GOT_DISP is the correct
> choice if something is taking the address of the function.
>

Thanks for your time and explanations.

Sincerely,
lee


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