mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 05:43:47 +08:00
linux-user/arm: Select vdso for be8 and be32 modes
In be8 mode, instructions are little-endian.
In be32 mode, instructions are big-endian.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2333
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 95c9e2209c
)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
33afee2f2f
commit
a9a949b270
@ -3,15 +3,18 @@ include $(BUILD_DIR)/tests/tcg/arm-linux-user/config-target.mak
|
||||
SUBDIR = $(SRC_PATH)/linux-user/arm
|
||||
VPATH += $(SUBDIR)
|
||||
|
||||
all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so
|
||||
all: $(SUBDIR)/vdso-be8.so $(SUBDIR)/vdso-be32.so $(SUBDIR)/vdso-le.so
|
||||
|
||||
# Adding -use-blx disables unneeded interworking without actually using blx.
|
||||
LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-z,max-page-size=4096 \
|
||||
-Wl,-h,linux-vdso.so.1 -Wl,--build-id=sha1 \
|
||||
-Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld
|
||||
|
||||
$(SUBDIR)/vdso-be.so: vdso.S vdso.ld vdso-asmoffset.h
|
||||
$(CC) -o $@ $(LDFLAGS) -mbig-endian $<
|
||||
$(SUBDIR)/vdso-be8.so: vdso.S vdso.ld vdso-asmoffset.h
|
||||
$(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe8 $<
|
||||
|
||||
$(SUBDIR)/vdso-be32.so: vdso.S vdso.ld vdso-asmoffset.h
|
||||
$(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe32 $<
|
||||
|
||||
$(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h
|
||||
$(CC) -o $@ $(LDFLAGS) -mlittle-endian $<
|
||||
|
@ -10,10 +10,17 @@ syscall_nr_generators += {
|
||||
# is always true as far as source_set.apply() is concerned. Always build
|
||||
# both header files and include the right one via #if.
|
||||
|
||||
vdso_be_inc = gen_vdso.process('vdso-be.so',
|
||||
extra_args: ['-s', 'sigreturn_codes'])
|
||||
vdso_be8_inc = gen_vdso.process('vdso-be8.so',
|
||||
extra_args: ['-s', 'sigreturn_codes',
|
||||
'-p', 'vdso_be8'])
|
||||
|
||||
vdso_be32_inc = gen_vdso.process('vdso-be32.so',
|
||||
extra_args: ['-s', 'sigreturn_codes',
|
||||
'-p', 'vdso_be32'])
|
||||
|
||||
vdso_le_inc = gen_vdso.process('vdso-le.so',
|
||||
extra_args: ['-s', 'sigreturn_codes'])
|
||||
|
||||
linux_user_ss.add(when: 'TARGET_ARM', if_true: [vdso_be_inc, vdso_le_inc])
|
||||
linux_user_ss.add(when: 'TARGET_ARM', if_true: [
|
||||
vdso_be8_inc, vdso_be32_inc, vdso_le_inc
|
||||
])
|
||||
|
BIN
linux-user/arm/vdso-be32.so
Executable file
BIN
linux-user/arm/vdso-be32.so
Executable file
Binary file not shown.
Binary file not shown.
@ -652,6 +652,23 @@ static const char *get_elf_platform(void)
|
||||
#undef END
|
||||
}
|
||||
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#include "elf.h"
|
||||
#include "vdso-be8.c.inc"
|
||||
#include "vdso-be32.c.inc"
|
||||
|
||||
static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags)
|
||||
{
|
||||
return (EF_ARM_EABI_VERSION(elf_flags) >= EF_ARM_EABI_VER4
|
||||
&& (elf_flags & EF_ARM_BE8)
|
||||
? &vdso_be8_image_info
|
||||
: &vdso_be32_image_info);
|
||||
}
|
||||
#define vdso_image_info vdso_image_info
|
||||
#else
|
||||
# define VDSO_HEADER "vdso-le.c.inc"
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* 64 bit ARM definitions */
|
||||
|
||||
@ -951,14 +968,14 @@ const char *elf_hwcap2_str(uint32_t bit)
|
||||
|
||||
#undef GET_FEATURE_ID
|
||||
|
||||
#endif /* not TARGET_AARCH64 */
|
||||
|
||||
#if TARGET_BIG_ENDIAN
|
||||
# define VDSO_HEADER "vdso-be.c.inc"
|
||||
#else
|
||||
# define VDSO_HEADER "vdso-le.c.inc"
|
||||
#endif
|
||||
|
||||
#endif /* not TARGET_AARCH64 */
|
||||
|
||||
#endif /* TARGET_ARM */
|
||||
|
||||
#ifdef TARGET_SPARC
|
||||
@ -3586,12 +3603,14 @@ static void load_elf_interp(const char *filename, struct image_info *info,
|
||||
load_elf_image(filename, &src, info, &ehdr, NULL);
|
||||
}
|
||||
|
||||
#ifndef vdso_image_info
|
||||
#ifdef VDSO_HEADER
|
||||
#include VDSO_HEADER
|
||||
#define vdso_image_info() &vdso_image_info
|
||||
#define vdso_image_info(flags) &vdso_image_info
|
||||
#else
|
||||
#define vdso_image_info() NULL
|
||||
#endif
|
||||
#define vdso_image_info(flags) NULL
|
||||
#endif /* VDSO_HEADER */
|
||||
#endif /* vdso_image_info */
|
||||
|
||||
static void load_elf_vdso(struct image_info *info, const VdsoImageInfo *vdso)
|
||||
{
|
||||
@ -3921,7 +3940,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
|
||||
* Load a vdso if available, which will amongst other things contain the
|
||||
* signal trampolines. Otherwise, allocate a separate page for them.
|
||||
*/
|
||||
const VdsoImageInfo *vdso = vdso_image_info();
|
||||
const VdsoImageInfo *vdso = vdso_image_info(info->elf_flags);
|
||||
if (vdso) {
|
||||
load_elf_vdso(&vdso_info, vdso);
|
||||
info->vdso = vdso_info.load_bias;
|
||||
|
Loading…
Reference in New Issue
Block a user