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

Side by Side Diff: tools/relocation_packer/BUILD.gn

Issue 650933003: GN: make relocation packing work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-parse-error
Patch Set: Created 6 years, 2 months 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 target_define = "TARGET_UNSUPPORTED"
6 if (target_arch == "arm") {
7 target_define = "TARGET_ARM"
8 } else if (target_arch == "arm64") {
9 target_define = "TARGET_ARM64"
10 }
simonb (inactive) 2014/10/17 12:30:20 You could 'else assert...' here, I think, if you w
cjhopman 2014/10/17 20:55:19 Done.
11
12 if (current_toolchain == host_toolchain) {
13 # GYP: //tools/relocation_packer/relocation_packer.gyp:lib_relocation_packer
14 source_set("lib_relocation_packer") {
15 defines = [ target_define ]
16 deps = [ "//third_party/elfutils:libelf" ]
17 configs -= [ "//build/config/compiler:chromium_code" ]
18 configs += [ "//build/config/compiler:no_chromium_code" ]
19 sources = [
20 "src/debug.cc",
21 "src/delta_encoder.cc",
22 "src/elf_file.cc",
23 "src/leb128.cc",
24 "src/packer.cc",
25 "src/sleb128.cc",
26 "src/run_length_encoder.cc",
27 ]
28 }
29
30 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer
31 executable("relocation_packer") {
32 defines = [ target_define ]
33 deps = [
34 ":lib_relocation_packer",
35 "//third_party/elfutils:libelf",
36 ]
37 sources = [ "src/main.cc" ]
38 }
39
40 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt ests
41 test("relocation_packer_unittests") {
42 sources = [
43 "src/debug_unittest.cc",
44 "src/delta_encoder_unittest.cc",
45 "src/elf_file_unittest.cc",
46 "src/leb128_unittest.cc",
47 "src/packer_unittest.cc",
48 "src/sleb128_unittest.cc",
49 "src/run_length_encoder_unittest.cc",
50 "src/run_all_unittests.cc",
51 ]
52 rebased_test_data = rebase_path("test_data", root_build_dir)
53 data = [
54 "test_data/elf_file_unittest_relocs_arm32.so",
55 "test_data/elf_file_unittest_relocs_arm32_packed.so",
56 "test_data/elf_file_unittest_relocs_arm64.so",
57 "test_data/elf_file_unittest_relocs_arm64_packed.so",
58 ]
59 defines = [
60 target_define,
61 "INTERMEDIATE_DIR=\"$rebased_test_data\""
62 ]
63 include_dirs = [ "//" ]
64 deps = [
65 ":lib_relocation_packer",
66 ":relocation_packer_test_data",
67 "//testing:gtest",
68 ]
69 }
70 }
71
72 if (current_toolchain == default_toolchain &&
73 (target_arch == "arm" || target_arch == "arm64")) {
74 # Targets to build test data. These participate only in building test
75 # data for use with elf_file_unittest.cc, and are not part of the main
76 # relocation packer build. Unit test data files are checked in to the
77 # source tree as 'golden' data, and are not generated 'on the fly' by
78 # the build.
79 #
80 # See test_data/generate_elf_file_unittest_relocs.sh for instructions.
81
82 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_test_ data
83 shared_library("relocation_packer_test_data") {
84 cflags = [ "-O0", "-g0" ]
85 sources = [
86 "test_data/elf_file_unittest_relocs.cc"
87 ]
88 }
89
90 # GYP: //tools/relocation_packer/relocation_packer.gyp:relocation_packer_unitt ests_test_data
91 action("relocation_packer_unittests_test_data") {
92 script = "test_data/generate_elf_file_unittest_relocs.py"
93 test_file = "$root_build_dir/librelocation_packer_test_data.so"
94 if (target_arch == "arm") {
95 added_section = ".android.rel.dyn"
96 packed_output = "elf_file_unittest_relocs_arm32_packed.so"
97 unpacked_output = "elf_file_unittest_relocs_arm32.so"
98 } else if (target_arch == "arm64") {
99 added_section = ".android.rela.dyn"
100 packed_output = "elf_file_unittest_relocs_arm64_packed.so"
101 unpacked_output = "elf_file_unittest_relocs_arm64.so"
102 } else {
103 assert(false, "Unsupported target arch for relocation packer")
104 }
105
106 packed_output = "$root_build_dir/$packed_output"
107 unpacked_output = "$root_build_dir/$unpacked_output"
108
109 inputs = [
110 test_file,
111 ]
112
113 deps = [
114 ":relocation_packer_test_data",
115 ":relocation_packer($host_toolchain)",
116 ]
117
118 outputs = [
119 packed_output,
120 unpacked_output,
121 ]
122
123 args = [
124 "--android-pack-relocations", rebase_path(relocation_packer_exe, root_buil d_dir),
125 "--android-objcopy", rebase_path(android_objcopy, root_build_dir),
126 "--added-section=$added_section",
127 "--test-file", rebase_path(test_file, root_build_dir),
128 "--packed-output", rebase_path(packed_output, root_build_dir),
129 "--unpacked-output", rebase_path(unpacked_output, root_build_dir),
130 ]
131 }
132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698