68d0d67
Bugzilla: N/A
68d0d67
Upstream-status: ??
68d0d67
Josh Boyer be64ba5
From b707aea6a4947c3806ced2c23e889943a0f36876 Mon Sep 17 00:00:00 2001
Kyle McMartin ed27f0b
From: Roland McGrath <roland@redhat.com>
Kyle McMartin f89b4ff
Date: Mon, 6 Oct 2008 23:03:03 -0700
Kyle McMartin f89b4ff
Subject: [PATCH] kbuild: AFTER_LINK
Kyle McMartin ed27f0b
Kyle McMartin f89b4ff
If the make variable AFTER_LINK is set, it is a command line to run
Kyle McMartin f89b4ff
after each final link.  This includes vmlinux itself and vDSO images.
Kyle McMartin f89b4ff
Kyle McMartin f89b4ff
Signed-off-by: Roland McGrath <roland@redhat.com>
Josh Boyer be64ba5
3b5c960
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
3b5c960
index d8064af..04dcfe1 100644
3b5c960
--- a/arch/arm64/kernel/vdso/Makefile
3b5c960
+++ b/arch/arm64/kernel/vdso/Makefile
3b5c960
@@ -48,7 +48,8 @@ $(obj-vdso): %.o: %.S
3b5c960
 
3b5c960
 # Actual build commands
3b5c960
 quiet_cmd_vdsold = VDSOL $@
3b5c960
-      cmd_vdsold = $(CC) $(c_flags) -Wl,-T $^ -o $@
3b5c960
+      cmd_vdsold = $(CC) $(c_flags) -Wl,-T $^ -o $@ \
3b5c960
+			$(if $(AFTER_LINK),; $(AFTER_LINK))
3b5c960
 quiet_cmd_vdsoas = VDSOA $@
3b5c960
       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
3b5c960
 
Jesse Keating 7a32965
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
3b5c960
index 53e6c9b..e427844 100644
Jesse Keating 7a32965
--- a/arch/powerpc/kernel/vdso32/Makefile
Jesse Keating 7a32965
+++ b/arch/powerpc/kernel/vdso32/Makefile
3b5c960
@@ -43,7 +43,8 @@ $(obj-vdso32): %.o: %.S
Jesse Keating 7a32965
 
Jesse Keating 7a32965
 # actual build commands
Jesse Keating 7a32965
 quiet_cmd_vdso32ld = VDSO32L $@
Jesse Keating 7a32965
-      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@
Jesse Keating 7a32965
+      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@ \
Jesse Keating 7a32965
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
Jesse Keating 7a32965
 quiet_cmd_vdso32as = VDSO32A $@
Jesse Keating 7a32965
       cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
Jesse Keating 7a32965
 
Jesse Keating 7a32965
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
3b5c960
index effca94..713891a 100644
Jesse Keating 7a32965
--- a/arch/powerpc/kernel/vdso64/Makefile
Jesse Keating 7a32965
+++ b/arch/powerpc/kernel/vdso64/Makefile
Jesse Keating 7a32965
@@ -36,7 +36,8 @@ $(obj-vdso64): %.o: %.S
Jesse Keating 7a32965
 
Jesse Keating 7a32965
 # actual build commands
Jesse Keating 7a32965
 quiet_cmd_vdso64ld = VDSO64L $@
Jesse Keating 7a32965
-      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
Jesse Keating 7a32965
+      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \
Jesse Keating 7a32965
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
Jesse Keating 7a32965
 quiet_cmd_vdso64as = VDSO64A $@
Jesse Keating 7a32965
       cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
Jesse Keating 7a32965
 
Kyle McMartin 9e0d2f6
diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
Josh Boyer be64ba5
index 8ad2b34..e153572 100644
Kyle McMartin 9e0d2f6
--- a/arch/s390/kernel/vdso32/Makefile
Kyle McMartin 9e0d2f6
+++ b/arch/s390/kernel/vdso32/Makefile
Josh Boyer be64ba5
@@ -43,7 +43,8 @@ $(obj-vdso32): %.o: %.S
Kyle McMartin 9e0d2f6
 
Kyle McMartin 9e0d2f6
 # actual build commands
Kyle McMartin 9e0d2f6
 quiet_cmd_vdso32ld = VDSO32L $@
Kyle McMartin 9e0d2f6
-      cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
Kyle McMartin 9e0d2f6
+      cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \
Kyle McMartin 9e0d2f6
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
Kyle McMartin 9e0d2f6
 quiet_cmd_vdso32as = VDSO32A $@
Kyle McMartin 9e0d2f6
       cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
Kyle McMartin 9e0d2f6
 
Kyle McMartin 9e0d2f6
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
Josh Boyer be64ba5
index 2a8ddfd..452ca53 100644
Kyle McMartin 9e0d2f6
--- a/arch/s390/kernel/vdso64/Makefile
Kyle McMartin 9e0d2f6
+++ b/arch/s390/kernel/vdso64/Makefile
Josh Boyer be64ba5
@@ -43,7 +43,8 @@ $(obj-vdso64): %.o: %.S
Kyle McMartin 9e0d2f6
 
Kyle McMartin 9e0d2f6
 # actual build commands
Kyle McMartin 9e0d2f6
 quiet_cmd_vdso64ld = VDSO64L $@
Kyle McMartin 9e0d2f6
-      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
Kyle McMartin 9e0d2f6
+      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ \
Kyle McMartin 9e0d2f6
+		     $(if $(AFTER_LINK),; $(AFTER_LINK))
Kyle McMartin 9e0d2f6
 quiet_cmd_vdso64as = VDSO64A $@
Kyle McMartin 9e0d2f6
       cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
Kyle McMartin 9e0d2f6
 
Josh Boyer be64ba5
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
Josh Boyer be64ba5
index fd14be1..1f3eb19 100644
Josh Boyer be64ba5
--- a/arch/x86/vdso/Makefile
Josh Boyer be64ba5
+++ b/arch/x86/vdso/Makefile
Josh Boyer be64ba5
@@ -178,8 +178,9 @@ $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
Josh Boyer be64ba5
 quiet_cmd_vdso = VDSO    $@
Josh Boyer be64ba5
       cmd_vdso = $(CC) -nostdlib -o $@ \
Josh Boyer be64ba5
 		       $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
Josh Boyer be64ba5
-		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
Josh Boyer be64ba5
-		 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
Josh Boyer be64ba5
+		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) \
Josh Boyer be64ba5
+		$(if $(AFTER_LINK),; $(AFTER_LINK)) && \
Josh Boyer be64ba5
+		sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
Josh Boyer be64ba5
 
Josh Boyer be64ba5
 VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
Josh Boyer be64ba5
 GCOV_PROFILE := n
Josh Boyer be64ba5
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
3b5c960
index 0149949..e307cda 100644
Josh Boyer be64ba5
--- a/scripts/link-vmlinux.sh
Josh Boyer be64ba5
+++ b/scripts/link-vmlinux.sh
Josh Boyer be64ba5
@@ -65,6 +65,10 @@ vmlinux_link()
Josh Boyer be64ba5
 			-lutil ${1}
Josh Boyer be64ba5
 		rm -f linux
Josh Boyer be64ba5
 	fi
Josh Boyer be64ba5
+	if [ -n "${AFTER_LINK}" ]; then
Josh Boyer be64ba5
+		/usr/lib/rpm/debugedit -b ${RPM_BUILD_DIR} -d /usr/src/debug -i ${2} \
Josh Boyer be64ba5
+			> ${2}.id
Josh Boyer be64ba5
+	fi
Josh Boyer be64ba5
 }
Josh Boyer be64ba5
 
Josh Boyer be64ba5