public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Henry Nestler <Henry.Ne@Arcor.de>
To: linux-kernel@vger.kernel.org
Cc: Roland McGrath <roland@redhat.com>, Sam Ravnborg <sam@ravnborg.org>
Subject: kbuild: LDFLAGS_MODULE unusable for external module builds (2.6.23-rc2)
Date: Tue, 25 Sep 2007 11:49:44 +0200	[thread overview]
Message-ID: <46F8D9B8.3090806@Arcor.de> (raw)

In reference of git 114f51577724b782a30f4f5ceaee9880de93d776:
>     kbuild: use LDFLAGS_MODULE only for .ko links
>     
>     Sam Ravnborg pointed out that Documentation/kbuild/makefiles.txt already
>     says this is what it's for.  This patch makes the reality live up to the
>     documentation.  This fixes the problem of LDFLAGS_BUILD_ID getting into too
>     many places.

LDFLAGS_MODULE is not usable in module build out of kernel tree since
2.6.23-rc2. LDFLAGS_$@ should use, but does never work. - Not for
external module builds with the option "M=..."

What macro should set for linker parameters of foo.o ? I'm not shure.
Currently found, that only LDFLAGS is usable. But, found LDFLAGS in
modpost calls, there also exist a --start-group/--end-group. Is it right
to use it for external module?

Here examples and the outputs. Host and target is an i686 SMP Linux.

mkdir /tmp/test; cd /tmp/test
cat >Makefile <<EOF
obj-m := name.o
name-objs := foo.o
# Use multipe defines, hope any would work
LDFLAGS_MODULE += --start-group
LDFLAGS_name += --start-group
LDFLAGS_name.o += --start-group
EOF

cat >foo.c <<EOF
#include <linux/module.h>
#include <linux/init.h>
int init_module(void) {return 0;}
void cleanup_module(void) {return;}
EOF

#2.6.22 works. LDFLAGS_MODULE was used:
make V=1 -C src/linux-2.6.22 M=$PWD | grep " ld "
  ld -m elf_i386 -m elf_i386  -r --start-group -o /tmp/name.o /tmp/foo.o
  ld -m elf_i386 -m elf_i386 -r -o /tmp/name.ko /tmp/name.o /tmp/name.mod.o

#2.6.23-rc7 does not work. Nothing from LDFLAGS can seen in linker line:
make V=1 -C src/linux-2.6.23-rc7 M=$PWD | grep " ld "
  ld -m elf_i386 -m elf_i386  -r -o /tmp/name.o /tmp/foo.o
  ld -m elf_i386 -r -m elf_i386   -o /tmp/name.ko /tmp/name.o
/tmp/name.mod.o

------
Perhaps anybody can give better idea for Makefile with
recursive depens of libraries? What I'm missing, is a setup for
--start-group AND the --end-group arrount the lib.a files. Currently 
--start-groups is somether before the first object and has no --end-group.

obj-y := dir1/ dir2/ dir3/
obj-m := name.ko
name-objs = foo.o dir1/lib.a dir2/lib.a dir3/lib.a
LDFLAGS += --start-group # Deal with recursive depens of libraries

-- 
Henry

             reply	other threads:[~2007-09-25  9:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25  9:49 Henry Nestler [this message]
2007-09-25 19:22 ` kbuild: LDFLAGS_MODULE unusable for external module builds (2.6.23-rc2) Sam Ravnborg
2007-09-26  9:56   ` Henry Nestler
2007-09-26 11:01     ` Sam Ravnborg
2007-09-26 11:31       ` Henry Nestler
2007-09-27  8:21         ` Henry Nestler
2007-09-27  8:26           ` Sam Ravnborg

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=46F8D9B8.3090806@Arcor.de \
    --to=henry.ne@arcor.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=sam@ravnborg.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox