Fehler #530
Von Maximilian Seesslen vor 4 Monaten aktualisiert
The macro relies relais that the symbols are placed in an fixed order. This may not be the case in future linker versions.
this can easily easyli changed by using symbols in assembler.
<pre><code class="cpp">
#define CONCAT_(a, b) a##b
#define CONCAT(a, b) CONCAT_(a, b)
#define binary(path, file, variableBase) asm ( \
"" #variableBase "Data:\n" \
".incbin \"" path file "\"\n" \
"" #variableBase "End:\n" \
".set " #variableBase "SizePtr, . -" #variableBase "Data\n" ); \
extern char CONCAT(variableBase, Data); \
extern char CONCAT(variableBase, End); \
extern char CONCAT(variableBase, SizePtr); \
void* CONCAT(variableBase, Start) = &CONCAT(variableBase, Data); \
address_t CONCAT(variableBase, Size)= (address_t)&CONCAT(variableBase, SizePtr);
static_assert ( sizeof ( unsigned long long ) == 8 );
static_assert ( sizeof ( void* ) == 8 );
</code></pre>
this can easily easyli changed by using symbols in assembler.
<pre><code class="cpp">
#define CONCAT_(a, b) a##b
#define CONCAT(a, b) CONCAT_(a, b)
#define binary(path, file, variableBase) asm ( \
"" #variableBase "Data:\n" \
".incbin \"" path file "\"\n" \
"" #variableBase "End:\n" \
".set " #variableBase "SizePtr, . -" #variableBase "Data\n" ); \
extern char CONCAT(variableBase, Data); \
extern char CONCAT(variableBase, End); \
extern char CONCAT(variableBase, SizePtr); \
void* CONCAT(variableBase, Start) = &CONCAT(variableBase, Data); \
address_t CONCAT(variableBase, Size)= (address_t)&CONCAT(variableBase, SizePtr);
static_assert ( sizeof ( unsigned long long ) == 8 );
static_assert ( sizeof ( void* ) == 8 );
</code></pre>