[PATCH] S/390 Reverting the jmp_buf/ucontext_t ABI change

Stefan Liebler stli@linux.vnet.ibm.com
Tue Jul 29 10:23:00 GMT 2014


On 07/28/2014 05:30 PM, Andreas Schwab wrote:
 > Stefan Liebler <stli@linux.vnet.ibm.com> writes:
 >
 >> +weak_extern (__sigsetjmp);
 >
 > That should not be here.
 >
 > Andreas.
 >

simply removing weak_extern leads to
gcc -nostdlib -nostartfiles -r -o build/elf/librtld.map.o '-Wl,-(' 
build/elf/dl-allobjs.os build/libc_pic.a -lgcc '-Wl,-)' 
-Wl,-Map,build/elf/librtld.mapT
build/libc_pic.a(setjmp.os):(*IND*+0x0): multiple definition of 
`__sigsetjmp'
build/libc_pic.a(setjmp.os):(.text+0x18): first defined here
collect2: error: ld returned 1 exit status

and here is the output of
nm build/libc_pic.a
...
setjmp.os:
0000000000000008 T __GI__setjmp
0000000000000010 T __setjmp
                  U __sigjmp_save
0000000000000018 T __sigsetjmp
0000000000000018 T __sigsetjmp@@GLIBC_2.2
0000000000000018 T __sigsetjmp@GLIBC_2.19
0000000000000018 T __v1__sigsetjmp
0000000000000008 W __v1_setjmp
0000000000000000 W __v1setjmp
0000000000000018 T __v2__sigsetjmp
0000000000000008 W __v2_setjmp
0000000000000000 W __v2setjmp
0000000000000008 W _setjmp
0000000000000008 W _setjmp@@GLIBC_2.2
0000000000000008 W _setjmp@GLIBC_2.19
0000000000000000 W setjmp
0000000000000000 W setjmp@@GLIBC_2.2
0000000000000000 W setjmp@GLIBC_2.19
...

Here are the outputs with weak_extern (__sigsetjmp):

nm build/libc_pic.a
...
setjmp.os:
0000000000000008 T __GI__setjmp
0000000000000010 T __setjmp
                  U __sigjmp_save
0000000000000018 W __sigsetjmp
0000000000000018 T __sigsetjmp@@GLIBC_2.2
0000000000000018 T __sigsetjmp@GLIBC_2.19
0000000000000018 T __v1__sigsetjmp
0000000000000008 W __v1_setjmp
0000000000000000 W __v1setjmp
0000000000000018 T __v2__sigsetjmp
0000000000000008 W __v2_setjmp
0000000000000000 W __v2setjmp
0000000000000008 W _setjmp
0000000000000008 W _setjmp@@GLIBC_2.2
0000000000000008 W _setjmp@GLIBC_2.19
0000000000000000 W setjmp
0000000000000000 W setjmp@@GLIBC_2.2
0000000000000000 W setjmp@GLIBC_2.19
...

nm build/setjmp/setjmp.o
0000000000000010 T __setjmp
                  U __sigjmp_save
0000000000000018 T __sigsetjmp
0000000000000008 W _setjmp
0000000000000000 W setjmp

nm build/setjmp/rtld-setjmp.os
0000000000000010 T __setjmp
0000000000000018 T __sigsetjmp
0000000000000008 W _setjmp
0000000000000000 W setjmp

readelf --dyn-sym build/libc.so.6 | grep jmp
    258: 0000000000106bdc    84 FUNC    GLOBAL DEFAULT   12 
__longjmp_chk@@GLIBC_2.11
    260: 0000000000106bdc    84 FUNC    GLOBAL DEFAULT   12 
__longjmp_chk@GLIBC_2.19
    330: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
_longjmp@@GLIBC_2.2
    331: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
_longjmp@GLIBC_2.19
    667: 000000000003c1b0     8 FUNC    WEAK   DEFAULT   12 
setjmp@GLIBC_2.19
    668: 000000000003c1b0     8 FUNC    WEAK   DEFAULT   12 
setjmp@@GLIBC_2.2
   1051: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
longjmp@@GLIBC_2.2
   1052: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
longjmp@GLIBC_2.19
   1064: 000000000003c1b8     8 FUNC    WEAK   DEFAULT   12 
_setjmp@@GLIBC_2.2
   1065: 000000000003c1b8     8 FUNC    WEAK   DEFAULT   12 
_setjmp@GLIBC_2.19
   1124: 000000000003c1c8    84 FUNC    GLOBAL DEFAULT   12 
__sigsetjmp@@GLIBC_2.2
   1125: 000000000003c1c8    84 FUNC    GLOBAL DEFAULT   12 
__sigsetjmp@GLIBC_2.19
   1278: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
siglongjmp@GLIBC_2.19
   1282: 000000000003c274    84 FUNC    WEAK   DEFAULT   12 
siglongjmp@@GLIBC_2.2
   1764: 000000000003c274    84 FUNC    GLOBAL DEFAULT   12 
__libc_siglongjmp@@GLIBC_PRIVATE
   2260: 000000000003c274    84 FUNC    GLOBAL DEFAULT   12 
__libc_longjmp@@GLIBC_PRIVATE



To get rid of the "multiple definition of `__sigsetjmp'" error without 
weak_extern(__sigsetjmp), we have to use a different name for 
__sigsetjmp. The changed setjmp.S file could be:
...
#if !defined IS_IN_rtld
# if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
#define __sigsetjmp __dummy_sigsetjmp
# endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, 
GLIBC_2_20)  */
#endif /* !defined IS_IN_rtld  */

ENTRY(__sigsetjmp)
.Linternal_sigsetjmp:

...

#if !defined IS_IN_rtld
# if defined SHARED &&  SHLIB_COMPAT (libc, GLIBC_2_19, GLIBC_2_20)
...
/* weak_extern (__sigsetjmp); */
strong_alias (__sigsetjmp, __v1__sigsetjmp);
strong_alias (__sigsetjmp, __v2__sigsetjmp);
#undef __sigsetjmp
versioned_symbol (libc, __v1__sigsetjmp, __sigsetjmp, GLIBC_2_0);
compat_symbol (libc, __v2__sigsetjmp, __sigsetjmp, GLIBC_2_19);
# endif /* if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_19, 
GLIBC_2_20)  */
#endif /* if !defined IS_IN_rtld  */


Then the symbols are
nm build/setjmp/setjmp.os
0000000000000008 T __GI__setjmp
0000000000000018 T __dummy_sigsetjmp
0000000000000010 T __setjmp
                  U __sigjmp_save
0000000000000018 T __sigsetjmp@@GLIBC_2.2
0000000000000018 T __sigsetjmp@GLIBC_2.19
0000000000000018 T __v1__sigsetjmp
0000000000000008 W __v1_setjmp
0000000000000000 W __v1setjmp
0000000000000018 T __v2__sigsetjmp
0000000000000008 W __v2_setjmp
0000000000000000 W __v2setjmp
0000000000000008 W _setjmp
0000000000000008 W _setjmp@@GLIBC_2.2
0000000000000008 W _setjmp@GLIBC_2.19
0000000000000000 W setjmp
0000000000000000 W setjmp@@GLIBC_2.2
0000000000000000 W setjmp@GLIBC_2.19

The other outputs are the same.

Any opinion?

Bye



More information about the Libc-alpha mailing list