OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("config.gni") | 5 import("config.gni") |
6 | 6 |
7 assert(relocation_packing_supported) | 7 assert(relocation_packing_supported) |
8 | 8 |
9 if (target_arch == "arm") { | 9 if (target_arch == "arm") { |
10 target_define = "TARGET_ARM" | 10 target_define = "TARGET_ARM" |
11 } else if (target_arch == "arm64") { | 11 } else if (target_arch == "arm64") { |
12 target_define = "TARGET_ARM64" | 12 target_define = "TARGET_ARM64" |
13 } | 13 } |
14 | 14 |
15 if (current_toolchain == host_toolchain) { | 15 if (current_toolchain == host_toolchain) { |
16 # GYP: //tools/relocation_packer/relocation_packer.gyp:lib_relocation_packer | 16 # GYP: //tools/relocation_packer/relocation_packer.gyp:lib_relocation_packer |
17 source_set("lib_relocation_packer") { | 17 source_set("lib_relocation_packer") { |
18 defines = [ target_define ] | 18 defines = [ target_define ] |
19 deps = [ "//third_party/elfutils:libelf" ] | 19 deps = [ |
| 20 "//third_party/elfutils:libelf", |
| 21 ] |
20 configs -= [ "//build/config/compiler:chromium_code" ] | 22 configs -= [ "//build/config/compiler:chromium_code" ] |
21 configs += [ "//build/config/compiler:no_chromium_code" ] | 23 configs += [ "//build/config/compiler:no_chromium_code" ] |
22 sources = [ | 24 sources = [ |
23 "src/debug.cc", | 25 "src/debug.cc", |
24 "src/delta_encoder.cc", | 26 "src/delta_encoder.cc", |
25 "src/elf_file.cc", | 27 "src/elf_file.cc", |
26 "src/leb128.cc", | 28 "src/leb128.cc", |
27 "src/packer.cc", | 29 "src/packer.cc", |
28 "src/sleb128.cc", | 30 "src/sleb128.cc", |
29 "src/run_length_encoder.cc", | 31 "src/run_length_encoder.cc", |
30 ] | 32 ] |
31 } | 33 } |
32 | 34 |
33 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer | 35 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer |
34 executable("relocation_packer") { | 36 executable("relocation_packer") { |
35 defines = [ target_define ] | 37 defines = [ target_define ] |
36 deps = [ | 38 deps = [ |
37 ":lib_relocation_packer", | 39 ":lib_relocation_packer", |
38 "//third_party/elfutils:libelf", | 40 "//third_party/elfutils:libelf", |
39 ] | 41 ] |
40 sources = [ "src/main.cc" ] | 42 sources = [ |
| 43 "src/main.cc", |
| 44 ] |
41 } | 45 } |
42 | 46 |
43 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt
ests | 47 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt
ests |
44 test("relocation_packer_unittests") { | 48 test("relocation_packer_unittests") { |
45 sources = [ | 49 sources = [ |
46 "src/debug_unittest.cc", | 50 "src/debug_unittest.cc", |
47 "src/delta_encoder_unittest.cc", | 51 "src/delta_encoder_unittest.cc", |
48 "src/elf_file_unittest.cc", | 52 "src/elf_file_unittest.cc", |
49 "src/leb128_unittest.cc", | 53 "src/leb128_unittest.cc", |
50 "src/packer_unittest.cc", | 54 "src/packer_unittest.cc", |
51 "src/sleb128_unittest.cc", | 55 "src/sleb128_unittest.cc", |
52 "src/run_length_encoder_unittest.cc", | 56 "src/run_length_encoder_unittest.cc", |
53 "src/run_all_unittests.cc", | 57 "src/run_all_unittests.cc", |
54 ] | 58 ] |
55 rebased_test_data = rebase_path("test_data", root_build_dir) | 59 rebased_test_data = rebase_path("test_data", root_build_dir) |
56 data = [ | 60 data = [ |
57 "test_data/elf_file_unittest_relocs_arm32.so", | 61 "test_data/elf_file_unittest_relocs_arm32.so", |
58 "test_data/elf_file_unittest_relocs_arm32_packed.so", | 62 "test_data/elf_file_unittest_relocs_arm32_packed.so", |
59 "test_data/elf_file_unittest_relocs_arm64.so", | 63 "test_data/elf_file_unittest_relocs_arm64.so", |
60 "test_data/elf_file_unittest_relocs_arm64_packed.so", | 64 "test_data/elf_file_unittest_relocs_arm64_packed.so", |
61 ] | 65 ] |
62 defines = [ | 66 defines = [ |
63 target_define, | 67 target_define, |
64 "INTERMEDIATE_DIR=\"$rebased_test_data\"" | 68 "INTERMEDIATE_DIR=\"$rebased_test_data\"", |
65 ] | 69 ] |
66 include_dirs = [ "//" ] | 70 include_dirs = [ "//" ] |
67 deps = [ | 71 deps = [ |
68 ":lib_relocation_packer", | 72 ":lib_relocation_packer", |
69 ":relocation_packer_test_data", | 73 ":relocation_packer_test_data", |
70 "//testing:gtest", | 74 "//testing:gtest", |
71 ] | 75 ] |
72 } | 76 } |
73 } | 77 } |
74 | 78 |
75 if (current_toolchain == default_toolchain && | 79 if (current_toolchain == default_toolchain && |
76 (target_arch == "arm" || target_arch == "arm64")) { | 80 (target_arch == "arm" || target_arch == "arm64")) { |
77 # Targets to build test data. These participate only in building test | 81 # Targets to build test data. These participate only in building test |
78 # data for use with elf_file_unittest.cc, and are not part of the main | 82 # data for use with elf_file_unittest.cc, and are not part of the main |
79 # relocation packer build. Unit test data files are checked in to the | 83 # relocation packer build. Unit test data files are checked in to the |
80 # source tree as 'golden' data, and are not generated 'on the fly' by | 84 # source tree as 'golden' data, and are not generated 'on the fly' by |
81 # the build. | 85 # the build. |
82 # | 86 # |
83 # See test_data/generate_elf_file_unittest_relocs.sh for instructions. | 87 # See test_data/generate_elf_file_unittest_relocs.sh for instructions. |
84 | 88 |
85 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_test_
data | 89 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_test_
data |
86 shared_library("relocation_packer_test_data") { | 90 shared_library("relocation_packer_test_data") { |
87 cflags = [ "-O0", "-g0" ] | 91 cflags = [ |
| 92 "-O0", |
| 93 "-g0", |
| 94 ] |
88 sources = [ | 95 sources = [ |
89 "test_data/elf_file_unittest_relocs.cc" | 96 "test_data/elf_file_unittest_relocs.cc", |
90 ] | 97 ] |
91 } | 98 } |
92 | 99 |
93 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt
ests_test_data | 100 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt
ests_test_data |
94 action("relocation_packer_unittests_test_data") { | 101 action("relocation_packer_unittests_test_data") { |
95 script = "test_data/generate_elf_file_unittest_relocs.py" | 102 script = "test_data/generate_elf_file_unittest_relocs.py" |
96 test_file = "$root_build_dir/librelocation_packer_test_data.so" | 103 test_file = "$root_build_dir/librelocation_packer_test_data.so" |
97 if (target_arch == "arm") { | 104 if (target_arch == "arm") { |
98 added_section = ".android.rel.dyn" | 105 added_section = ".android.rel.dyn" |
99 packed_output = "elf_file_unittest_relocs_arm32_packed.so" | 106 packed_output = "elf_file_unittest_relocs_arm32_packed.so" |
(...skipping 17 matching lines...) Expand all Loading... |
117 ":relocation_packer_test_data", | 124 ":relocation_packer_test_data", |
118 ":relocation_packer($host_toolchain)", | 125 ":relocation_packer($host_toolchain)", |
119 ] | 126 ] |
120 | 127 |
121 outputs = [ | 128 outputs = [ |
122 packed_output, | 129 packed_output, |
123 unpacked_output, | 130 unpacked_output, |
124 ] | 131 ] |
125 | 132 |
126 args = [ | 133 args = [ |
127 "--android-pack-relocations", rebase_path(relocation_packer_exe, root_buil
d_dir), | 134 "--android-pack-relocations", |
128 "--android-objcopy", rebase_path(android_objcopy, root_build_dir), | 135 rebase_path(relocation_packer_exe, root_build_dir), |
| 136 "--android-objcopy", |
| 137 rebase_path(android_objcopy, root_build_dir), |
129 "--added-section=$added_section", | 138 "--added-section=$added_section", |
130 "--test-file", rebase_path(test_file, root_build_dir), | 139 "--test-file", |
131 "--packed-output", rebase_path(packed_output, root_build_dir), | 140 rebase_path(test_file, root_build_dir), |
132 "--unpacked-output", rebase_path(unpacked_output, root_build_dir), | 141 "--packed-output", |
| 142 rebase_path(packed_output, root_build_dir), |
| 143 "--unpacked-output", |
| 144 rebase_path(unpacked_output, root_build_dir), |
133 ] | 145 ] |
134 } | 146 } |
135 } | 147 } |
OLD | NEW |