Skip to content

Commit

Permalink
MIPS: genvdso: Remove GOT checks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Paul Burton committed Aug 6, 2018
1 parent 7dc084d commit 4467f7a
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions arch/mips/vdso/genvdso.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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. */
Expand All @@ -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;
}

Expand Down

0 comments on commit 4467f7a

Please sign in to comment.