On 02/27/2012 08:10 PM, Bernhard Voelker wrote:
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?
It's not two separate steps that's the issue - it's using gcc vs. ld directly vs gcc -shared. Try: gcc -fPIC -O2 -c k.c gcc -shared k.o -o k.os This works fine for me... Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org