El 27/02/12 16:10, Bernhard Voelker escribió:
On 02/27/2012 05:50 PM, Cristian Rodríguez wrote:
El 27/02/12 13:24, Cristian Rodríguez escribió:
El 27/02/12 09:53, Bernhard Voelker escribió:
void __attribute__ ((destructor)) print_call_count (void);
Compile / link it:
$ gcc -fPIC -O2 -c k.c $ ld -G k.o -o k.so
Works for me , I am in factory though.
# gcc -shared -rdynamic -march=native -Wall -fPIC $(rpm --eval %optflags) k.c -o k.so
LD_PRELOAD="./k.so" ls --color=always -l .
cat x --> 74
Hmm, you compiled+linked in one step. This works here, too:
gcc -shared -fPIC -O2 k.c -o k.so
Can you confirm the failure when compiling + linking is done in 2 separate steps?
Well, I expected that to fail so didnt bothered.. You know.. distributions have a crapload of broken makefiles that link with LD directly. it fails in subtle ways when you do so, when using GCC, it passes the right options to the linker so we avoid nasty surprises...