2 ms·
Using gcc extended asm you can pass literal constants to the asm and they will be expanded textually (or at least their address will). I don't think the details
by gpderetta 5y ago
Using gcc extended asm you can pass literal constants to the asm and they will be expanded textually (or at least their address will). I don't think the details are fully documented anywhere and I had to use intel syntax to make it work, but it might be possible even wit AT&T syntax.
Take a look a this[1] for example. See how trampoline, the destructor and the size are passed in with the 'i' constraint and are referred to their value with the %cX constraint (yes, the code is write only and even with a lot of comments I have only the most vague idea of what I was trying to do here).
Probably more work is require for PIC though.
[1] https://github.com/gpderetta/delimited/blob/7e755d643ee458973e941b982fb7945b23804d9d/delimited.hpp#L115 https://github.com/gpderetta/delimited/blob/7e755d643ee45897...