--- Begin Message ---
- From: wuxi <wuxi at fudan dot edu dot cn>
- To: libc-help at sourceware dot org
- Date: Mon, 18 Aug 2008 00:07:42 +0800
- Subject: Adding a new sub directory and new function
I am doing a research project and need to add a new function, namely
SHIFT_sigaction. All the work is done on Glibc-2.5, x86 32 bit machine
For that purpose, I create a subdir, corresponding C file
shift_sigaction.c and Version file to export shift_sigaction.
Most of the code is copied from __libc_sigaction from
"sysdeps/unix/sysv/linux/i386", except changing the declaration of
"restore" and "restore_rt" to extern ones.
However, when it compiles, the following error occurs:
" gcc -nostdlib -nostartfiles -r *-o
/home/wuxi/Soft/glibc-2.5/build/libc_pic.os* \
-Wl,-d -Wl,--whole-archive
/home/wuxi/Soft/glibc-2.5/build/libc_pic.a
gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs
-Wl,-dynamic-linker=/home/wuxi/Soft/glibc-2.5/install//lib/ld-linux.so.2
-B/home/wuxi/Soft/glibc-2.5/build/csu/
-Wl,--version-script=/home/wuxi/Soft/glibc-2.5/build/libc.map
-Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro
-Wl,--hash-style=both -nostdlib -nostartfiles -e __libc_main
-L/home/wuxi/Soft/glibc-2.5/build -L/home/wuxi/Soft/glibc-2.5/build/math
-L/home/wuxi/Soft/glibc-2.5/build/elf
-L/home/wuxi/Soft/glibc-2.5/build/dlfcn
-L/home/wuxi/Soft/glibc-2.5/build/nss
-L/home/wuxi/Soft/glibc-2.5/build/nis
-L/home/wuxi/Soft/glibc-2.5/build/rt
-L/home/wuxi/Soft/glibc-2.5/build/resolv
-L/home/wuxi/Soft/glibc-2.5/build/crypt
-L/home/wuxi/Soft/glibc-2.5/build/nptl
-Wl,-rpath-link=/home/wuxi/Soft/glibc-2.5/build:/home/wuxi/Soft/glibc-2.5/build/math:/home/wuxi/Soft/glibc-2.5/build/elf:/home/wuxi/Soft/glibc-2.5/build/dlfcn:/home/wuxi/Soft/glibc-2.5/build/nss:/home/wuxi/Soft/glibc-2.5/build/nis:/home/wuxi/Soft/glibc-2.5/build/rt:/home/wuxi/Soft/glibc-2.5/build/resolv:/home/wuxi/Soft/glibc-2.5/build/crypt:/home/wuxi/Soft/glibc-2.5/build/nptl
*-o /home/wuxi/Soft/glibc-2.5/build/libc.so* -T
/home/wuxi/Soft/glibc-2.5/build/shlib.lds
/home/wuxi/Soft/glibc-2.5/build/csu/abi-note.o
/home/wuxi/Soft/glibc-2.5/build/elf/soinit.os
/home/wuxi/Soft/glibc-2.5/build/libc_pic.os
/home/wuxi/Soft/glibc-2.5/build/elf/sofini.os
/home/wuxi/Soft/glibc-2.5/build/elf/interp.os
/home/wuxi/Soft/glibc-2.5/build/elf/ld.so -lgcc
/home/wuxi/Soft/glibc-2.5/build/libc_pic.os: In function `shift_sigaction':
*/home/wuxi/Soft/glibc-2.5/src/shift/shift_sigaction.c:139: undefined
reference to `__restore'
/home/wuxi/Soft/glibc-2.5/src/shift/shift_sigaction.c:100: undefined
reference to `__restore_rt'
/home/wuxi/Soft/glibc-2.5/src/shift/shift_sigaction.c:100: undefined
reference to `__restore'*
"
I found __restore was defined in libc_pic.os:
nm libc_pic.os | grep '__restore'
000132a8 t __restore
U __restore
000132a0 t __restore_rt
U __restore_rt
So how to make the gcc find '__restore' and '__restore_rt'? Am I missing
something here? __libc_sigaction also uses these two symbols, why can it
find __restore and __restore_rt?
Thanks !
Yours sincerely
Andrew
--- End Message ---