(Sorry if this post appears twice, the first one didn't seem to come
through...)
Hello everybody,
I am trying to use the "alias" attribute for functions. From the gcc manual:
`alias ("target")'
The `alias' attribute causes the declaration to be emitted as an
alias for another symbol, which must be specified. For instance,
void __f () { /* do something */; }
void f () __attribute__ ((weak, alias ("__f")));
declares `f' to be a weak alias for `__f'. In C++, the mangled
name for the target must be used.
Not all target machines support this attribute.
msp430-gcc gives me the following warning:
Scheduler.c:101: warning: alias definitions not supported in this
configuration; ignored
So I guess it's not implemented (yet). How difficult would it be to
implement the "alias" attribute?
I've never hacked gcc. However, I've been looking at the file
gcc/gcc-3.3/gcc/config/msp430/msp430.c, where attributes are processed,
and I think I would be able to implement a simple attribute like
"wakeup" that only requires slightly changing a function prologue or
epilogue. However, as specified in the manual, "alias" seems to require
emitting some pseudo-code for a function *prototype*. Moreover, the
"standard" attributes like "weak" and "noreturn" seem to be implemented
in the core of gcc, and "alias" is one of them. So I'm kinda lost.
I could probably implement someting easier like an
aliasname("othername") attribute that adds a ".global othername" when
generating the function name in asm_declare_function_name(), a bit
similar to what interrupt(x) is doing.
Ideas? Opinions? Is this someting others could find useful?
Ah, in case it didn't get through, what I'm trying to do is call a
function by two different names. The goal is to be able to implement
custom call tables behaving similarly to the interrupt vector table, and
to assign a function to a specific slot.
I am using gcc-3.2.3 on linux.
Best regards.
-- Remy
Remove underscore and anti-spam suffix in reply address for a timely
response.
--
Remove underscore and anti-spam suffix in reply address for a timely
response.