summaryrefslogtreecommitdiff
path: root/src/mpu-symbols.h
blob: 7851230c08840bc73cc5b16e2c1b60c473ba63fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/***************************************************************
  __MPU_SYMBOLS.H

       This file contains declarations of interface for define
       WEAK, ALIAS symbols in object files.

       PART OF : MPUIO - library .

       USAGE   : Internal only .

       NOTE    : Include "libmpuio.h" before this FILE .

       Copyright (C) 2000 - 2026  by Andrey V.Kosteltsev.
       All Rights Reserved.
 ***************************************************************/

#ifndef   __MPU_SYMBOLS_H
#define   __MPU_SYMBOLS_H

#ifdef  __cplusplus
extern "C" {
#endif


#ifndef __ASSEMBLER__

#define __mpu_strong_alias( name, symbol ) \
  extern __typeof(name) symbol __attribute__ ((alias( #name )))

#if defined( HAVE_WEAK_SYMBOLS ) && !defined( __CYGWIN__ )
/*********************************************************
  HAVE_WEAK_SYMBOLS:
 */
#define __mpu_weak_alias( name, symbol ) \
  extern __typeof(name) symbol __attribute__ ((weak, alias( #name )))

#define __MPU_WEAK   1

#else  /* HAVE_WEAK_SYMBOLS */
/*********************************************************
  don't HAVE_WEAK_SYMBOLS (for example, in Cygwin):
 */
#define __mpu_weak_alias( name, symbol ) \
           __mpu_strong_alias( name, symbol )

#define __MPU_WEAK   0

#endif /* HAVE_WEAK_SYMBOLS */

#endif /* __ASSEMBLER__ */


#if defined( SHARED ) && defined( HAVE_HIDDEN_VISIBILITY_ATTRIBUTE )
#define __mpu_hidden_decl(name) \
  extern __typeof (name) __attribute__ ((visibility ("hidden"))) name
#else
#define __mpu_hidden_decl(name)
#endif


#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
# define MPU_THREAD_LOCAL _Thread_local
#elif defined(__GNUC__)
# define MPU_THREAD_LOCAL __thread
#else
# error "Thread-local storage is not supported"
#endif


#ifdef  __cplusplus
}   /* ... extern "C" */
#endif

#endif /* __MPU_SYMBOLS_H */