Re: [BE] How to query attributes of a function being called?

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

 



Ian Lance Taylor schrieb:
Georg-Johann Lay <avr@xxxxxxxx> writes:

Hi, suppose this test case of C code:

typedef void (*cb_t)(void) __attribute__((callback));

void caller (cb_t cb)
{
    cb();
}

What I need in the backend is a way to query for the attributs that
are attaches to callees like 'cb'.

It may work to look at the MEM_EXPR of the call operand and look at
DECL_ATTRIBUTES of that.

Ian

Hi Ian, thanks again! :-)

I tried the REG_EXPR of the address and it looked good, but the internals say that there may be cases where REG_EXPR is 0, so that there would be no way to see if the callee is tagged with the attribute or not.

At the moment, I try to get the information in final, but I am not sure if every C source will lead to a REG_EXPR that allows to decide wether or not a call will change security level. Can you say a word about that?

If it is not 100% sure that attributes will work in /any/ imaginable case then I will drop that idea, because security is a must here.

Then I am confused about the internals. In "9.3 Types"
   http://gcc.gnu.org/onlinedocs/gccint/Types.html#Types
Macros like TYPE_PTRFN_P are documented, but are not present in the gcc source tree. I am using gcc core for the port, but these macros are contained only in the C++ part in ./cp/cp-tree.h. Maybe this could be moved when reorganizing the gcc source tree, as such macros are useful for C, too?

Georg-Johann




[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