x86-64, vdso: Fix vDSO build breakage due to empty .rela.dyn
[jlayton/linux.git] / arch / x86 / vdso / vdso2c.h
index df95a2fdff7319821a8c68a905ece1a1be98517b..11b65d4f94140d3523484c714a3735e6d2f718ed 100644 (file)
@@ -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");