• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("../../../test_template.gni")
15
16group("ldso_cfi_test") {
17  testonly = true
18  deps = [
19    ":cfi_available_derived_cast_test",
20    ":cfi_available_icall_test",
21    ":cfi_available_nvcall_test",
22    ":cfi_available_unrelated_cast_test",
23    ":cfi_available_vccall_test",
24    ":cfi_cross_dso_dtor_test_exe",
25    ":cfi_cross_dso_dtor_test_use",
26    ":cfi_cross_dso_test_exe",
27    ":cfi_cross_dso_test_lib",
28    ":large_size_lib",
29    ":large_size_test",
30    ":ldso_cfi_check",
31    ":ldso_cfi_test_lib",
32    ":ldso_cfi_typeconversion",
33  ]
34  if (target_cpu == "arm64") {
35    deps += [
36      ":cfi_icall_report_test",
37      ":cfi_report_test",
38    ]
39  }
40}
41
42ohos_executable("ldso_cfi_check") {
43  subsystem_name = "musl"
44  part_name = "libc-test"
45  include_dirs = [
46    "../common",
47    "//third_party/musl/porting/linux/user/include",
48    "//third_party/musl/porting/linux/user/ldso",
49    "//third_party/musl/libc-test/src/common",
50  ]
51
52  sources = [ "ldso_cfi_check.c" ]
53  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
54}
55
56ohos_shared_library("ldso_cfi_test_lib") {
57  include_dirs = [ "." ]
58  sources = [ "ldso_cfi_test_lib.c" ]
59
60  output_name = "ldso_cfi_test_lib"
61  output_extension = "so"
62  subsystem_name = "musl"
63  part_name = "libc-test-lib"
64}
65
66ohos_shared_library("cfi_cross_dso_test_lib") {
67  sanitize = {
68    cfi = true
69    cfi_cross_dso = true
70    debug = true
71  }
72  subsystem_name = "musl"
73  part_name = "libc-test-lib"
74  include_dirs = [
75    "../common",
76    "//third_party/musl/porting/linux/user/include",
77    "//third_party/musl/porting/linux/user/ldso",
78    "//third_party/musl/libc-test/src/common",
79  ]
80  use_rtti = true
81
82  sources = [ "./crossdso/cfi_test_lib.cpp" ]
83}
84
85ohos_executable("cfi_cross_dso_test_exe") {
86  sanitize = {
87    cfi = true
88    cfi_cross_dso = true
89    debug = true
90  }
91  subsystem_name = "musl"
92  part_name = "libc-test"
93  include_dirs = [
94    "../common",
95    "//third_party/musl/porting/linux/user/include",
96    "//third_party/musl/porting/linux/user/ldso",
97    "//third_party/musl/libc-test/src/common",
98  ]
99  use_rtti = true
100
101  sources = [ "./crossdso/cfi_test_exe.cpp" ]
102  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
103}
104
105ohos_shared_library("cfi_cross_dso_dtor_test_base") {
106  sanitize = {
107    cfi = true
108    cfi_cross_dso = true
109    debug = true
110  }
111  subsystem_name = "musl"
112  part_name = "libc-test-lib"
113  include_dirs = [
114    "../common",
115    "//third_party/musl/porting/linux/user/include",
116    "//third_party/musl/porting/linux/user/ldso",
117    "//third_party/musl/libc-test/src/common",
118  ]
119  use_rtti = true
120
121  sources = [ "./crossdso_dtor/libbase.cpp" ]
122}
123
124ohos_shared_library("cfi_cross_dso_dtor_test_use") {
125  sanitize = {
126    cfi = true
127    cfi_cross_dso = true
128    debug = true
129  }
130  subsystem_name = "musl"
131  part_name = "libc-test-lib"
132  include_dirs = [
133    "../common",
134    "//third_party/musl/porting/linux/user/include",
135    "//third_party/musl/porting/linux/user/ldso",
136    "//third_party/musl/libc-test/src/common",
137  ]
138  use_rtti = true
139
140  sources = [ "./crossdso_dtor/libuse.cpp" ]
141
142  deps = [ ":cfi_cross_dso_dtor_test_base" ]
143}
144
145ohos_executable("cfi_cross_dso_dtor_test_exe") {
146  sanitize = {
147    cfi = true
148    cfi_cross_dso = true
149    debug = true
150  }
151  subsystem_name = "musl"
152  part_name = "libc-test"
153  include_dirs = [
154    "../common",
155    "//third_party/musl/porting/linux/user/include",
156    "//third_party/musl/porting/linux/user/ldso",
157    "//third_party/musl/libc-test/src/common",
158  ]
159  use_rtti = true
160
161  ldflags = [ "-Wl,-rpath=./" ]
162
163  sources = [ "./crossdso_dtor/cfi_dtor_test.cpp" ]
164  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
165  deps = [ ":cfi_cross_dso_dtor_test_base" ]
166}
167
168ohos_executable("cfi_available_derived_cast_test") {
169  sanitize = {
170    cfi = true
171    cfi_cross_dso = true
172    debug = true
173  }
174  subsystem_name = "musl"
175  part_name = "libc-test"
176  include_dirs = [
177    "../common",
178    "//third_party/musl/porting/linux/user/include",
179    "//third_party/musl/porting/linux/user/ldso",
180    "//third_party/musl/libc-test/src/common",
181  ]
182  use_rtti = true
183
184  sources = [ "cfi_available_derived_cast_test.cpp" ]
185  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
186}
187
188ohos_executable("cfi_available_icall_test") {
189  sanitize = {
190    cfi = true
191    cfi_cross_dso = true
192    debug = true
193  }
194  subsystem_name = "musl"
195  part_name = "libc-test"
196  include_dirs = [
197    "../common",
198    "//third_party/musl/porting/linux/user/include",
199    "//third_party/musl/porting/linux/user/ldso",
200    "//third_party/musl/libc-test/src/common",
201  ]
202  use_rtti = true
203
204  sources = [ "cfi_available_icall_test.cpp" ]
205  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
206}
207
208ohos_executable("cfi_available_nvcall_test") {
209  sanitize = {
210    cfi = true
211    cfi_cross_dso = true
212    debug = true
213  }
214  subsystem_name = "musl"
215  part_name = "libc-test"
216  include_dirs = [
217    "../common",
218    "//third_party/musl/porting/linux/user/include",
219    "//third_party/musl/porting/linux/user/ldso",
220    "//third_party/musl/libc-test/src/common",
221  ]
222  use_rtti = true
223
224  sources = [ "cfi_available_nvcall_test.cpp" ]
225  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
226}
227
228ohos_executable("cfi_available_unrelated_cast_test") {
229  sanitize = {
230    cfi = true
231    cfi_cross_dso = true
232    debug = true
233  }
234  subsystem_name = "musl"
235  part_name = "libc-test"
236  include_dirs = [
237    "../common",
238    "//third_party/musl/porting/linux/user/include",
239    "//third_party/musl/porting/linux/user/ldso",
240    "//third_party/musl/libc-test/src/common",
241  ]
242  use_rtti = true
243
244  sources = [ "cfi_available_unrelated_cast_test.cpp" ]
245  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
246}
247
248ohos_executable("cfi_available_vccall_test") {
249  sanitize = {
250    cfi = true
251    cfi_cross_dso = true
252    debug = true
253  }
254  subsystem_name = "musl"
255  part_name = "libc-test"
256  include_dirs = [
257    "../common",
258    "//third_party/musl/porting/linux/user/include",
259    "//third_party/musl/porting/linux/user/ldso",
260    "//third_party/musl/libc-test/src/common",
261  ]
262  use_rtti = true
263
264  sources = [ "cfi_available_vccall_test.cpp" ]
265  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
266}
267
268ohos_executable("ldso_cfi_typeconversion") {
269  sanitize = {
270    cfi = true
271    cfi_cross_dso = true
272    debug = true
273  }
274  subsystem_name = "musl"
275  part_name = "libc-test"
276  include_dirs = [
277    "../common",
278    "//third_party/musl/porting/linux/user/include",
279    "//third_party/musl/porting/linux/user/ldso",
280    "//third_party/musl/libc-test/src/common",
281  ]
282  use_rtti = true
283
284  sources = [ "ldso_cfi_typeconversion.cpp" ]
285  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
286}
287
288ohos_executable("cfi_icall_report_test") {
289  sanitize = {
290    cfi = true
291    cfi_cross_dso = true
292    debug = false
293  }
294  subsystem_name = "musl"
295  part_name = "libc-test"
296
297  sources = [ "./cfi_report_test/cfi_icall_report_test.cpp" ]
298  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
299}
300
301ohos_executable("cfi_report_test") {
302  subsystem_name = "musl"
303  part_name = "libc-test"
304
305  sources = [ "./cfi_report_test/cfi_report_test.cpp" ]
306  configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
307}
308
309ohos_executable("large_size_test") {
310  sanitize = {
311    cfi = true
312    cfi_cross_dso = true
313  }
314  ldflags = [ "-Wl,-rpath=./" ]
315  subsystem_name = "musl"
316  part_name = "libc-test"
317  deps = [ ":large_size_lib" ]
318  sources = [ "./large_size_library/large_size_test.cpp" ]
319}
320
321ohos_shared_library("large_size_lib") {
322  sanitize = {
323    cfi = true
324    cfi_cross_dso = true
325  }
326  output_name = "large_size"
327  output_extension = "so"
328  subsystem_name = "musl"
329  part_name = "libc-test-lib"
330
331  sources = [ "./large_size_library/large_size_lib.cpp" ]
332}
333