linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modpost: Fix section warnings for ARM for many compilers
@ 2012-02-13 21:24 Tony Lindgren
  2012-02-13 22:26 ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2012-02-13 21:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, linux-omap, Rusty Russell, Ben Hutchings,
	Anders Kaseorg, Greg KH, Russell King

It turns out that many compilers don't show section warnings on ARM
currently because handling for ARM_CALL relocs are missing from
modpost.c.

Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when
loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and
R_ARM_JUMP24 can be handled the same way.

As modpost.c includes elf.h, we need to also consider that at least
Debian libc6-dev is missing defines for both R_ARM_CALL and R_ARM_JUMP24
in /usr/include/elf.h.

So for now let's just use the numbers in modpost.c.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Anders Kaseorg <andersk@ksplice.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>

---

Anybody got better ideas for dealing with the missing elf.h
defines?

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1505,6 +1505,8 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 		              (elf->symtab_start + ELF_R_SYM(r->r_info));
 		break;
 	case R_ARM_PC24:
+	case 28:		/* R_ARM_CALL */
+	case 29:		/* R_ARM_JUMP24 */
 		/* From ARM ABI: ((S + A) | T) - P */
 		r->r_addend = (int)(long)(elf->hdr +
 		              sechdr->sh_offset +

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] modpost: Fix section warnings for ARM for many compilers
  2012-02-13 21:24 [PATCH] modpost: Fix section warnings for ARM for many compilers Tony Lindgren
@ 2012-02-13 22:26 ` Uwe Kleine-König
  2012-02-13 22:51   ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2012-02-13 22:26 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-kernel, Anders Kaseorg, Rusty Russell, Greg KH,
	Russell King, linux-omap, Ben Hutchings, linux-arm-kernel

On Mon, Feb 13, 2012 at 01:24:01PM -0800, Tony Lindgren wrote:
> It turns out that many compilers don't show section warnings on ARM
> currently because handling for ARM_CALL relocs are missing from
> modpost.c.
> 
> Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when
> loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and
> R_ARM_JUMP24 can be handled the same way.
> 
> As modpost.c includes elf.h, we need to also consider that at least
> Debian libc6-dev is missing defines for both R_ARM_CALL and R_ARM_JUMP24
> in /usr/include/elf.h.
Huh, even unstable's /usr/include/elf.h doesn't have these symbols.

> So for now let's just use the numbers in modpost.c.
> 
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Cc: Anders Kaseorg <andersk@ksplice.com>
> Cc: Greg KH <gregkh@linuxfoundation.org>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> ---
> 
> Anybody got better ideas for dealing with the missing elf.h
> defines?
Maybe:

#ifndef R_ARM_CALL
#warning "you're elf.h include is outdated"
#define R_ARM_CALL 28
#endif

Best regards
Uwe

> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1505,6 +1505,8 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
>  		              (elf->symtab_start + ELF_R_SYM(r->r_info));
>  		break;
>  	case R_ARM_PC24:
> +	case 28:		/* R_ARM_CALL */
> +	case 29:		/* R_ARM_JUMP24 */
>  		/* From ARM ABI: ((S + A) | T) - P */
>  		r->r_addend = (int)(long)(elf->hdr +
>  		              sechdr->sh_offset +

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] modpost: Fix section warnings for ARM for many compilers
  2012-02-13 22:26 ` Uwe Kleine-König
@ 2012-02-13 22:51   ` Russell King - ARM Linux
  2012-02-14  0:29     ` Rusty Russell
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2012-02-13 22:51 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Tony Lindgren, linux-kernel, Anders Kaseorg, Rusty Russell,
	Greg KH, linux-omap, Ben Hutchings, linux-arm-kernel

On Mon, Feb 13, 2012 at 11:26:52PM +0100, Uwe Kleine-König wrote:
> On Mon, Feb 13, 2012 at 01:24:01PM -0800, Tony Lindgren wrote:
> > It turns out that many compilers don't show section warnings on ARM
> > currently because handling for ARM_CALL relocs are missing from
> > modpost.c.
> > 
> > Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when
> > loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and
> > R_ARM_JUMP24 can be handled the same way.
> > 
> > As modpost.c includes elf.h, we need to also consider that at least
> > Debian libc6-dev is missing defines for both R_ARM_CALL and R_ARM_JUMP24
> > in /usr/include/elf.h.
> Huh, even unstable's /usr/include/elf.h doesn't have these symbols.
> 
> > So for now let's just use the numbers in modpost.c.
> > 
> > Cc: Rusty Russell <rusty@rustcorp.com.au>
> > Cc: Ben Hutchings <ben@decadent.org.uk>
> > Cc: Anders Kaseorg <andersk@ksplice.com>
> > Cc: Greg KH <gregkh@linuxfoundation.org>
> > Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > ---
> > 
> > Anybody got better ideas for dealing with the missing elf.h
> > defines?
> Maybe:
> 
> #ifndef R_ARM_CALL
> #warning "you're elf.h include is outdated"

"You are elf.h include is outdated" does not make sense.

Why are you calling Tony an elf.h include?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] modpost: Fix section warnings for ARM for many compilers
  2012-02-13 22:51   ` Russell King - ARM Linux
@ 2012-02-14  0:29     ` Rusty Russell
  2012-02-14  1:12       ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Rusty Russell @ 2012-02-14  0:29 UTC (permalink / raw)
  To: Russell King - ARM Linux, Uwe Kleine-König
  Cc: Tony Lindgren, linux-kernel, Anders Kaseorg, Greg KH, linux-omap,
	Ben Hutchings, linux-arm-kernel

On Mon, 13 Feb 2012 22:51:18 +0000, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Mon, Feb 13, 2012 at 11:26:52PM +0100, Uwe Kleine-König wrote:
> > On Mon, Feb 13, 2012 at 01:24:01PM -0800, Tony Lindgren wrote:
> > Maybe:
> > 
> > #ifndef R_ARM_CALL
> > #warning "you're elf.h include is outdated"
> 
> "You are elf.h include is outdated" does not make sense.
> 
> Why are you calling Tony an elf.h include?

Because he knew it would attract the attention of pedants to the patch?
:)

Just do the #ifndef, and skip the warning.  There's not much the poor
user receiving the warning can do about it.

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks,
Rusty.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] modpost: Fix section warnings for ARM for many compilers
  2012-02-14  0:29     ` Rusty Russell
@ 2012-02-14  1:12       ` Tony Lindgren
  2012-02-14 21:01         ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2012-02-14  1:12 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Russell King - ARM Linux, Uwe Kleine-König, linux-kernel,
	Anders Kaseorg, Greg KH, linux-omap, Ben Hutchings,
	linux-arm-kernel

* Rusty Russell <rusty@rustcorp.com.au> [120213 16:07]:
> On Mon, 13 Feb 2012 22:51:18 +0000, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > On Mon, Feb 13, 2012 at 11:26:52PM +0100, Uwe Kleine-König wrote:
> > > On Mon, Feb 13, 2012 at 01:24:01PM -0800, Tony Lindgren wrote:
> > > Maybe:
> > > 
> > > #ifndef R_ARM_CALL
> > > #warning "you're elf.h include is outdated"
> > 
> > "You are elf.h include is outdated" does not make sense.
> > 
> > Why are you calling Tony an elf.h include?
> 
> Because he knew it would attract the attention of pedants to the patch?
> :)

I've been called worse than that :)
 
> Just do the #ifndef, and skip the warning.  There's not much the poor
> user receiving the warning can do about it.

OK
 
> Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Assuming your ack applies for this patch below, let me know if that's
not the case.  
Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Mon, 13 Feb 2012 12:30:09 -0800
Subject: [PATCH] modpost: Fix section warnings for ARM for many compilers

It turns out that many compilers don't show section warnings on ARM
currently because handling for ARM_CALL relocs are missing from
modpost.c.

Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when
loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and
R_ARM_JUMP24 can be handled the same way.

Note that at least Debian libc6-dev is missing defines for both
R_ARM_CALL and R_ARM_JUMP24 in /usr/include/elf.h. So for now
we need to define them in modpost.c if not defined.

Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Anders Kaseorg <andersk@ksplice.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1494,6 +1494,13 @@ static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 	return 0;
 }
 
+#ifndef R_ARM_CALL
+#define R_ARM_CALL	28
+#endif
+#ifndef R_ARM_JUMP24
+#define R_ARM_JUMP24	29
+#endif
+
 static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 {
 	unsigned int r_typ = ELF_R_TYPE(r->r_info);
@@ -1505,6 +1512,8 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 		              (elf->symtab_start + ELF_R_SYM(r->r_info));
 		break;
 	case R_ARM_PC24:
+	case R_ARM_CALL:
+	case R_ARM_JUMP24:
 		/* From ARM ABI: ((S + A) | T) - P */
 		r->r_addend = (int)(long)(elf->hdr +
 		              sechdr->sh_offset +

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] modpost: Fix section warnings for ARM for many compilers
  2012-02-14  1:12       ` Tony Lindgren
@ 2012-02-14 21:01         ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2012-02-14 21:01 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Russell King - ARM Linux, Uwe Kleine-König, linux-kernel,
	Anders Kaseorg, Greg KH, linux-omap, Ben Hutchings,
	linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [120213 16:41]:
> * Rusty Russell <rusty@rustcorp.com.au> [120213 16:07]:
> > On Mon, 13 Feb 2012 22:51:18 +0000, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > > On Mon, Feb 13, 2012 at 11:26:52PM +0100, Uwe Kleine-König wrote:
> > > > On Mon, Feb 13, 2012 at 01:24:01PM -0800, Tony Lindgren wrote:
> > > > Maybe:
> > > > 
> > > > #ifndef R_ARM_CALL
> > > > #warning "you're elf.h include is outdated"
> > > 
> > > "You are elf.h include is outdated" does not make sense.
> > > 
> > > Why are you calling Tony an elf.h include?
> > 
> > Because he knew it would attract the attention of pedants to the patch?
> > :)
> 
> I've been called worse than that :)
>  
> > Just do the #ifndef, and skip the warning.  There's not much the poor
> > user receiving the warning can do about it.
> 
> OK
>  
> > Acked-by: Rusty Russell <rusty@rustcorp.com.au>
> 
> Assuming your ack applies for this patch below, let me know if that's
> not the case.  

This is now in Russell's patch tracking system as patch 7324/1.

Tony

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-14 21:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-13 21:24 [PATCH] modpost: Fix section warnings for ARM for many compilers Tony Lindgren
2012-02-13 22:26 ` Uwe Kleine-König
2012-02-13 22:51   ` Russell King - ARM Linux
2012-02-14  0:29     ` Rusty Russell
2012-02-14  1:12       ` Tony Lindgren
2012-02-14 21:01         ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).