|
8 | 8 | */ |
9 | 9 |
|
10 | 10 | #include <sys/types.h> |
11 | | -#include <stdio.h> |
12 | | -#include <getopt.h> |
13 | 11 | #include <stddef.h> |
14 | 12 | #include <libelf.h> |
15 | 13 | #include <string.h> |
16 | 14 | #include <stdlib.h> |
17 | 15 | #include <unistd.h> |
18 | 16 | #include <inttypes.h> |
19 | | -#include <limits.h> |
20 | 17 | #include <fcntl.h> |
21 | 18 | #include <err.h> |
22 | 19 | #ifdef HAVE_DWARF_SUPPORT |
|
31 | 28 | #define NT_GNU_BUILD_ID 3 |
32 | 29 | #endif |
33 | 30 |
|
34 | | -#define JVMTI |
35 | | - |
36 | 31 | #define BUILD_ID_URANDOM /* different uuid for each run */ |
37 | 32 |
|
38 | 33 | #ifdef HAVE_LIBCRYPTO |
@@ -511,44 +506,3 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym, |
511 | 506 |
|
512 | 507 | return retval; |
513 | 508 | } |
514 | | - |
515 | | -#ifndef JVMTI |
516 | | - |
517 | | -static unsigned char x86_code[] = { |
518 | | - 0xBB, 0x2A, 0x00, 0x00, 0x00, /* movl $42, %ebx */ |
519 | | - 0xB8, 0x01, 0x00, 0x00, 0x00, /* movl $1, %eax */ |
520 | | - 0xCD, 0x80 /* int $0x80 */ |
521 | | -}; |
522 | | - |
523 | | -static struct options options; |
524 | | - |
525 | | -int main(int argc, char **argv) |
526 | | -{ |
527 | | - int c, fd, ret; |
528 | | - |
529 | | - while ((c = getopt(argc, argv, "o:h")) != -1) { |
530 | | - switch (c) { |
531 | | - case 'o': |
532 | | - options.output = optarg; |
533 | | - break; |
534 | | - case 'h': |
535 | | - printf("Usage: genelf -o output_file [-h]\n"); |
536 | | - return 0; |
537 | | - default: |
538 | | - errx(1, "unknown option"); |
539 | | - } |
540 | | - } |
541 | | - |
542 | | - fd = open(options.output, O_CREAT|O_TRUNC|O_RDWR, 0666); |
543 | | - if (fd == -1) |
544 | | - err(1, "cannot create file %s", options.output); |
545 | | - |
546 | | - ret = jit_write_elf(fd, "main", x86_code, sizeof(x86_code)); |
547 | | - close(fd); |
548 | | - |
549 | | - if (ret != 0) |
550 | | - unlink(options.output); |
551 | | - |
552 | | - return ret; |
553 | | -} |
554 | | -#endif |
0 commit comments