To do this in any clean sort of way, I rewrote a substantial portion of elfload.c. Doing otherwise would have wound up with 3 entirely separate bits of code to load an elf image.
The first patch seems out of order, since I did this work on a branch that already contained some previously submitted fixes for Alpha. The third patch is *only* white-space changes. There were too many functions that I was touching that were improperly indented for qemu's style. Fixing this once at the beginning minimizes the irrelevant whitespace changes that emacs autoindent would have introduced when moving code around later. The patch sequence has been tested at each point with all of the targets in linux-user-test-0.3. Since that doesn't actually test gettimeofday, I also tested the final result against a small program that simply reads and prints the timeval with the system glibc, and examining the logs to verify that we do in fact call the __vdso_getttimeofday in the loaded vdso. I didn't test with the linux-user-test-0.3 image because I have no way of properly linking with that library, and programs linked against my system glibc crash when run vs the uClibc library. I'll admit that the Makefiles aren't quite right for building the VDSO. I couldn't quite figure out what needed to be done. The binary image included in patch 13 is exactly what you'd get with the link command included in the pc-bios/Makefile, provided that you can get that link command executed. I'd appreciate some help with this point. Finally, do be aware that I was not able to use qemu_find_file to load the vdso image, since that function is only built for system builds, and I'd rather this patch sequence be independent of cleanups involving vl.c. ;-) As a short-term hack, I always load the vdso image from the install directory. Which does mean that x86-64 emulation will not currently work from the build directory alone. r~ Richard Henderson (14): linux-user: Handle filesz < memsz for any PT_LOAD segment. Add more DT_* and AT_* constants to qemu's copy of elf.h. linux-user: Reindent elfload.c. linux-user: Reduce lseek+reads while loading elf files. linux-user: Fix ELF_DATA for Alpha. linux-user: Clean up byte-swapping in elfload.c. linux-user: Load symbols from the interpreter. linux-user: Improve consistency checking in elf headers. linux-user: Put the stack guard page at the top. linux-user: Remove partial support for a.out interpreters. linux-user: Extract load_elf_image from load_elf_interp. linux-user: Re-use load_elf_image for the main binary. linux-user: Build vdso for x64. linux-user: Load a VDSO for x86-64. Makefile | 3 +- elf.h | 44 ++ linux-user/elfload.c | 1683 +++++++++++++++++++++------------------------ linux-user/linuxload.c | 17 +- linux-user/qemu.h | 7 +- pc-bios/Makefile | 5 + pc-bios/vdso-linux-x64.S | 102 +++ pc-bios/vdso-linux-x64.ld | 81 +++ pc-bios/vdso-linux-x64.so | Bin 0 -> 7515 bytes 9 files changed, 1037 insertions(+), 905 deletions(-) create mode 100644 pc-bios/vdso-linux-x64.S create mode 100644 pc-bios/vdso-linux-x64.ld create mode 100755 pc-bios/vdso-linux-x64.so