Re: Need help in solving error generated while building compiler (stage-2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Priyanka Dudani <dudani.priyanka@xxxxxxxxx> writes:

> I need to encrypt return address when calling a function by modifying
> prologue and epilogue of the compiler. I am trying to do the same by
> XORing return address with EBP register value.
> Here is the code i have written in ix86_expand_prologue() method in i386.c file.
>
> if (frame_pointer_needed)
>     {
>       insn = emit_insn (gen_push (hard_frame_pointer_rtx));
>       RTX_FRAME_RELATED_P (insn) = 1;
>       insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
>       RTX_FRAME_RELATED_P (insn) = 1;
>
>                 ebp_plus = gen_rtx_REG(Pmode, CX_REG);
>                 ebp = gen_rtx_REG(Pmode, BP_REG);
>                 emit_move_insn(ebp_plus,
> plus_constant(hard_frame_pointer_rtx, 4));
>                 if (TARGET_64BIT)
>                 insn = emit_insn(gen_xordi3(ebp_plus, ebp_plus,
> hard_frame_pointer_rtx));
>                 else
>                  insn = emit_insn(gen_xorsi3(ebp_plus, ebp_plus,
> hard_frame_pointer_rtx));
>     }
>
> Similar code in ix86_expand_epilogue() method.
>
> While building the compiler, it gets built till stage-1 successfully.
> But gives the following error at the end of stage-2
>
> ../../gcc-4.3.3/gcc/config/i386/i386.md:16349 : error :
> 'TARGET_USE_CCGOCMODE_FIOP' undeclared here (not in a function)
>
> The line 16349 in i386.md file, at which error occurs has the
> following code written
>
> 16349  "TARGET_80387 && TARGET_USE_<MODE>MODE_FIOP"
> 16350  "* return which_alternative ? \"#\" : output_387_binary_op
> (insn, operands);"
>
> The error is related to the mode of the compiler but i am not able to
> figure out what is causing this error.

This most likely means that your change to the compiler is causing it
to miscompile code.  I assume you got the error above when compiling
insn-recog.c.  That means that genrecog was miscompiled.  Try
comparing the file insn-recog.c in the stage1 and stage2 build
directories; they should be identical.

You will have to figure out why genrecog is misbehaving, and figure
out what in your compiler change caused the misbehaviour.

Another approach would be to configure with --disable-bootstrap, build
gcc, and then run the gcc testsuite ("make check-gcc").  By looking at
the cases which fail, but which do not fail when running an unmodified
gcc, you may find a simpler test case for whatever the problem is.

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux