[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080504192434.GA23752@uranus.ravnborg.org>
Date: Sun, 4 May 2008 21:24:34 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Kumar Gala <galak@...nel.crashing.org>
Cc: lkml List <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...abs.org list" <linuxppc-dev@...abs.org>
Subject: Re: How to link a .o with all modules
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists