2 * Copyright (C) 2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7 * Permission is hereby granted to use or copy this program for any
8 * purpose, provided the above notices are retained on all copies.
9 * Permission to modify the code and to distribute modified code is
10 * granted, provided the above notices are retained, and a notice that
11 * the code was modified is included with the above copyright notice.
19 int testint
__attribute__((weak
, visibility("hidden")));
20 void *testptr
__attribute__((weak
, visibility("hidden")));
23 } testsym_24_bytes
__attribute__((weak
, visibility("hidden")));
25 void *testfct_int(void);
26 void *testfct_ptr(void);
27 void *testfct_24_bytes(void);
29 void *testlibfct1_int(void);
30 void *testlibfct1_ptr(void);
31 void *testlibfct1_24_bytes(void);
33 void *testlibfct2_int(void);
34 void *testlibfct2_ptr(void);
35 void *testlibfct2_24_bytes(void);
40 MATCH_PROGRAM_24_BYTES
,
47 static bool match_matrix
[NR_MATCH
];
51 plan_tests(NUM_TESTS
);
53 if (testfct_int() == &testint
)
54 match_matrix
[MATCH_PROGRAM_INT
] = true;
55 if (testfct_ptr() == &testptr
)
56 match_matrix
[MATCH_PROGRAM_PTR
] = true;
57 if (testfct_24_bytes() == &testsym_24_bytes
)
58 match_matrix
[MATCH_PROGRAM_24_BYTES
] = true;
60 if (testlibfct1_int() == testlibfct2_int())
61 match_matrix
[MATCH_LIB_INT
] = true;
62 if (testlibfct1_ptr() == testlibfct2_ptr())
63 match_matrix
[MATCH_LIB_PTR
] = true;
64 if (testlibfct1_24_bytes() == testlibfct2_24_bytes())
65 match_matrix
[MATCH_LIB_24_BYTES
] = true;
67 diag("Address of weak symbol with hidden visibility %s between compile units within same module for main program (4 bytes integer object)",
68 match_matrix
[MATCH_PROGRAM_INT
] ? "match" : "MISMATCH");
69 diag("Address of weak symbol with hidden visibility %s between compile units within same module for main program (pointer object)",
70 match_matrix
[MATCH_PROGRAM_PTR
] ? "match" : "MISMATCH");
71 diag("Address of weak symbol with hidden visibility %s between compile units within same module for main program (24 bytes structure object)",
72 match_matrix
[MATCH_PROGRAM_24_BYTES
] ? "match" : "MISMATCH");
74 diag("Address of weak symbol with hidden visibility %s between compile units within same module for shared library (4 bytes integer object)",
75 match_matrix
[MATCH_LIB_INT
] ? "match" : "MISMATCH");
76 diag("Address of weak symbol with hidden visibility %s between compile units within same module for shared library (pointer object)",
77 match_matrix
[MATCH_LIB_PTR
] ? "match" : "MISMATCH");
78 diag("Address of weak symbol with hidden visibility %s between compile units within same module for shared library (24 bytes structure object)",
79 match_matrix
[MATCH_LIB_24_BYTES
] ? "match" : "MISMATCH");
81 ok(match_matrix
[MATCH_PROGRAM_INT
] == match_matrix
[MATCH_PROGRAM_PTR
],
82 "Weak-hidden behavior is the same for 4 bytes integer and pointer objects within main program");
83 ok(match_matrix
[MATCH_LIB_INT
] == match_matrix
[MATCH_LIB_PTR
],
84 "Weak-hidden behavior is the same for 4 bytes integer and pointer objects within shared library");
This page took 0.03272 seconds and 4 git commands to generate.