All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: "linuxppc-dev@ozlabs.org list" <linuxppc-dev@ozlabs.org>,
	lkml List <linux-kernel@vger.kernel.org>
Subject: Re: How to link a .o with all modules
Date: Sun, 4 May 2008 21:24:34 +0200	[thread overview]
Message-ID: <20080504192434.GA23752@uranus.ravnborg.org> (raw)
In-Reply-To: <6C8AB345-2DA0-460D-B7C8-262463247DDE@kernel.crashing.org>

On Sun, May 04, 2008 at 01:22:38PM -0500, Kumar Gala wrote:
> Sam,
> 
> We have a case in powerpc in which we want to link some library  
> routines with all module objects.  The routines are intended for  
> handling out-of-line function call register save/restore so having  
> them as EXPORT_SYMBOL() is counter productive (we do also need to link  
> the same "library" code into the kernel).
> 
> Any suggestions on how to handle this?

I assume you have the .o file build somewhere as part of the
normal kernel build.

Then you in
arch/powerpc/Makefile adds the following assignment:

LDFLAGS_MODULE += arch/powerpc/lib/my_magic_file.o

kbuild will then during the modpost stage link this
file on all modules.
To add the same file to the kernel just include it
in a obj-y += my_magic_file.o

One trap is that my_magic_file.o needs to be built
for a modules build too.
I think you need to assign it to always:

   always := my_magic_file.o

to accomplish this.

So in the end we will have:

arch/powerpc/Makefile:
LDFLAGS_MODULE += arch/powerpc/lib/my_magic_file.o

arch/powerpc/lib/Makefile:
always := my_magic_file.o
obj-y += my_magic_file.o


Let me know if this does address your question.

	Sam

WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: lkml List <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@ozlabs.org list" <linuxppc-dev@ozlabs.org>
Subject: Re: How to link a .o with all modules
Date: Sun, 4 May 2008 21:24:34 +0200	[thread overview]
Message-ID: <20080504192434.GA23752@uranus.ravnborg.org> (raw)
In-Reply-To: <6C8AB345-2DA0-460D-B7C8-262463247DDE@kernel.crashing.org>

On Sun, May 04, 2008 at 01:22:38PM -0500, Kumar Gala wrote:
> Sam,
> 
> We have a case in powerpc in which we want to link some library  
> routines with all module objects.  The routines are intended for  
> handling out-of-line function call register save/restore so having  
> them as EXPORT_SYMBOL() is counter productive (we do also need to link  
> the same "library" code into the kernel).
> 
> Any suggestions on how to handle this?

I assume you have the .o file build somewhere as part of the
normal kernel build.

Then you in
arch/powerpc/Makefile adds the following assignment:

LDFLAGS_MODULE += arch/powerpc/lib/my_magic_file.o

kbuild will then during the modpost stage link this
file on all modules.
To add the same file to the kernel just include it
in a obj-y += my_magic_file.o

One trap is that my_magic_file.o needs to be built
for a modules build too.
I think you need to assign it to always:

   always := my_magic_file.o

to accomplish this.

So in the end we will have:

arch/powerpc/Makefile:
LDFLAGS_MODULE += arch/powerpc/lib/my_magic_file.o

arch/powerpc/lib/Makefile:
always := my_magic_file.o
obj-y += my_magic_file.o


Let me know if this does address your question.

	Sam

  reply	other threads:[~2008-05-04 19:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04 18:22 How to link a .o with all modules Kumar Gala
2008-05-04 18:22 ` Kumar Gala
2008-05-04 19:24 ` Sam Ravnborg [this message]
2008-05-04 19:24   ` Sam Ravnborg
2008-05-05 14:46   ` Kumar Gala
2008-05-05 14:46     ` Kumar Gala
2008-05-05 20:44     ` Sam Ravnborg
2008-05-05 20:44       ` Sam Ravnborg
2008-05-08 14:16       ` Kumar Gala
2008-05-08 14:16         ` Kumar Gala
2008-05-08 20:22         ` Sam Ravnborg
2008-05-08 20:22           ` Sam Ravnborg
2008-05-09 13:52           ` Kumar Gala
2008-05-09 13:52             ` Kumar Gala
2008-05-12 15:51             ` Kumar Gala
2008-05-12 15:51               ` Kumar Gala
2008-06-03  4:55           ` Kumar Gala
2008-06-03  4:55             ` Kumar Gala
2008-05-04 23:27 ` H. Peter Anvin
2008-05-04 23:27   ` H. Peter Anvin
2008-05-04 23:38   ` Paul Mackerras
2008-05-04 23:38     ` Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080504192434.GA23752@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=galak@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.