| ▲ | stncls 14 hours ago | |
> The simplest solution however is to use -mcmodel=large which changes all the relative CALL instructions to absolute JMP. Makes sense, but in the assembly output just after, there is not a single JMP instruction. Instead, CALL <immediate> is replaced with putting the address in a 64-bit register, then CALL <register>, which makes even more sense. But why mention the JMP thing then? Is it a mistake or am I missing something? (I know some calls are replaced by JMP, but that's done regardless of -mcmodel=large) | ||
| ▲ | dwattttt 10 hours ago | parent | next [-] | |
I would assume loose language, referring to a CALL as a JMP. However of the two reasons given to dislike the large code model, register pressure isn't relevant to that particular snippet. It's performing a call, ABIs define registers that are not preserved over calls; writing the destination to one of those won't affect register pressure. | ||
| ▲ | loeg 5 hours ago | parent | prev [-] | |
I think the author is just noting that the construction is similar to an 8-byte JMP instruction. The text now reads: > The simplest solution however is to use -mcmodel=large which changes all the relative CALL instructions to absolute 64bit ones; kind of like a JMP. (We still need to use CALL in order to push a return address.) | ||