Strange error message about condition code in assembly (ia32)
Etienne Lorrain via gcc
gcc@gcc.gnu.org
Mon Nov 6 14:31:00 GMT 2017
Hello,
On GCC: gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0, Binutils: GNU ld (GNU Binutils for Ubuntu) 2.29.1,I get such error messages:
boot.c: In function ‘dummy_do_not_call’:
boot.c:1656:3: error: invalid 'asm': operand is not a condition code, invalid operand code 'c'
asm volatile (" bootbefore_part2_PhysicaldriveNb = %c0 " : : "p" (&bootbefore.part2.PhysicaldriveNb));
^~~
The source is simply something like:__attribute__((weak)) void dummy_do_not_call (void)
{
asm volatile (" bootbefore_part2_PhysicaldriveNb = %c0 " : : "p" (&bootbefore.part2.PhysicaldriveNb));
... same pattern ...}
and that "strange" asm is used to be able to access fields of structures in assembler.
The %c0 modifier is clearly defined in:https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86-Operand-Modifiersto print the constant expression with no punctuation, we should just get in the assembler file:bootbefore_part2_PhysicaldriveNb = bootbefore+42
Is there something wrong with GCC compiled for the latest Ubuntu?Where that "condition code" message is coming from?
Thanks for any answer,Etienne.
More information about the Gcc
mailing list