xref: /illumos-gate/usr/src/test/elf-tests/tests/resolution/mixed-hidden-comdat/main.c (revision b8052df9f609edb713f6828c9eecc3d7be19dfb3)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2021, Richard Lowe.
14  */
15 
16 #include <sys/types.h>
17 
18 #include <stdio.h>
19 #include <stdlib.h>
20 
21 extern uint64_t test_data(void);
22 extern uint64_t test_bss(void);
23 
24 #define	CORRECT_DATA	8675309
25 #define	CORRECT_BSS	0
26 
27 int
28 main(int argc, char **argv)
29 {
30 	uint64_t td = test_data();
31 	uint64_t tb = test_bss();
32 
33 	if (td != CORRECT_DATA) {
34 		printf("FAIL: test data mismatch: should be %ld is %ld\n",
35 		    CORRECT_DATA, td);
36 		abort();
37 	}
38 
39 	if (tb != CORRECT_BSS) {
40 		printf("FAIL: test bss mismatch: should be %ld is %ld\n",
41 		    CORRECT_BSS, tb);
42 		abort();
43 	}
44 
45 	printf("SUCCESS\n");
46 
47 	return (0);
48 }
49