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] Fix for bug 20019 causes linker errors for shared libraries using longjmp


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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Here is an example:

[hjl@gnu-6 pr21041b]$ cat bar.c
extern void xxx (void);

void
bar (void)
{
  xxx ();
}
[hjl@gnu-6 pr21041b]$ cat foo.c
extern void bar (void);

void
foo (void)
{
  bar ();
}
[hjl@gnu-6 pr21041b]$ cat ifunc.c 
extern void real_xxx (void);

static void *
xxx_resolver ()
{
  return &real_xxx;
}

extern void xxx (void) __attribute__ ((ifunc ("xxx_resolver")));
[hjl@gnu-6 pr21041b]$ cat xxx.c 
void
xxx (void)
{
}

__typeof (xxx) real_xxx __attribute__ ((alias("xxx")));
[hjl@gnu-6 pr21041b]$ cat main.c
void foo (void);

int
main ()
{
  foo ();
  return 0;
}
[hjl@gnu-6 pr21041b]$ make
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.bfd -shared -z now -o libbar.so bar.o
ld.bfd -shared -z now -o libfoo.so foo.o libbar.so
gcc -O2 -fPIC   -c -o ifunc.o ifunc.c
gcc -O2   -c -o xxx.o xxx.c
ld.bfd -shared -o libxxx.so xxx.o
ld.bfd -shared -o libifunc.so ifunc.o libxxx.so
gcc -o x main.o libfoo.so libifunc.so libxxx.so -Wl,-rpath,.
gcc -o y main.o libfoo.so libxxx.so -Wl,-rpath,.
./y
./x
Makefile:10: recipe for target 'all' failed
make: *** [all] Segmentation fault
[hjl@gnu-6 pr21041b]$

-- 
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]