MIPS: genvdso: Remove GOT checks

Our genvdso tool performs some rather paranoid checking that the VDSO
library isn't attempting to make use of a GOT by constraining the number
of entries that the GOT is allowed to contain to the minimum 2 entries
that are always generated by binutils.

Unfortunately lld prior to revision 334390 generates a third entry,
which is unused & thus harmless but falls foul of genvdso's checks &
causes the build to fail.

Since we already check that the VDSO contains no relocations it seems
reasonable to presume that it also doesn't contain use of a GOT, which
would involve relocations. Thus rather than attempting to work around
this issue by allowing 3 GOT entries when using lld, simply remove the
GOT checks which seem overly paranoid.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20152/
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
This commit is contained in:
Paul Burton 2018-08-06 15:24:25 -07:00
parent 7dc084d625
commit 4467f7ad7d
No known key found for this signature in database
GPG Key ID: 3EA79FACB57500DD

View File

@ -15,8 +15,6 @@ static inline bool FUNC(patch_vdso)(const char *path, void *vdso)
ELF(Shdr) *shdr;
char *shstrtab, *name;
uint16_t sh_count, sh_entsize, i;
unsigned int local_gotno, symtabno, gotsym;
ELF(Dyn) *dyn = NULL;
shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff);
sh_count = swap_uint16(ehdr->e_shnum);
@ -41,9 +39,6 @@ static inline bool FUNC(patch_vdso)(const char *path, void *vdso)
"%s: '%s' contains relocation sections\n",
program_name, path);
return false;
case SHT_DYNAMIC:
dyn = vdso + FUNC(swap_uint)(shdr->sh_offset);
break;
}
/* Check for existing sections. */
@ -61,52 +56,6 @@ static inline bool FUNC(patch_vdso)(const char *path, void *vdso)
}
}
/*
* Ensure the GOT has no entries other than the standard 2, for the same
* reason we check that there's no relocation sections above.
* The standard two entries are:
* - Lazy resolver
* - Module pointer
*/
if (dyn) {
local_gotno = symtabno = gotsym = 0;
while (FUNC(swap_uint)(dyn->d_tag) != DT_NULL) {
switch (FUNC(swap_uint)(dyn->d_tag)) {
/*
* This member holds the number of local GOT entries.
*/
case DT_MIPS_LOCAL_GOTNO:
local_gotno = FUNC(swap_uint)(dyn->d_un.d_val);
break;
/*
* This member holds the number of entries in the
* .dynsym section.
*/
case DT_MIPS_SYMTABNO:
symtabno = FUNC(swap_uint)(dyn->d_un.d_val);
break;
/*
* This member holds the index of the first dynamic
* symbol table entry that corresponds to an entry in
* the GOT.
*/
case DT_MIPS_GOTSYM:
gotsym = FUNC(swap_uint)(dyn->d_un.d_val);
break;
}
dyn++;
}
if (local_gotno > 2 || symtabno - gotsym) {
fprintf(stderr,
"%s: '%s' contains unexpected GOT entries\n",
program_name, path);
return false;
}
}
return true;
}