Created attachment 11191 [details] call sem_timedwait failed when act like below: 1. calling sem_timedwait in shared lib, and the shrared lib linked without -lpthread; 2. the main program linked with -lptherad; then, the sem_timedwait is failed. this happend on x86 and mips. the sample: sem_mai.c #include <stdio.h> extern void testsem(); int main() { printf("=== main start\n"); testsem(); printf("=== end\n"); }
See bug 20489 comment 16. Objects need to be linked at the right library, or otherwise the symbol version information will be missing. *** This bug has been marked as a duplicate of bug 20489 ***
(In reply to Florian Weimer from comment #1) > See bug 20489 comment 16. Objects need to be linked at the right library, > or otherwise the symbol version information will be missing. > > *** This bug has been marked as a duplicate of bug 20489 *** sometimes, we hope the DSO haveing no the symbol version, then it can run on different environment. I think the sem_timedwait need to fix. the reason are: 1. the compatibility sem_init use old_sem structure; 2. the sem_timedwait use new_sem structure; 3. in https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/internaltypes.h;h=7c0d2402a3a68eec0b9849e4b6b52287f65d3f54;hb=042e1521c794a945edc43b5bfa7e69ad70420524, the new_sem have changed. Wait flag bit has be added to the value field. so, the sem_timedwait needs compatibility version symbol useing old_sem structure.
Sorry, the DSO is simply broken. It is quite literally calling the wrong function.