Subject: Re: help with ppc sections?

From: "Chris Friesen" <[email-masked]>
Date: Fri, 27 Jul 2007 12:55:52 -0600

Grant Likely wrote:

> Mild question; What the *@*#^$! are you doing trying to backport to a
> 2 year old kernel?!?  :-)

That's what happens in the embedded space.  It's the current version 
from our distro vendor.  It's also the version that all our different 
board suppliers could agree to provide support for.

Of course, it's also a royal pain.

>> Unfortunately for me, ppc doesn't have a ".section" line in that macro,
>> so I'm at a bit of a loss.

> Just add the section.  Should be trivial to do.  You might have to add
> it to the linker script as well.

I've done the linker script part already.  As for the processor.h bit, 
does this seem reasonable?  It seems to do the trick based on the 
function addresses, but I may be missing something and I haven't 
actually booted it yet.

The ppc64 version appends ',"a"' to the kprobes.text section line.  Is 
this needed here as well?  Could someone elaborate on exactly what its 
purpose is?

Thanks,

Chris

Index: linux-ias/include/asm-ppc/processor.h
===================================================================
--- linux-ias.orig/include/asm-ppc/processor.h
+++ linux-ias/include/asm-ppc/processor.h
@@ -38,6 +38,13 @@

  #define _GLOBAL(n)\
  	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".text"; \
+	.globl n;\
+n:
+
+#define _KPROBE(n)\
+	.stabs __stringify(n:F-1),N_FUN,0,0,n;\
+	.section ".kprobes.text","a"; \
  	.globl n;\
  n: