Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: makefile

Issue 8589027: Add a tool for patching ELF libraries/executables offline (Closed) Base URL: https://seccompsandbox.googlecode.com/svn/trunk
Patch Set: Add to 'clean' target Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | patch_offline.cc » ('j') | patch_offline.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 elf_loader_32 elf_loader_64 24 all: testbin timestats demo elf_loader_32 elf_loader_64 patch_offline
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
35 -rm -f run_tests_32 run_tests_64 35 -rm -f run_tests_32 run_tests_64
36 -rm -f elf_loader_32 elf_loader_64
37 -rm -f patch_offline
36 -rm -f tests/test-list.h 38 -rm -f tests/test-list.h
37 -rm -f core core.* vgcore vgcore.* strace.log* 39 -rm -f core core.* vgcore vgcore.* strace.log*
38 40
39 test: run_tests_64 run_tests_32 41 test: run_tests_64 run_tests_32
40 ./run_tests_64 42 ./run_tests_64
41 ./run_tests_32 43 ./run_tests_32
42 env SECCOMP_SANDBOX_REFERENCE_IMPL=1 ./run_tests_64 44 env SECCOMP_SANDBOX_REFERENCE_IMPL=1 ./run_tests_64
43 env SECCOMP_SANDBOX_REFERENCE_IMPL=1 ./run_tests_32 45 env SECCOMP_SANDBOX_REFERENCE_IMPL=1 ./run_tests_32
44 46
45 tests/test_syscalls.o64 tests/test_syscalls.o32: tests/test-list.h 47 tests/test_syscalls.o64 tests/test_syscalls.o32: tests/test-list.h
46 48
47 tests/test-list.h: tests/list_tests.py tests/test_syscalls.cc 49 tests/test-list.h: tests/list_tests.py tests/test_syscalls.cc
48 python tests/list_tests.py tests/test_syscalls.cc > $@ 50 python tests/list_tests.py tests/test_syscalls.cc > $@
49 51
50 run_tests_64: $(OBJS64) tests/test_syscalls.o64 tests/clone_test_helper.o64 52 run_tests_64: $(OBJS64) tests/test_syscalls.o64 tests/clone_test_helper.o64
51 g++ -m64 $^ -lpthread -lutil -o $@ 53 g++ -m64 $^ -lpthread -lutil -o $@
52 run_tests_32: $(OBJS32) tests/test_syscalls.o32 tests/clone_test_helper.o32 54 run_tests_32: $(OBJS32) tests/test_syscalls.o32 tests/clone_test_helper.o32
53 g++ -m32 $^ -lpthread -lutil -o $@ 55 g++ -m32 $^ -lpthread -lutil -o $@
54 56
55 # Link these as PIEs so that they stay out of the way of any 57 # Link these as PIEs so that they stay out of the way of any
56 # fixed-position executable that gets loaded later. 58 # fixed-position executable that gets loaded later.
57 elf_loader_64: elf_loader.o64 $(OBJS64) 59 elf_loader_64: elf_loader.o64 $(OBJS64)
58 g++ -pie -m64 $^ -o $@ 60 g++ -pie -m64 $^ -o $@
59 elf_loader_32: elf_loader.o32 $(OBJS32) 61 elf_loader_32: elf_loader.o32 $(OBJS32)
60 g++ -pie -m32 $^ -o $@ 62 g++ -pie -m32 $^ -o $@
61 63
64 patch_offline: patch_offline.o x86_decode.o
65 g++ $^ -o $@
66
62 demo: playground preload32.so preload64.so 67 demo: playground preload32.so preload64.so
63 ./playground /bin/ls $(HOME) 68 ./playground /bin/ls $(HOME)
64 69
65 testbin: testbin32 testbin64 70 testbin: testbin32 testbin64
66 71
67 gdb: testbin64 72 gdb: testbin64
68 gdb $< 73 gdb $<
69 74
70 valgrind: testbin64 75 valgrind: testbin64
71 valgrind --db-attach=yes ./$< 76 valgrind --db-attach=yes ./$<
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 116
112 .cc.o32: 117 .cc.o32:
113 ${CXX} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -fPIC -c -o $@ $< 118 ${CXX} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -fPIC -c -o $@ $<
114 119
115 .c.o32: 120 .c.o32:
116 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 --std=gnu99 -fPIC \ 121 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 --std=gnu99 -fPIC \
117 -c -o $@ $< 122 -c -o $@ $<
118 123
119 .S.o32: 124 .S.o32:
120 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -c -o $@ $< 125 ${CC} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -m32 -c -o $@ $<
OLDNEW
« no previous file with comments | « no previous file | patch_offline.cc » ('j') | patch_offline.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698