All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.5 kbuild: use of '-z muldefs' for LD?
@ 2003-06-09 11:56 ` Jaroslav Kysela
  0 siblings, 0 replies; 10+ messages in thread
From: Jaroslav Kysela @ 2003-06-09 11:56 UTC (permalink / raw)
  To: LKML; +Cc: ALSA development, kbuild-devel

Hello all,

	I am trying to figure the best solution for our problem. We reuse
one object file for more targets. Example:

------
snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o

# Toplevel Module Dependency
obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
------

The ak4xxx.o module is shared and has defined a few public functions.
Unfortunately, the default build-in.o rule fails when targets are 
requested to be included into the solid kernel because the public 
functions are duplicated in snd-ice1712.o and snd-ice17124.o.

I can instruct the ld compiler to ignore the multiple definitions using 
'-z muldefs':

EXTRA_LDFLAGS = -z muldefs

But it seems like a hack for me.
Does anybody have another idea to solve my problem?

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


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

* 2.5 kbuild: use of '-z muldefs' for LD?
@ 2003-06-09 11:56 ` Jaroslav Kysela
  0 siblings, 0 replies; 10+ messages in thread
From: Jaroslav Kysela @ 2003-06-09 11:56 UTC (permalink / raw)
  To: LKML; +Cc: ALSA development, kbuild-devel

Hello all,

	I am trying to figure the best solution for our problem. We reuse
one object file for more targets. Example:

------
snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o

# Toplevel Module Dependency
obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
------

The ak4xxx.o module is shared and has defined a few public functions.
Unfortunately, the default build-in.o rule fails when targets are 
requested to be included into the solid kernel because the public 
functions are duplicated in snd-ice1712.o and snd-ice17124.o.

I can instruct the ld compiler to ignore the multiple definitions using 
'-z muldefs':

EXTRA_LDFLAGS = -z muldefs

But it seems like a hack for me.
Does anybody have another idea to solve my problem?

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 11:56 ` Jaroslav Kysela
  (?)
@ 2003-06-09 12:04 ` Christoph Hellwig
  2003-06-09 14:01     ` Jaroslav Kysela
                     ` (2 more replies)
  -1 siblings, 3 replies; 10+ messages in thread
From: Christoph Hellwig @ 2003-06-09 12:04 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: LKML, ALSA development, kbuild-devel

On Mon, Jun 09, 2003 at 01:56:59PM +0200, Jaroslav Kysela wrote:
> one object file for more targets. Example:
> 
> ------
> snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
> snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o
> 
> # Toplevel Module Dependency
> obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
> obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
> ------
> 
> The ak4xxx.o module is shared and has defined a few public functions.
> Unfortunately, the default build-in.o rule fails when targets are 
> requested to be included into the solid kernel because the public 
> functions are duplicated in snd-ice1712.o and snd-ice17124.o.
> 
> I can instruct the ld compiler to ignore the multiple definitions using 
> '-z muldefs':
> 
> EXTRA_LDFLAGS = -z muldefs
> 
> But it seems like a hack for me.
> Does anybody have another idea to solve my problem?

Move ak4xxx.o out of the multi-obj rules.  Just declare a new helper-
config option CONFIG_SND_AK4XXX that gets defined by all drivers
using it and add

obj-$(CONFIG_SND_AK4XXX)	+= ak4xxx.o

You'll just have to make sure to export all symbols in 2.5

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 11:56 ` Jaroslav Kysela
  (?)
  (?)
@ 2003-06-09 12:08 ` Christoph Hellwig
  -1 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2003-06-09 12:08 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: LKML, kbuild-devel

*grr*

Can you _please_ stop the stupid practice of Cc'ing members-only
lists?  Thanks.


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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 12:04 ` Christoph Hellwig
@ 2003-06-09 14:01     ` Jaroslav Kysela
  2003-06-09 19:45   ` Sam Ravnborg
  2003-06-09 20:15   ` Kai Germaschewski
  2 siblings, 0 replies; 10+ messages in thread
From: Jaroslav Kysela @ 2003-06-09 14:01 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: LKML, ALSA development, kbuild-devel

On Mon, 9 Jun 2003, Christoph Hellwig wrote:

> On Mon, Jun 09, 2003 at 01:56:59PM +0200, Jaroslav Kysela wrote:
> > one object file for more targets. Example:
> > 
> > ------
> > snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
> > snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o
> > 
> > # Toplevel Module Dependency
> > obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
> > obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
> > ------
> > 
> > The ak4xxx.o module is shared and has defined a few public functions.
> > Unfortunately, the default build-in.o rule fails when targets are 
> > requested to be included into the solid kernel because the public 
> > functions are duplicated in snd-ice1712.o and snd-ice17124.o.
> > 
> > I can instruct the ld compiler to ignore the multiple definitions using 
> > '-z muldefs':
> > 
> > EXTRA_LDFLAGS = -z muldefs
> > 
> > But it seems like a hack for me.
> > Does anybody have another idea to solve my problem?
> 
> Move ak4xxx.o out of the multi-obj rules.  Just declare a new helper-
> config option CONFIG_SND_AK4XXX that gets defined by all drivers
> using it and add
> 
> obj-$(CONFIG_SND_AK4XXX)	+= ak4xxx.o
> 
> You'll just have to make sure to export all symbols in 2.5

But this solution will create a new kernel module. The shared code is 
really small and having small codes in separated modules is waste of 
memory in my eyes.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
@ 2003-06-09 14:01     ` Jaroslav Kysela
  0 siblings, 0 replies; 10+ messages in thread
From: Jaroslav Kysela @ 2003-06-09 14:01 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: LKML, ALSA development, kbuild-devel

On Mon, 9 Jun 2003, Christoph Hellwig wrote:

> On Mon, Jun 09, 2003 at 01:56:59PM +0200, Jaroslav Kysela wrote:
> > one object file for more targets. Example:
> > 
> > ------
> > snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
> > snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o
> > 
> > # Toplevel Module Dependency
> > obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
> > obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
> > ------
> > 
> > The ak4xxx.o module is shared and has defined a few public functions.
> > Unfortunately, the default build-in.o rule fails when targets are 
> > requested to be included into the solid kernel because the public 
> > functions are duplicated in snd-ice1712.o and snd-ice17124.o.
> > 
> > I can instruct the ld compiler to ignore the multiple definitions using 
> > '-z muldefs':
> > 
> > EXTRA_LDFLAGS = -z muldefs
> > 
> > But it seems like a hack for me.
> > Does anybody have another idea to solve my problem?
> 
> Move ak4xxx.o out of the multi-obj rules.  Just declare a new helper-
> config option CONFIG_SND_AK4XXX that gets defined by all drivers
> using it and add
> 
> obj-$(CONFIG_SND_AK4XXX)	+= ak4xxx.o
> 
> You'll just have to make sure to export all symbols in 2.5

But this solution will create a new kernel module. The shared code is 
really small and having small codes in separated modules is waste of 
memory in my eyes.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 14:01     ` Jaroslav Kysela
  (?)
@ 2003-06-09 14:19     ` Christoph Hellwig
  2003-06-09 14:29       ` Peter Samuelson
  -1 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2003-06-09 14:19 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: LKML, ALSA development, kbuild-devel

On Mon, Jun 09, 2003 at 04:01:41PM +0200, Jaroslav Kysela wrote:
> But this solution will create a new kernel module. The shared code is 
> really small and having small codes in separated modules is waste of 
> memory in my eyes.

Well, if you want separate copies of it you have to make sure the
symbols won't clash, e.g. calling all functions in it

MYPREFIX_foo

and then do #define MYPREFIX	KBUILD_MODNAME

or something like that

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 14:19     ` Christoph Hellwig
@ 2003-06-09 14:29       ` Peter Samuelson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Samuelson @ 2003-06-09 14:29 UTC (permalink / raw)
  To: Christoph Hellwig, Jaroslav Kysela, LKML, kbuild-devel


[Christoph Hellwig]
> Well, if you want separate copies of it you have to make sure the
> symbols won't clash, e.g. calling all functions in it
> 
> MYPREFIX_foo
> 
> and then do #define MYPREFIX	KBUILD_MODNAME

...or just move everything into a header file as static functions.
Inline, even, if the code is really trivial enough that you don't want
to make a separate module of it.

Peter

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 12:04 ` Christoph Hellwig
  2003-06-09 14:01     ` Jaroslav Kysela
@ 2003-06-09 19:45   ` Sam Ravnborg
  2003-06-09 20:15   ` Kai Germaschewski
  2 siblings, 0 replies; 10+ messages in thread
From: Sam Ravnborg @ 2003-06-09 19:45 UTC (permalink / raw)
  To: Christoph Hellwig, Jaroslav Kysela, LKML, ALSA development,
	kbuild-devel, Kai Germaschewski

On Mon, Jun 09, 2003 at 01:04:38PM +0100, Christoph Hellwig wrote:
> On Mon, Jun 09, 2003 at 01:56:59PM +0200, Jaroslav Kysela wrote:
> > one object file for more targets. Example:
> > 
> > ------
> > snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
> > snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o
> > 
> > # Toplevel Module Dependency
> > obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
> > obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
> > ------
> > 
> > The ak4xxx.o module is shared and has defined a few public functions.
> > Unfortunately, the default build-in.o rule fails when targets are 
> > requested to be included into the solid kernel because the public 
> > functions are duplicated in snd-ice1712.o and snd-ice17124.o.
> > 
> > I can instruct the ld compiler to ignore the multiple definitions using 
> > '-z muldefs':
> > 
> > EXTRA_LDFLAGS = -z muldefs
> > 
> > But it seems like a hack for me.
> > Does anybody have another idea to solve my problem?
> 
> Move ak4xxx.o out of the multi-obj rules.  Just declare a new helper-
> config option CONFIG_SND_AK4XXX that gets defined by all drivers
> using it and add
> 
> obj-$(CONFIG_SND_AK4XXX)	+= ak4xxx.o

Would it be worthwhile to resolve common functions from a library instead?
On request from Linus I made the lib-y change, and it is getting
a lot easier to create libraries.
So ak4xxx.o would be used to create lib.a in that particular directory.

A limitation would be that libaries would only be valid for current
directory - but that is OK for this situation.

On the other hand there should be very good reasons to clutter up the
build-system with this, so more users than sound is required.

Comments?
[Will there be problems with modules exporting symbols?]

	Sam

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

* Re: 2.5 kbuild: use of '-z muldefs' for LD?
  2003-06-09 12:04 ` Christoph Hellwig
  2003-06-09 14:01     ` Jaroslav Kysela
  2003-06-09 19:45   ` Sam Ravnborg
@ 2003-06-09 20:15   ` Kai Germaschewski
  2 siblings, 0 replies; 10+ messages in thread
From: Kai Germaschewski @ 2003-06-09 20:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jaroslav Kysela, LKML, ALSA development, kbuild-devel

On Mon, 9 Jun 2003, Christoph Hellwig wrote:

> On Mon, Jun 09, 2003 at 01:56:59PM +0200, Jaroslav Kysela wrote:
> > one object file for more targets. Example:
> > 
> > ------
> > snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o ak4xxx.o
> > snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o ak4xxx.o
> > 
> > # Toplevel Module Dependency
> > obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o
> > obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o
> > ------
> > 
> > The ak4xxx.o module is shared and has defined a few public functions.
> > Unfortunately, the default build-in.o rule fails when targets are 
> > requested to be included into the solid kernel because the public 
> > functions are duplicated in snd-ice1712.o and snd-ice17124.o.
> > 
> > I can instruct the ld compiler to ignore the multiple definitions using 
> > '-z muldefs':
> > 
> > EXTRA_LDFLAGS = -z muldefs
> > 
> > But it seems like a hack for me.
> > Does anybody have another idea to solve my problem?
> 
> Move ak4xxx.o out of the multi-obj rules.  Just declare a new helper-
> config option CONFIG_SND_AK4XXX that gets defined by all drivers
> using it and add
> 
> obj-$(CONFIG_SND_AK4XXX)	+= ak4xxx.o

I basically second this, though you don't even need a new config variable.

	snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o
	snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o

	# Toplevel Module Dependency
	obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o ak4xxx.o
	obj-$(CONFIG_SND_ICE1724) += snd-ice1724.o ak4xxx.o

If you think the functions are too trivial to justify a module of their
own, you may want to consider to put them as static inline into a header
file, as someone else suggested.

--Kai




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

end of thread, other threads:[~2003-06-09 20:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-09 11:56 2.5 kbuild: use of '-z muldefs' for LD? Jaroslav Kysela
2003-06-09 11:56 ` Jaroslav Kysela
2003-06-09 12:04 ` Christoph Hellwig
2003-06-09 14:01   ` Jaroslav Kysela
2003-06-09 14:01     ` Jaroslav Kysela
2003-06-09 14:19     ` Christoph Hellwig
2003-06-09 14:29       ` Peter Samuelson
2003-06-09 19:45   ` Sam Ravnborg
2003-06-09 20:15   ` Kai Germaschewski
2003-06-09 12:08 ` Christoph Hellwig

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.