[cfe-dev] linux/i386 and mregparm

pageexec at freemail.hu pageexec at freemail.hu
Tue Mar 1 09:18:18 PST 2011


On 1 Mar 2011 at 19:49, Anton Korobeynikov wrote:

> Hello
> 
> > about the the commented out chunk in X86::isOffsetSuitableForCodeModel, i'm not
> > sure if such checking makes sense for kernel mode, so as a quick hack i just got
> > rid of it, but i don't know what the right solution there would be.

> The right solution is to leave the check there. There is a comment
> describing what's going on.
> The check the made specifically for kernel code model.

with rip relative addressing (which is what my patch enables even for kernel
mode) you'll get negative offsets for symbols below the current rip so this
check is wrong in that case (i learned it the hard way when the rest of the
patch still didn't produce the desired asm and had to debug it down to this
check ;).

for the non-rip relative case i don't see why accepting negative offsets is
wrong whereas it's considered correct for the small model. i.e., what is the
programming construct that
 1. produces such negative offsets and
 2. is correct for small mode and
 3. is wrong for the kernel?

now in case there is a reason to keep this check then i don't know how to
determine at this point whether the offset to be checked is going to be used
for rip relative addressing or not.




More information about the cfe-dev mailing list