From: Jeff Dike <jdike@karaya.com>
To: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Cc: linux-kernel@vger.kernel.org, kbuild-devel@lists.sourceforge.net
Subject: UML kbuild patch
Date: Mon, 23 Sep 2002 20:09:03 -0500 [thread overview]
Message-ID: <200209240109.UAA05448@ccure.karaya.com> (raw)
The UML build needs a few kbuild changes in order to work with the latest
stuff.
Since kbuild now enforces the use of the linker script on the vmlinux build,
UML can't use its old two-stage link, where
vmlinux is a normal relocatable object file
which is linked into the linux binary with the linker script
So, in order to fold those into one stage and produce an ELF binary, I need
the vmlinux "linker" to actually be gcc. This implies I need a
"-Wl,-T,arch/$(ARCH)/vmlinux.lds.s" instead of the usual
"-T arch/$(ARCH)/vmlinux.lds.s".
This is done without breaking the other arches by changing the final link
command to $(LD_vmlinux) which is defaulted to $(LD) if the arch doesn't
define it.
The "-Wl,..." is done similarly by using $(LDFLAGS_vmlinux_default) if
the linker command is anything but gcc and $(LDFLAGS_vmlinux_gcc) if it is
gcc.
The one caveat is that I removed $(LDFLAGS) from the link line - you might
want to add it back.
You can pull bk://jdike.stearns.org/kbuild-2.5. The patch is also appended.
Jeff
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.600 -> 1.602
# Makefile 1.305 -> 1.307
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/23 jdike@uml.karaya.com 1.601
# Fixes to allow UML to build with the new vmlinux rules.
# --------------------------------------------
# 02/09/23 jdike@uml.karaya.com 1.602
# Made the UML Makefile changes work for the other arches.
# --------------------------------------------
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile Mon Sep 23 19:50:33 2002
+++ b/Makefile Mon Sep 23 19:50:33 2002
@@ -288,10 +288,12 @@
# we cannot yet know if we will need to relink vmlinux.
# So we descend into init/ inside the rule for vmlinux again.
+LD_vmlinux := $(if $(LD_vmlinux),$(LD_vmlinux),$(LD))
+
vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)
quiet_cmd_link_vmlinux = LD $@
-cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
+cmd_link_vmlinux = $(LD_vmlinux) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
--start-group \
$(CORE_FILES) \
$(LIBS) \
@@ -313,7 +315,11 @@
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
-LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
+LDFLAGS_vmlinux_default = -T arch/$(ARCH)/vmlinux.lds.s
+LDFLAGS_vmlinux_gcc = -Wl,-T,arch/$(ARCH)/vmlinux.lds.s
+
+vmlinux_base = $(basename $(notdir $(LD_vmlinux)))
+LDFLAGS_vmlinux += $(if $(LDFLAGS_vmlinux_$(vmlinux_base)),$(LDFLAGS_vmlinux_$(vmlinux_base)),$(LDFLAGS_vmlinux_default))
vmlinux: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
$(call if_changed_rule,link_vmlinux)
next reply other threads:[~2002-09-23 23:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-24 1:09 Jeff Dike [this message]
2002-09-24 0:24 ` UML kbuild patch Kai Germaschewski
2002-09-24 2:34 ` Jeff Dike
2002-09-24 12:16 ` Oleg Drokin
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=200209240109.UAA05448@ccure.karaya.com \
--to=jdike@karaya.com \
--cc=kai@tp1.ruhr-uni-bochum.de \
--cc=kbuild-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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