| OLD | NEW |
| (Empty) | |
| 1 diff -ur qemu-2.3.0/linux-user/elfload.c qemu-2.3.0.patched/linux-user/elfload.c |
| 2 --- qemu-2.3.0/linux-user/elfload.c 2015-04-27 07:08:25.000000000 -0700 |
| 3 +++ qemu-2.3.0.patched/linux-user/elfload.c 2015-04-28 12:02:11.459311636 -0
700 |
| 4 @@ -1304,7 +1304,7 @@ |
| 5 #ifdef USE_ELF_CORE_DUMP |
| 6 static int elf_core_dump(int, const CPUArchState *); |
| 7 #endif /* USE_ELF_CORE_DUMP */ |
| 8 -static void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias); |
| 9 +void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias); |
| 10 |
| 11 /* Verify the portions of EHDR within E_IDENT for the target. |
| 12 This can be performed before bswapping the entire header. */ |
| 13 @@ -2062,7 +2062,7 @@ |
| 14 } |
| 15 |
| 16 /* Best attempt to load symbols from this ELF object. */ |
| 17 -static void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias) |
| 18 +void load_symbols(struct elfhdr *hdr, int fd, abi_ulong load_bias) |
| 19 { |
| 20 int i, shnum, nsyms, sym_idx = 0, str_idx = 0; |
| 21 struct elf_shdr *shdr; |
| 22 Only in qemu-2.3.0.patched/linux-user: elfload.c.orig |
| 23 diff -ur qemu-2.3.0/linux-user/main.c qemu-2.3.0.patched/linux-user/main.c |
| 24 --- qemu-2.3.0/linux-user/main.c 2015-04-27 07:08:25.000000000 -0700 |
| 25 +++ qemu-2.3.0.patched/linux-user/main.c 2015-04-28 12:02:11.459311636 -0
700 |
| 26 @@ -3650,6 +3650,38 @@ |
| 27 exit(0); |
| 28 } |
| 29 |
| 30 +// @LOCAL-MOD-START |
| 31 +// zero initialized and zero terminated |
| 32 +#define NACL_ELF_MAX 10 |
| 33 +struct syminfo* extra_syminfo[NACL_ELF_MAX + 1]; |
| 34 +#include "elf.h" |
| 35 +void load_symbols(struct elf32_hdr *hdr, int fd, abi_ulong load_bias); |
| 36 + |
| 37 +static void handle_arg_nacl_extra_elf(const char *arg) { |
| 38 + int i; |
| 39 + for (i=0; i< NACL_ELF_MAX; ++i) { |
| 40 + if (extra_syminfo[i] == 0) break; |
| 41 + } |
| 42 + |
| 43 + if (i >= NACL_ELF_MAX) { |
| 44 + printf("ERROR: too many extra symbol files\n"); |
| 45 + } |
| 46 + |
| 47 + printf("adding symbols from %s\n", arg); |
| 48 + |
| 49 + struct elf32_hdr elf_ex; |
| 50 + int fd; |
| 51 + fd = open(arg, O_RDONLY); |
| 52 + if (fd <= 0) { |
| 53 + printf("ERROR: opening secondary exe %s\n", filename); |
| 54 + return; |
| 55 + } |
| 56 + |
| 57 + read(fd, &elf_ex, sizeof elf_ex); |
| 58 + load_symbols(&elf_ex, fd, 0); |
| 59 +} |
| 60 + |
| 61 + |
| 62 struct qemu_argument { |
| 63 const char *argv; |
| 64 const char *env; |
| 65 @@ -3699,6 +3731,8 @@ |
| 66 "", "Seed for pseudo-random number generator"}, |
| 67 {"version", "QEMU_VERSION", false, handle_arg_version, |
| 68 "", "display version information and exit"}, |
| 69 + {"nacl_extra_elf", "", true, handle_arg_nacl_extra_elf, |
| 70 + "", ""}, |
| 71 {NULL, NULL, false, NULL, NULL, NULL} |
| 72 }; |
| 73 |
| 74 @@ -3883,6 +3917,12 @@ |
| 75 |
| 76 optind = parse_args(argc, argv); |
| 77 |
| 78 + // @LOCALMOD-START |
| 79 + if (qemu_loglevel_mask(CPU_LOG_EXEC)) { |
| 80 + printf("qemu with NACL mods\n"); |
| 81 + } |
| 82 + // @LOCALMOD-END |
| 83 + |
| 84 /* Zero out regs */ |
| 85 memset(regs, 0, sizeof(struct target_pt_regs)); |
| 86 |
| 87 Only in qemu-2.3.0.patched/linux-user: main.c.orig |
| OLD | NEW |