The output modifier P unofficially documented in a comment in gcc / config / i386 / i386.md :
;; The special asm out single letter directives following a '%' are: ... ;; P -- if PIC, print an @PLT suffix. ;; p -- print raw symbol name.
The top stanza modifier P is probably not the one needed here, but when it does not compile a PIC (position-independent code), it acts like a string modifier P The goal is to prevent the compiler from emitting an operand using a format commonly used for immediate values โโthat does not work here. As David Wolferd said, it would be better to use the c modifier, which is documented and specifically designed to handle instantaneous values. Keep in mind that this code was probably written before modifying the c modifier, since for a long time, none of the modifiers were documented.
Given that the built-in assembly statement is executed only once at boot time, performance does not matter, so I would not try to be smart with LEA. You can completely avoid operand modifiers with something simple:
char *stack_pointer; asm ("mov %%esp, %0" : "=r" (stack_pointer)); stack_end = stack_pointer - STACK_SIZE;
Ross ridge
source share