1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <dlfcn.h>
17
18 #include "dso_symver.h"
19
20 /**
21 * @tc.name : reloc_symver_0100
22 * @tc.desc : find versioning symbol while relocating.
23 * load libreloc_symver_dso.so that deps on libdso_no_symver.so and libdso_easy_symver.so.
24 * @tc.level : Level 1
25 */
reloc_symver_0100(void)26 static void reloc_symver_0100(void)
27 {
28 symver_log("start");
29
30 void *so = dlopen("libreloc_symver_dso.so", RTLD_NOW);
31 if (so) {
32 dlclose(so);
33 } else {
34 symver_error("%s", dlerror());
35 }
36
37 symver_log("end");
38 }
39
main(int argc,char * argv[])40 int main(int argc, char *argv[])
41 {
42 symver_log("start");
43
44 reloc_symver_0100();
45
46 symver_log("t_status = %d", t_status);
47 symver_log("end");
48
49 return t_status;
50 }