This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ objdump -t /lib64/libpthread.so.0 | grep pthread_cond_wait | |
| 0000000000000000 l df *ABS* 0000000000000000 old_pthread_cond_wait.c | |
| 0000003cf900b240 l F .text 00000000000001f7 __pthread_cond_wait | |
| 0000003cf900b8f0 l F .text 0000000000000098 __pthread_cond_wait_2_0 | |
| 0000003cf900b240 g F .text 00000000000001f7 pthread_cond_wait@@GLIBC_2.3.2 | |
| 0000003cf900b8f0 g F .text 0000000000000098 pthread_cond_wait@GLIBC_2.2.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ objdump -t condwait_test | grep pthread_cond_wait | |
| 0000000000000000 F *UND* 0000000000000000 pthread_cond_wait@@GLIBC_2.3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ objdump -t /lib64/libpthread.so.0 | grep pthread_cond_wait | |
| 0000000000000000 l df *ABS* 0000000000000000 old_pthread_cond_wait.c | |
| 0000003cf900b240 l F .text 00000000000001f7 __pthread_cond_wait | |
| 0000003cf900b8f0 l F .text 0000000000000098 __pthread_cond_wait_2_0 | |
| 0000003cf900b240 g F .text 00000000000001f7 pthread_cond_wait@@GLIBC_2.3.2 | |
| 0000003cf900b8f0 g F .text 0000000000000098 pthread_cond_wait@GLIBC_2.2.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <dlfcn.h> | |
| #include <pthread.h> | |
| static int (*condwait_internal)(pthread_cond_t *cond, pthread_mutex_t *mutex); | |
| void __attribute__ ((constructor)) init(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ gcc -g3 -Wall -fPIC -shared -o condwait_wrap.so condwait_wrap.c -ldl -lpthread | |
| $ gcc -g3 -Wall -o condwait_test condwait_test.c -lpthread | |
| $ LD_PRELOAD=./condwait_wrap.so ./condwait_test | |
| Calling func condwait with cond: 0x600d80, mutex: 0x600dc0.....got it! | |
| Thread exiting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <dlfcn.h> | |
| #include <pthread.h> | |
| static int (*condwait_internal_225)(pthread_cond_t *cond, | |
| pthread_mutex_t *mutex); | |
| static int (*condwait_internal_232)(pthread_cond_t *cond, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ gcc -g3 -Wall -fPIC -shared -o condwait_wrap.so condwait_wrap.c -ldl -lpthread | |
| /usr/bin/ld: condwait_wrap.so: version node not found for symbol pthread_cond_wait@@GLIBC_2.3.2 | |
| /usr/bin/ld: failed to set dynamic section sizes: Bad value | |
| collect2: ld returned 1 exit status | |
| Exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GLIBC_2.2.5 { | |
| global: | |
| pthread_cond_wait; | |
| local: | |
| *; | |
| }; | |
| GLIBC_2.3.2 { | |
| global: | |
| pthread_cond_wait; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ gcc -g3 -Wall -fPIC -shared -o condwait_wrap.so condwait_wrap.c -ldl -lpthread -Wl,--version-script -Wl,VERSION.txt | |
| $ LD_PRELOAD=./condwait_wrap.so ./condwait_test | |
| Calling condwait v. 2.3.2 with cond: 0x600d80, mutex: 0x600dc0.....got it! | |
| Thread exiting | |
| $ objdump -t condwait_wrap.so | grep pthread_cond_wait | |
| 000000000000074a l F .text 000000000000006c pthread_cond_wait_225 | |
| 00000000000007b6 l F .text 000000000000006c pthread_cond_wait_232 | |
| 00000000000007b6 g F .text 000000000000006c pthread_cond_wait@@GLIBC_2.3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ab.h -- External API for libab. */ | |
| #ifndef __AB_H__ | |
| #define __AB_H__ | |
| const char *ab_get_string(void); | |
| #endif /* ! __AB_H__ */ |