jianhai / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
f2c60e
From 649d991ca7737dd227f2a1ca4f30247daf6a7b4b Mon Sep 17 00:00:00 2001
f2c60e
From: Roland McGrath <roland@redhat.com>
f2c60e
Date: Mon, 6 Oct 2008 23:03:03 -0700
f2c60e
Subject: [PATCH] kbuild: AFTER_LINK
f2c60e
f2c60e
If the make variable AFTER_LINK is set, it is a command line to run
f2c60e
after each final link.  This includes vmlinux itself and vDSO images.
f2c60e
f2c60e
Bugzilla: N/A
f2c60e
Upstream-status: ??
f2c60e
f2c60e
Signed-off-by: Roland McGrath <roland@redhat.com>
f2c60e
---
f2c60e
 arch/arm64/kernel/vdso/Makefile     | 3 ++-
f2c60e
 arch/powerpc/kernel/vdso32/Makefile | 3 ++-
f2c60e
 arch/powerpc/kernel/vdso64/Makefile | 3 ++-
f2c60e
 arch/s390/kernel/vdso32/Makefile    | 3 ++-
f2c60e
 arch/s390/kernel/vdso64/Makefile    | 3 ++-
f2c60e
 arch/x86/entry/vdso/Makefile        | 5 +++--
f2c60e
 scripts/link-vmlinux.sh             | 4 ++++
f2c60e
 7 files changed, 17 insertions(+), 7 deletions(-)
f2c60e
f2c60e
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
f2c60e
index 62c84f7..f44236a 100644
f2c60e
--- a/arch/arm64/kernel/vdso/Makefile
f2c60e
+++ b/arch/arm64/kernel/vdso/Makefile
f2c60e
@@ -54,7 +54,8 @@ $(obj-vdso): %.o: %.S FORCE
f2c60e
 
f2c60e
 # Actual build commands
f2c60e
 quiet_cmd_vdsold = VDSOL   $@
f2c60e
-      cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
f2c60e
+      cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@ \
f2c60e
+				    $(if $(AFTER_LINK),;$(AFTER_LINK))
f2c60e
 quiet_cmd_vdsoas = VDSOA   $@
f2c60e
       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
f2c60e
 
f2c60e
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
f2c60e
index 78a7449..c9592c0 100644
f2c60e
--- a/arch/powerpc/kernel/vdso32/Makefile
f2c60e
+++ b/arch/powerpc/kernel/vdso32/Makefile
f2c60e
@@ -44,7 +44,8 @@ $(obj-vdso32): %.o: %.S FORCE
f2c60e
 
f2c60e
 # actual build commands
f2c60e
 quiet_cmd_vdso32ld = VDSO32L $@
f2c60e
-      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
f2c60e
+      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) \
f2c60e
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
f2c60e
 quiet_cmd_vdso32as = VDSO32A $@
f2c60e
       cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
f2c60e
 
f2c60e
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
f2c60e
index 31107bf..96aded3 100644
f2c60e
--- a/arch/powerpc/kernel/vdso64/Makefile
f2c60e
+++ b/arch/powerpc/kernel/vdso64/Makefile
f2c60e
@@ -33,7 +33,8 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
f2c60e
 
f2c60e
 # actual build commands
f2c60e
 quiet_cmd_vdso64ld = VDSO64L $@
f2c60e
-      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
f2c60e
+      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) \
f2c60e
+		    $(if $(AFTER_LINK),; $(AFTER_LINK))
f2c60e
 
f2c60e
 # install commands for the unstripped file
f2c60e
 quiet_cmd_vdso_install = INSTALL $@
f2c60e
diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
f2c60e
index 6cc9478..94fb536 100644
f2c60e
--- a/arch/s390/kernel/vdso32/Makefile
f2c60e
+++ b/arch/s390/kernel/vdso32/Makefile
f2c60e
@@ -47,7 +47,8 @@ $(obj-vdso32): %.o: %.S
f2c60e
 
f2c60e
 # actual build commands
f2c60e
 quiet_cmd_vdso32ld = VDSO32L $@
f2c60e
-      cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
f2c60e
+      cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ \
f2c60e
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
f2c60e
 quiet_cmd_vdso32as = VDSO32A $@
f2c60e
       cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
f2c60e
 
f2c60e
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
f2c60e
index 2d54c18..a0e3e9d 100644
f2c60e
--- a/arch/s390/kernel/vdso64/Makefile
f2c60e
+++ b/arch/s390/kernel/vdso64/Makefile
f2c60e
@@ -47,7 +47,8 @@ $(obj-vdso64): %.o: %.S
f2c60e
 
f2c60e
 # actual build commands
f2c60e
 quiet_cmd_vdso64ld = VDSO64L $@
f2c60e
-      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
f2c60e
+      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ \
f2c60e
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
f2c60e
 quiet_cmd_vdso64as = VDSO64A $@
f2c60e
       cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
f2c60e
 
f2c60e
diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
f2c60e
index d540966..eeb47b6 100644
f2c60e
--- a/arch/x86/entry/vdso/Makefile
f2c60e
+++ b/arch/x86/entry/vdso/Makefile
f2c60e
@@ -167,8 +167,9 @@ $(obj)/vdso32.so.dbg: FORCE \
f2c60e
 quiet_cmd_vdso = VDSO    $@
f2c60e
       cmd_vdso = $(CC) -nostdlib -o $@ \
f2c60e
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
f2c60e
-		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
f2c60e
-		 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
f2c60e
+		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) \
f2c60e
+		$(if $(AFTER_LINK),; $(AFTER_LINK)) && \
f2c60e
+		sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
f2c60e
 
f2c60e
 VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
f2c60e
 	$(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
f2c60e
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
f2c60e
index f742c65..526eee4 100755
f2c60e
--- a/scripts/link-vmlinux.sh
f2c60e
+++ b/scripts/link-vmlinux.sh
f2c60e
@@ -111,6 +111,10 @@ vmlinux_link()
f2c60e
 			-lutil -lrt -lpthread
f2c60e
 		rm -f linux
f2c60e
 	fi
f2c60e
+	if [ -n "${AFTER_LINK}" ]; then
f2c60e
+		/usr/lib/rpm/debugedit -b ${RPM_BUILD_DIR} -d /usr/src/debug -i ${2} \
f2c60e
+			> ${2}.id
f2c60e
+	fi
f2c60e
 }
f2c60e
 
f2c60e
 
f2c60e
-- 
f2c60e
2.7.4
f2c60e