Re: R_ARM_REL32 relocation patch

Nitin Garg <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
Thanks Ben, Shall I redo and submit the patch as per your suggestion?

On Tue, Jul 28, 2009 at 4:47 PM, Ben Dooks<[email protected]> wrote:
> On Tue, Jul 28, 2009 at 04:13:50PM -0500, Nitin Garg wrote:
>> I did google it around, also tried the workaround but that's still a
>> workaround I beleive. Eventually this has to be handled in the kernel.
>> Pls review, Thanks,
>>
>> --- a/arch/arm/kernel/module.c  2009-07-20 16:57:49.000000000 -0500
>> +++ b/arch/arm/kernel/module.c  2009-07-28 14:13:06.000000000 -0500
>> @@ -132,6 +132,11 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
>>                         *(u32 *)loc += sym->st_value;
>>                         break;
>>
>> +               case R_ARM_REL32:
>> +                       offset = *(u32 *)loc + sym->st_value - loc;
>> +                       *(u32 *)loc = offset & 0xffffffff;
>> +                       break;
>> +
>
> You shouldn't need to do offset & 0xffffffff, that's the natural size
> of an u32.
>
> I think this could be re-written as:
>
>        *(u32 *)loc += (sym->st_value - loc) * 4;
>
>
>                  case R_ARM_PC24:
>>                 case R_ARM_CALL:
>>                 case R_ARM_JUMP24:
>> --- a/arch/arm/include/asm/elf.h        2009-07-20 16:57:49.000000000 -0500
>> +++ b/arch/arm/include/asm/elf.h        2009-07-28 10:45:41.000000000 -0500
>> @@ -48,6 +48,7 @@ typedef struct user_fp elf_fpregset_t;
>>  #define R_ARM_NONE             0
>>  #define R_ARM_PC24             1
>>  #define R_ARM_ABS32            2
>> +#define R_ARM_REL32             3
>>  #define R_ARM_CALL             28
>>  #define R_ARM_JUMP24           29
>>  #define R_ARM_V4BX             40
>>
>>
>> On Tue, Jul 28, 2009 at 3:13 PM, Ben Dooks<[email protected]> wrote:
>> > On Tue, Jul 28, 2009 at 02:58:26PM -0500, Nitin Garg wrote:
>> >> Hi All,
>> >>
>> >> Pls review the attached patch for R_ARM_REL32 relocation handling.
>> >> Binutils 2.19.1 is adding the eh frame and hence we need to handle
>> >> R_ARM_REL32 for Loadable kernel modules.
>> >>
>> >> Thanks,
>> >> Nitin
>> >
>> > Please send patches inline so they can be reviewed (ie, turn up in
>> > the reply).
>> >
>> > Some simple looking around on google shows it may be easier to avoid
>> > generating these in the first place:
>> >
>> > http://forums.arm.com/index.php?s=766f87b528acd6be708a84cf3a58c02c&showtopic=8122&mode=threaded&pid=32358
>> >
>> > --
>> > Ben
>> >
>> > Q:      What's a light-year?
>> > A:      One-third less calories than a regular year.
>> >
>> >
>>
>> -------------------------------------------------------------------
>> List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
>> FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
>> Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
>
> --
> --
> Ben
>
> Q:      What's a light-year?
> A:      One-third less calories than a regular year.
>
>

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.