On Thu, Jan 07, 2010 at 10:46:59AM -0800, Richard Henderson wrote: > There are places, like brcond2, where we know that the destination > of a forward branch will be within 127 bytes. > > Add the R_386_PC8 relocation type to support this. Add a flag to > tcg_out_jxx and tcg_out_brcond* to enable it. Set the flag in the > brcond2 label_next branches; pass along the input flag otherwise. > > Signed-off-by: Richard Henderson <r...@twiddle.net> > --- > elf.h | 2 + > tcg/i386/tcg-target.c | 116 > +++++++++++++++++++++++++++++++++---------------- > 2 files changed, 80 insertions(+), 38 deletions(-) > > diff --git a/elf.h b/elf.h > index 11674d7..c84c8ab 100644 > --- a/elf.h > +++ b/elf.h > @@ -243,6 +243,8 @@ typedef struct { > #define R_386_GOTOFF 9 > #define R_386_GOTPC 10 > #define R_386_NUM 11 > +/* Not a dynamic reloc, so not included in R_386_NUM. Used in TCG. */ > +#define R_386_PC8 23 > > #define R_MIPS_NONE 0 > #define R_MIPS_16 1 > diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c > index 972b102..e1691b3 100644 > --- a/tcg/i386/tcg-target.c > +++ b/tcg/i386/tcg-target.c > @@ -61,6 +61,12 @@ static void patch_reloc(uint8_t *code_ptr, int type, > case R_386_PC32: > *(uint32_t *)code_ptr = value - (long)code_ptr; > break; > + case R_386_PC8: > + value -= (long)code_ptr; > + if (value != (int8_t)value) > + tcg_abort();
This does not conforms to CODING_STYLE, curly brackets are missing. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net