[tip:x86/urgent] x86-64, vdso: Fix vDSO build breakage due to empty .rela.dyn

From: tip-bot for Jan Beulich
Date: Thu Jul 10 2014 - 19:04:44 EST

Commit-ID: 9f88b906b4455465d60ac18b8c95904f320038d5
Gitweb: http://git.kernel.org/tip/9f88b906b4455465d60ac18b8c95904f320038d5
Author: Jan Beulich <JBeulich@xxxxxxxx>
AuthorDate: Thu, 3 Jul 2014 15:34:38 +0100
Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
CommitDate: Thu, 10 Jul 2014 15:59:56 -0700

x86-64, vdso: Fix vDSO build breakage due to empty .rela.dyn

Certain ld versions (observed with 2.20.0) put an empty .rela.dyn
section into shared object files, breaking the assumption on the number
of sections to be copied to the final output. Simply discard any empty
SHT_REL and SHT_RELA sections to address this.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Link: http://lkml.kernel.org/r/53B5861E02000078000204D1@xxxxxxxxxxxxxxxxxxxx
Acked-by: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
Tested-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Tested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
arch/x86/vdso/vdso2c.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h
index df95a2f..11b65d4 100644
--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -93,6 +93,9 @@ static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out,
uint64_t flags = GET_LE(&in->sh_flags);

bool copy = flags & SHF_ALLOC &&
+ (GET_LE(&in->sh_size) ||
+ (GET_LE(&in->sh_type) != SHT_RELA &&
+ GET_LE(&in->sh_type) != SHT_REL)) &&
strcmp(name, ".altinstructions") &&
strcmp(name, ".altinstr_replacement");

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/