Comment 2 for bug 1489379

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2015-09-02 22:11 EDT-------
Today's work on this..

This is not so simple to "fix".

libchecktur.so really requires a dynamic libgcc because it uses pthreads (namely pthread_cancel).
it can go without a link-time dependency on libgcc *if* it's not built with -fexceptions.

it will run, but crash when pthread_cancel() is called.
I think this is already happening w/ other pieces of the code (libmultipath, iirc) - it's just luck it didn't crash yet.

Some testing/experiments.

$ cat test.c
#include <pthread.h>
#include <stdlib.h>

void * loop(void *arg) {
}

int main() {
pthread_t thread;
pthread_create(&thread, NULL, &loop, NULL);
pthread_cancel(thread); // this requires libgcc_s.so
return 0;
}

$ gcc -pthread -o test test.c

$ ./test; echo $?
0

$ ldd test
linux-vdso64.so.1 => (0x00003fff81730000)
libpthread.so.0 => /lib/powerpc64le-linux-gnu/libpthread.so.0 (0x00003fff816e0000)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x00003fff81500000)
/lib64/ld64.so.2 (0x0000000050130000)

^ notice there's no dependency on libgcc_s at link-time, it's a run-time dlopen() in pthread_cancel_init()

$ find /lib -name libgcc_s.so.1
/lib/powerpc64le-linux-gnu/libgcc_s.so.1

On installer:

~ # ./test
libgcc_s.so.1 must be installed for pthread_cancel to work
Aborted

~ # find /lib -name libgcc_s.so.1
~ #

To be continued.