I have the following macro to embed binary data from filename:
#define INCBIN(identifier, filename) \
asm(".pushsection .rodata\n" \
"\t.local " #identifier "_begin\n" \
"\t.type " #identifier "_begin, @object\n" \
"\t.align 16\n" #identifier "_begin:\n" \
"\t.incbin \"" filename "\"\n\n" \
\
"\t.local " #identifier "_end\n" \
"\t.type " #identifier "_end, @object\n" \
"\t.align 1\n" #identifier "_end:\n" \
"\t.byte 0\n" \
"\t.popsection\n"); \
\
extern std::byte const identifier##_begin[]; \
extern std::byte const identifier##_end[]
I would like to be able to claim that it is an uint32_t instead of an std::byte. This would require the file to have an integer multiple of 4 bytes. Alignment is already taken care of by the macro (align to 16). Can I trigger a compile-time error if the file has a bad size? That is, add some compile-time assert to the assembly.