This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/21041] New: Fix for bug 20019 causes linker errors for shared libraries using longjmp


https://sourceware.org/bugzilla/show_bug.cgi?id=21041

            Bug ID: 21041
           Summary: Fix for bug 20019 causes linker errors for shared
                    libraries using longjmp
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: pb at pbcl dot net
  Target Milestone: ---

The recent patch for bug 20019 causes an unfortunate effect when a shared
library that calls longjmp (but does not use libpthread) is linked into a
program that links -lpthread.

As a slight variation on the testcase for that bug:

$ cat main.c
void foo (void);

int
main ()
{
  foo ();
  return 0;
}

$ cat foo.c
void bar (void *dst, void *src);

void
foo (void)
{
  char dst[50];
  char src[50];
  bar (dst, src);
}

$ cat bar.c
#include <setjmp.h>

void
bar (void *dst, void *src)
{
        jmp_buf j;
        longjmp(j,1);
}

$ gcc -O2   -c -o main.o main.c
$ gcc -O2 -fPIC   -c -o foo.o foo.c
$ gcc -O2 -fPIC   -c -o bar.o bar.c
$ ld.gold -shared  -z now -o libbar.so bar.o
$ ld.gold -shared  -z now -o libfoo.so foo.o libbar.so
$ gcc -o foo main.o libfoo.so -Wl,-rpath,. -lpthread
$ ./foo
./foo: Relink `./libbar.so' with `libpthread.so.0' for IFUNC symbol `longjmp'

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]