Re: R_SPARC_13

From: Richard Mortimer
Date: Mon Jan 17 2011 - 18:34:16 EST


On Mon, 2011-01-17 at 13:02 -0800, David Miller wrote:
> From: Richard Mortimer <richm@xxxxxxxxxxxxxxx>
> Date: Mon, 17 Jan 2011 19:46:21 +0000
>
> > As an example from drivers/scsi/scsi_error.c function scsi_eh_wakeup().
> >
> > This has relocation records of
> ...
> > 0000000000002be4 R_SPARC_LO10 __tracepoint_scsi_eh_wakeup
> > 0000000000002be4 R_SPARC_13 *ABS*+0x0000000000000008
> ...
> > lduw [%g1+%lo(__tracepoint_scsi_eh_wakeup)+8], %g2 ! __tracepoint_scsi_eh_wakeup.state,
>
> In a final object, the binutils linker should be using one
> R_SPARC_OLO10 relocation for this kind of expression on sparc64. Not
> the two relocations on the same instruction it appears to be using
> here. I think you're looking at an object output by the assembler
> and not the finally linked module.
>
> You should also be careful about which objects you are analyzing. You
> should be looking at the finally linked "foo.ko" file, not the
> individual "foo.o" objects, as the majority of the relocations go away
> when the linker puts together the final module.
>
> Is that what you're doing?

Yes in this instance I was/am. Thanks for the explanation.

However the same R_SPARC_13 also exists in scsi_mod.ko. It exists in the
original Debian 2.6.37-trunk-sparc64 version and in my current build of
the same with the 8 byte alignment for _trace_events.


00000000000074a8 R_SPARC_HI22 __tracepoint_scsi_eh_wakeup
00000000000074ac R_SPARC_LO10 __tracepoint_scsi_eh_wakeup
00000000000074ac R_SPARC_13 *ABS*+0x0000000000000008
00000000000074bc R_SPARC_LO10 __tracepoint_scsi_eh_wakeup
00000000000074bc R_SPARC_13 *ABS*+0x0000000000000020

74a8: 03 00 00 00 sethi %hi(0), %g1
74ac: c4 00 60 00 ld [ %g1 ], %g2
74b0: 80 a0 a0 00 cmp %g2, 0
74b4: 02 48 00 0c be %icc, 74e4 <scsi_eh_wakeup+0x50>
74b8: 01 00 00 00 nop
74bc: e0 58 60 00 ldx [ %g1 ], %l0

I guess that points towards the binutils linker not doing the correct
thing.

ld reports its version as

$ ld -v
GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303

and scsi_mod.ko is linked with the following command

ld -r -m elf64_sparc -T /richmtmp/linux-2.6-2.6.37/scripts/module-common.lds --build-id -o drivers/scsi/scsi_mod.ko drivers/scsi/scsi_mod.o drivers/scsi/scsi_mod.mod.o

Regards

Richard

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/