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 "dso_easy_symver.h"
17 #include "dso_hard_symver.h"
18 #include "dso_no_symver.h"
19 #include "dso_symver.h"
20
21 /**
22 * @tc.name : dynlink_default_0100
23 * @tc.desc : invoke a symbol directly after specifying the default version
24 * @tc.level : Level 0
25 */
dynlink_default_0100(void)26 void dynlink_default_0100(void)
27 {
28 symver_log("start");
29
30 __asm__(".symver dso_easy_symver, dso_easy_symver@STABLE");
31 const char *result = dso_easy_symver();
32 symver_streq(result, dso_easy_symver_symbol_stable);
33
34 symver_log("end");
35 }
36
37 /**
38 * @tc.name : dynlink_default_0200
39 * @tc.desc : invoke a symbol directly after specifying the default version
40 * @tc.level : Level 1
41 */
dynlink_default_0200(void)42 void dynlink_default_0200(void)
43 {
44 symver_log("start");
45
46 __asm__(".symver dso_hard_symver_ld, dso_hard_symver_ld@STABLE");
47 const char *result = dso_hard_symver_ld();
48 symver_streq(result, dso_hard_symver_ld_symbol_stable);
49
50 symver_log("end");
51 }
52
main(int argc,char * argv[])53 int main(int argc, char *argv[])
54 {
55 symver_log("start");
56
57 dynlink_default_0100();
58 dynlink_default_0200();
59
60 symver_log("t_status = %d", t_status);
61 symver_log("end");
62
63 return t_status;
64 }
65