Commit 3ce2f878 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

vdso: wrap the vDSO ELF identifier and symbol name table definitions into the macro

These variables are architecture-specific so they shouldn't appear
in the upcoming generic version of the routine vdso_fill_symtable().

At first glance it seems it's better to make these variables global
and reference them as external in the generic version of the routine.
However experiments with the vDSO restore routine for AArch64 showed
that the AArch64 compiler uses the GOT to access such variables
rendering our blobs unrelocatable.
Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: 's avatarChristopher Covington <cov@codeaurora.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9b429264
......@@ -25,6 +25,21 @@ enum {
#define VDSO_SYMBOL_TIME_NAME "__vdso_time"
#define DECLARE_VDSO(ident_name, symtab_name) \
\
char ident_name[] = { \
0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
}; \
\
char *symtab_name[VDSO_SYMBOL_MAX] = { \
[VDSO_SYMBOL_GETTIMEOFDAY] = VDSO_SYMBOL_GETTIMEOFDAY_NAME, \
[VDSO_SYMBOL_GETCPU] = VDSO_SYMBOL_GETCPU_NAME, \
[VDSO_SYMBOL_CLOCK_GETTIME] = VDSO_SYMBOL_CLOCK_GETTIME_NAME, \
[VDSO_SYMBOL_TIME] = VDSO_SYMBOL_TIME_NAME, \
};
struct vdso_symtable;
struct parasite_ctl;
struct vm_area_list;
......
......@@ -91,21 +91,7 @@ int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t)
unsigned long base = VDSO_BAD_ADDR;
unsigned int i, j, k;
/*
* Elf header bytes. For detailed
* description see Elf specification.
*/
char vdso_ident[] = {
0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
char *vdso_symbols[VDSO_SYMBOL_MAX] = {
[VDSO_SYMBOL_GETTIMEOFDAY] = VDSO_SYMBOL_GETTIMEOFDAY_NAME,
[VDSO_SYMBOL_GETCPU] = VDSO_SYMBOL_GETCPU_NAME,
[VDSO_SYMBOL_CLOCK_GETTIME] = VDSO_SYMBOL_CLOCK_GETTIME_NAME,
[VDSO_SYMBOL_TIME] = VDSO_SYMBOL_TIME_NAME,
};
DECLARE_VDSO(vdso_ident, vdso_symbols);
BUILD_BUG_ON(sizeof(vdso_ident) != sizeof(ehdr->e_ident));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment