OLD | NEW |
1 CFLAGS = -g -O0 -Wall -Werror -Wextra -Wno-missing-field-initializers \ | 1 CFLAGS = -g -O0 -Wall -Werror -Wextra -Wno-missing-field-initializers \ |
2 -Wno-unused-parameter -I. | 2 -Wno-unused-parameter -I. |
3 LDFLAGS = -g | 3 LDFLAGS = -g |
4 CPPFLAGS = | 4 CPPFLAGS = |
5 DEPFLAGS = -MMD -MF $@.d | 5 DEPFLAGS = -MMD -MF $@.d |
6 MODS := allocator preload library debug maps x86_decode securemem sandbox \ | 6 MODS := allocator preload library debug maps x86_decode securemem sandbox \ |
7 syscall_entrypoint system_call_table \ | 7 syscall_entrypoint system_call_table \ |
8 trusted_thread trusted_thread_asm trusted_process \ | 8 trusted_thread trusted_thread_asm trusted_process \ |
9 access exit fault_handler_asm clone \ | 9 access exit fault_handler_asm clone \ |
10 getpid gettid ioctl ipc madvise mmap mprotect \ | 10 getpid gettid ioctl ipc madvise mmap mprotect \ |
11 munmap open prctl reference_trusted_thread sigaction sigprocmask \ | 11 munmap open prctl reference_trusted_thread sigaction sigprocmask \ |
12 socketcall stat tls_setup tls_setup_helper | 12 socketcall stat tls_setup tls_setup_helper |
13 OBJS64 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o64/') | 13 OBJS64 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o64/') |
14 OBJS32 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o32/') | 14 OBJS32 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o32/') |
15 ALL_OBJS = $(OBJS32) $(OBJS64) tests/test_syscalls.o64 tests/test_syscalls.o32 \ | 15 ALL_OBJS = $(OBJS32) $(OBJS64) tests/test_syscalls.o64 tests/test_syscalls.o32 \ |
16 tests/clone_test_helper.o64 tests/clone_test_helper.o32 \ | 16 tests/clone_test_helper.o64 tests/clone_test_helper.o32 \ |
17 timestats.o playground.o | 17 timestats.o playground.o |
18 DEP_FILES = $(wildcard $(foreach f,$(ALL_OBJS),$(f).d)) | 18 DEP_FILES = $(wildcard $(foreach f,$(ALL_OBJS),$(f).d)) |
19 | 19 |
20 include $(DEP_FILES) | 20 include $(DEP_FILES) |
21 | 21 |
22 .SUFFIXES: .o64 .o32 | 22 .SUFFIXES: .o64 .o32 |
23 | 23 |
24 all: testbin timestats demo | 24 all: testbin timestats demo elf_loader_32 elf_loader_64 |
25 | 25 |
26 clean: | 26 clean: |
27 -rm -f playground playground.o | 27 -rm -f playground playground.o |
28 -rm -f $(ALL_OBJS) | 28 -rm -f $(ALL_OBJS) |
29 -rm -f $(DEP_FILES) | 29 -rm -f $(DEP_FILES) |
30 -rm -f preload64.so | 30 -rm -f preload64.so |
31 -rm -f preload32.so | 31 -rm -f preload32.so |
32 -rm -f testbin64 testbin.o64 | 32 -rm -f testbin64 testbin.o64 |
33 -rm -f testbin32 testbin.o32 | 33 -rm -f testbin32 testbin.o32 |
34 -rm -f timestats timestats.o | 34 -rm -f timestats timestats.o |
(...skipping 10 matching lines...) Expand all Loading... |
45 tests/test_syscalls.o64 tests/test_syscalls.o32: tests/test-list.h | 45 tests/test_syscalls.o64 tests/test_syscalls.o32: tests/test-list.h |
46 | 46 |
47 tests/test-list.h: tests/list_tests.py tests/test_syscalls.cc | 47 tests/test-list.h: tests/list_tests.py tests/test_syscalls.cc |
48 python tests/list_tests.py tests/test_syscalls.cc > $@ | 48 python tests/list_tests.py tests/test_syscalls.cc > $@ |
49 | 49 |
50 run_tests_64: $(OBJS64) tests/test_syscalls.o64 tests/clone_test_helper.o64 | 50 run_tests_64: $(OBJS64) tests/test_syscalls.o64 tests/clone_test_helper.o64 |
51 g++ -m64 $^ -lpthread -lutil -o $@ | 51 g++ -m64 $^ -lpthread -lutil -o $@ |
52 run_tests_32: $(OBJS32) tests/test_syscalls.o32 tests/clone_test_helper.o32 | 52 run_tests_32: $(OBJS32) tests/test_syscalls.o32 tests/clone_test_helper.o32 |
53 g++ -m32 $^ -lpthread -lutil -o $@ | 53 g++ -m32 $^ -lpthread -lutil -o $@ |
54 | 54 |
| 55 # Link these as PIEs so that they stay out of the way of any |
| 56 # fixed-position executable that gets loaded later. |
| 57 elf_loader_64: elf_loader.o64 $(OBJS64) |
| 58 g++ -pie -m64 $^ -o $@ |
| 59 elf_loader_32: elf_loader.o32 $(OBJS32) |
| 60 g++ -pie -m32 $^ -o $@ |
| 61 |
55 demo: playground preload32.so preload64.so | 62 demo: playground preload32.so preload64.so |
56 ./playground /bin/ls $(HOME) | 63 ./playground /bin/ls $(HOME) |
57 | 64 |
58 testbin: testbin32 testbin64 | 65 testbin: testbin32 testbin64 |
59 | 66 |
60 gdb: testbin64 | 67 gdb: testbin64 |
61 gdb $< | 68 gdb $< |
62 | 69 |
63 valgrind: testbin64 | 70 valgrind: testbin64 |
64 valgrind --db-attach=yes ./$< | 71 valgrind --db-attach=yes ./$< |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 111 |
105 .cc.o32: | 112 .cc.o32: |
106 ${CXX} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -fPIC -c -o $@ $< | 113 ${CXX} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -fPIC -c -o $@ $< |
107 | 114 |
108 .c.o32: | 115 .c.o32: |
109 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 --std=gnu99 -fPIC \ | 116 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 --std=gnu99 -fPIC \ |
110 -c -o $@ $< | 117 -c -o $@ $< |
111 | 118 |
112 .S.o32: | 119 .S.o32: |
113 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -c -o $@ $< | 120 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -c -o $@ $< |
OLD | NEW |