This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] use symbol_ref flags for rs6000


>>>>> Richard Henderson writes:

Richard> One problem with this:

Richard> User code of the form

Richard> static int thunk[5];
Richard> ((void (*)(void))thunk) ();

Richard> that generates a call to the data section.  If the linker
Richard> will handle this, fine, otherwise you need to return false
Richard> so that the address gets loaded into a register.

	This is similar to an example in ffitest.c, where one needs to
hide the data object from the compiler.  The above example fails, but

        static int thunk[5];
        int * pthunk = thunk;
        asm ("" : "=g" (pthunk) : "0" (pthunk));
        ((void (*)(void))pthunk) ();

succeeds.

	current_file_function_operand() is not the only predicate that
generates a direct PowerPC call, symbol_ref_operand() does as well.  It
sounds like both current_file_function_operand() and symbol_ref_operand()
should test SYMBOL_REF_FUNCTION_P.  It either needs to be in both
predicates or neither for the original example to succeed.

David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]