While I now agree it's better to avoid the inline assembler, I thought it's faster to debug it as it is now.
The error I made was the following:
#define SOMECONSTANT 12 [...] "lds r30, %[_SOMECONSTANT] \n\t" [...] : : [_SOMECONSTANT] "M" (SOMECONSTANT)
OK, stupid typo, should've been ldi rather than lds. Nevertheless, the compiler did not complain and produced assemblable code.
Is this OK? I don't think "M" should be a valid constraint for the right-hand lds parameter...