
In message e68c55e80705231347w76d86bf8o1a1f6001e93f3f72@mail.gmail.com you wrote:
it could't really be that simple, could it? I bet my sintax is wrong,
Maybe.
and I still do not compleatly understand how the compiler intreprets "weak" and "set". But I can see how this would work.
I never used this assembler trickery before myself. So far, I only played with the C variant of it. Like that:
-> cat foo.c #include <stdio.h>
int func(int, int);
int main (void) { int i = func (2, 7);
printf ("i = %d\n", i);
return 0; } -> cat func.c #include <stdio.h>
int __func (int a, int b) { printf ("Default func called: %d + %d\n", a, b);
return (a + b); }
int func(int a, int b) __attribute__ ((weak, alias ("__func"))); -> cat private.c #include <stdio.h>
int func (int a, int b) { printf ("Private func called: %d * %d\n", a, b);
return (a * b); } -> gcc -c *.c -> gcc -o foo foo.o func.o -> ./foo Default func called: 2 + 7 i = 9 -> gcc -o bar foo.o func.o private.o -> ./bar Private func called: 2 * 7 i = 14
Best regards,
Wolfgang Denk