|
104 | 104 | /** |
105 | 105 | * @brief Optionally override the linker section into which size and data is |
106 | 106 | * emitted. |
107 | | - * |
| 107 | + * |
108 | 108 | * @warning If you use this facility, you might have to deal with |
109 | 109 | * platform-specific linker output section naming on your own. |
110 | 110 | */ |
111 | 111 | #if !defined(INCBIN_OUTPUT_SECTION) |
112 | | -# if defined(__APPLE__) |
113 | | -# define INCBIN_OUTPUT_SECTION ".const_data" |
114 | | -# else |
115 | | -# define INCBIN_OUTPUT_SECTION ".rodata" |
116 | | -# endif |
| 112 | +#if defined(__APPLE__) |
| 113 | +#define INCBIN_OUTPUT_SECTION ".const_data" |
| 114 | +#else |
| 115 | +#define INCBIN_OUTPUT_SECTION ".rodata" |
| 116 | +#endif |
117 | 117 | #endif |
118 | 118 |
|
119 | 119 | /** |
|
123 | 123 | * platform-specific linker output section naming on your own. |
124 | 124 | */ |
125 | 125 | #if !defined(INCBIN_OUTPUT_DATA_SECTION) |
126 | | -# define INCBIN_OUTPUT_DATA_SECTION INCBIN_OUTPUT_SECTION |
| 126 | +#define INCBIN_OUTPUT_DATA_SECTION INCBIN_OUTPUT_SECTION |
127 | 127 | #endif |
128 | 128 |
|
129 | 129 | /** |
130 | 130 | * @brief Optionally override the linker section into which size is emitted. |
131 | 131 | * |
132 | 132 | * @warning If you use this facility, you might have to deal with |
133 | 133 | * platform-specific linker output section naming on your own. |
134 | | - * |
| 134 | + * |
135 | 135 | * @note This is useful for Harvard architectures where program memory cannot |
136 | 136 | * be directly read from the program without special instructions. With this you |
137 | 137 | * can chose to put the size variable in RAM rather than ROM. |
138 | 138 | */ |
139 | 139 | #if !defined(INCBIN_OUTPUT_SIZE_SECTION) |
140 | | -# define INCBIN_OUTPUT_SIZE_SECTION INCBIN_OUTPUT_SECTION |
| 140 | +#define INCBIN_OUTPUT_SIZE_SECTION INCBIN_OUTPUT_SECTION |
141 | 141 | #endif |
142 | 142 |
|
143 | 143 | #if defined(__APPLE__) |
144 | | -# include "TargetConditionals.h" |
145 | | -# if defined(TARGET_OS_IPHONE) && !defined(INCBIN_SILENCE_BITCODE_WARNING) |
146 | | -# warning "incbin is incompatible with bitcode. Using the library will break upload to App Store if you have bitcode enabled. Add `#define INCBIN_SILENCE_BITCODE_WARNING` before including this header to silence this warning." |
147 | | -# endif |
| 144 | +#include "TargetConditionals.h" |
| 145 | +#if defined(TARGET_OS_IPHONE) && !defined(INCBIN_SILENCE_BITCODE_WARNING) |
| 146 | +#warning "incbin is incompatible with bitcode. Using the library will break upload to App Store if you have bitcode enabled. Add `#define INCBIN_SILENCE_BITCODE_WARNING` before including this header to silence this warning." |
| 147 | +#endif |
148 | 148 | /* The directives are different for Apple branded compilers */ |
149 | | -# define INCBIN_SECTION INCBIN_OUTPUT_SECTION "\n" |
150 | | -# define INCBIN_GLOBAL(NAME) ".globl " INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n" |
151 | | -# define INCBIN_INT ".long " |
152 | | -# define INCBIN_MANGLE "_" |
153 | | -# define INCBIN_BYTE ".byte " |
154 | | -# define INCBIN_TYPE(...) |
| 149 | +#define INCBIN_SECTION INCBIN_OUTPUT_SECTION "\n" |
| 150 | +#define INCBIN_GLOBAL(NAME) ".globl " INCBIN_MANGLE INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n" |
| 151 | +#define INCBIN_INT ".long " |
| 152 | +#define INCBIN_MANGLE "_" |
| 153 | +#define INCBIN_BYTE ".byte " |
| 154 | +#define INCBIN_TYPE(...) |
155 | 155 | #else |
156 | | -# define INCBIN_SECTION ".section " INCBIN_OUTPUT_SECTION "\n" |
157 | | -# define INCBIN_GLOBAL(NAME) ".global " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n" |
158 | | -# if defined(__ghs__) |
159 | | -# define INCBIN_INT ".word " |
160 | | -# else |
161 | | -# define INCBIN_INT ".int " |
162 | | -# endif |
163 | | -# if defined(__USER_LABEL_PREFIX__) |
164 | | -# define INCBIN_MANGLE INCBIN_STRINGIZE(__USER_LABEL_PREFIX__) |
165 | | -# else |
166 | | -# define INCBIN_MANGLE "" |
167 | | -# endif |
168 | | -# if defined(INCBIN_ARM) |
| 156 | +#define INCBIN_SECTION ".section " INCBIN_OUTPUT_SECTION "\n" |
| 157 | +#define INCBIN_GLOBAL(NAME) ".global " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME "\n" |
| 158 | +#if defined(__ghs__) |
| 159 | +#define INCBIN_INT ".word " |
| 160 | +#else |
| 161 | +#define INCBIN_INT ".int " |
| 162 | +#endif |
| 163 | +#if defined(__USER_LABEL_PREFIX__) |
| 164 | +#define INCBIN_MANGLE INCBIN_STRINGIZE(__USER_LABEL_PREFIX__) |
| 165 | +#else |
| 166 | +#define INCBIN_MANGLE "" |
| 167 | +#endif |
| 168 | +#if defined(INCBIN_ARM) |
169 | 169 | /* On arm assemblers, `@' is used as a line comment token */ |
170 | | -# define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", %object\n" |
171 | | -# elif defined(__MINGW32__) || defined(__MINGW64__) |
| 170 | +#define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", %object\n" |
| 171 | +#elif defined(__MINGW32__) || defined(__MINGW64__) |
172 | 172 | /* Mingw doesn't support this directive either */ |
173 | | -# define INCBIN_TYPE(NAME) |
174 | | -# else |
| 173 | +#define INCBIN_TYPE(NAME) |
| 174 | +#else |
175 | 175 | /* It's safe to use `@' on other architectures */ |
176 | | -# define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", @object\n" |
177 | | -# endif |
178 | | -# define INCBIN_BYTE ".byte " |
| 176 | +#define INCBIN_TYPE(NAME) ".type " INCBIN_STRINGIZE(INCBIN_PREFIX) #NAME ", @object\n" |
| 177 | +#endif |
| 178 | +#define INCBIN_BYTE ".byte " |
179 | 179 | #endif |
180 | 180 |
|
181 | 181 | /* List of style types used for symbol names */ |
|
199 | 199 | * @endcode |
200 | 200 | */ |
201 | 201 | #if !defined(INCBIN_PREFIX) |
202 | | -# define INCBIN_PREFIX g |
| 202 | +#define INCBIN_PREFIX g |
203 | 203 | #endif |
204 | 204 |
|
205 | 205 | /** |
|
223 | 223 | * @endcode |
224 | 224 | */ |
225 | 225 | #if !defined(INCBIN_STYLE) |
226 | | -# define INCBIN_STYLE INCBIN_STYLE_CAMEL |
| 226 | +#define INCBIN_STYLE INCBIN_STYLE_CAMEL |
227 | 227 | #endif |
228 | 228 |
|
229 | 229 | /* Style lookup tables */ |
|
0 commit comments