There are countless questions regarding GCC extended ASM, but none seemed to be able to remedy my problem. I am trying to write a simple block of code that triggers a syscall to open. I have come up with the following:
int fd;
char file[] = "/path/to/file";
asm volatile ("int $0x80"
: "=a"(fd)
: "0"(__SYS_open), "D"(file), "S"(O_RDONLY)
: "cc","%edi","%esi");
Attempting to compile code containing the above asm reference leads to:
error: ‘asm’ operand has impossible constraints
I noticed that removing "%edi","%esi" from the clobber list allows the code to compile without error. I am able to include registers in the clobber list that I do not explicitly request in the constraints (e.g. ecx), so perhaps I am misunderstanding the clobber list.
The binary this code will be executed from is x86_64.