Weak functions can be used to define default interrupt handlers on embedded systems.
Suppose there is a weak function defined as:
__attribute__((weak)) void foo(void)
If user don't implement another version of "foo", then the weak "foo" is used as the final function definition. Otherwise if the user defines another "foo" as bellow:
// do some thing here.
The code still compiles and the user defined "foo" replaces the weak "foo".
When using CIL to merge C files, CIL will detect a confliction and keep only one of them. I guess CIL will remove the latter definition which is usually the "strong" one.
I think the correct operation of CIL should be removing the weak version on function definition confliction, or perserving both.
I am new to CIL and don't know how to write a test case. And I dont know if this issue need to be fixed since it is commonly related to embedded systems.
主题：Re: [CIL users] Bug of CIL 1.4.0 handling weak functions?
On Fri, Feb 17, 2012 at 08:12:08PM +0800, 林楠 wrote:
> Suppose I have function two functions named "foo", one with weak
> attribute and one without. Seems CIL will report a confliction and
> only keep one of the two functions. To make it worse, CIL may keep the
> weak function and remove the not weak function.
I have no idea what weak functions are. Could you provide a pointer, and a
test case that I could include in the test suite please?