Support build-id.
authorDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 23 Nov 2007 02:08:34 +0000 (02:08 +0000)
committerDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 23 Nov 2007 02:08:34 +0000 (02:08 +0000)
kernel-2.6-planetlab.spec
linux-2.6-020-build-id.patch [new file with mode: 0644]

index 67568d0..977a08c 100644 (file)
@@ -124,6 +124,7 @@ Patch000: ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-%{rpmversion}.bz2
 %endif
 
 Patch010: linux-2.6-010-e1000e.patch
+Patch020: linux-2.6-020-build-id.patch
 
 # These are patches picked up from Fedora/RHEL
 Patch100: linux-2.6-100-build-nonintconfig.patch
@@ -297,6 +298,7 @@ KERNEL_PREVIOUS=vanilla
 %endif
 
 %ApplyPatch 10
+%ApplyPatch 20
 
 %ApplyPatch 100
 
diff --git a/linux-2.6-020-build-id.patch b/linux-2.6-020-build-id.patch
new file mode 100644 (file)
index 0000000..77f75fc
--- /dev/null
@@ -0,0 +1,106 @@
+From: Roland McGrath <roland@redhat.com>
+Date: Thu, 19 Jul 2007 08:48:40 +0000 (-0700)
+Subject: Use --build-id ld option
+X-Git-Tag: v2.6.23-rc1~388
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=18991197b4b588255ccabf472ebc84db7b66a19c
+
+Use --build-id ld option
+
+This change passes the --build-id when linking the kernel and when linking
+modules, if ld supports it.  This is a new GNU ld option that synthesizes an
+ELF note section inside the read-only data.  The note in this section contains
+unique identifying bits called the "build ID", which are generated so as to be
+different for any two linked ELF files that aren't identical.  The build ID
+can be recovered from stripped files, memory dumps, etc.  and used to look up
+the original program built, locate debuginfo or other details or history
+associated with it.  For normal program linking, the compiler passes
+--build-id to ld by default, but the option is needed when using ld directly
+as we do.
+
+Signed-off-by: Roland McGrath <roland@redhat.com>
+Cc: Andi Kleen <ak@suse.de>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Cc: Richard Henderson <rth@twiddle.net>
+Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
+Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+---
+
+diff --git a/Makefile b/Makefile
+index ddbfcac..eccb03b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -514,6 +514,12 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
+ # disable pointer signed / unsigned warnings in gcc 4.0
+ CFLAGS += $(call cc-option,-Wno-pointer-sign,)
++# Use --build-id when available.
++LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
++                            $(call ld-option, -Wl$(comma)--build-id,))
++LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
++LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
++
+ # Default kernel image to build when no specific target is given.
+ # KBUILD_IMAGE may be overruled on the command line or
+ # set in the environment
+
+
+From: Roland McGrath <roland@redhat.com>
+Date: Mon, 23 Jul 2007 08:12:08 +0000 (-0700)
+Subject: kbuild: use LDFLAGS_MODULE only for .ko links
+X-Git-Tag: v2.6.23-rc2~266^2~3
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=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.
+
+Signed-off-by: Roland McGrath <roland@redhat.com>
+Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
+---
+
+diff --git a/Makefile b/Makefile
+index 23f81c9..dfe3d16 100644
+--- a/Makefile
++++ b/Makefile
+@@ -299,7 +299,7 @@ CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(C
+ MODFLAGS      = -DMODULE
+ CFLAGS_MODULE   = $(MODFLAGS)
+ AFLAGS_MODULE   = $(MODFLAGS)
+-LDFLAGS_MODULE  = -r
++LDFLAGS_MODULE  =
+ CFLAGS_KERNEL =
+ AFLAGS_KERNEL =
+diff --git a/scripts/Makefile.build b/scripts/Makefile.build
+index 3f7b451..7fd6055 100644
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -315,7 +315,7 @@ quiet_cmd_link_multi-y = LD      $@
+ cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
+ quiet_cmd_link_multi-m = LD [M]  $@
+-cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
++cmd_link_multi-m = $(cmd_link_multi-y)
+ # We would rather have a list of rules like
+ #     foo.o: $(foo-objs)
+diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
+index 1818c50..d988f5d 100644
+--- a/scripts/Makefile.modpost
++++ b/scripts/Makefile.modpost
+@@ -98,7 +98,7 @@ targets += $(modules:.ko=.mod.o)
+ # Step 6), final link of the modules
+ quiet_cmd_ld_ko_o = LD [M]  $@
+-      cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@          \
++      cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@               \
+                         $(filter-out FORCE,$^)
+ $(modules): %.ko :%.o %.mod.o FORCE