[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtool 1.5.10 fails nopic test on Solaris
From: |
Ralf Menzel |
Subject: |
libtool 1.5.10 fails nopic test on Solaris |
Date: |
Wed, 29 Sep 2004 19:10:44 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Reasonable Discussion, usg-unix-v) |
Hello,
I'm using libtool 1.5.10 on SPARC/Solaris 2.9. The compiler is
gcc 3.4.2. The linker is /usr/ccs/bin/ld. With this environment `make
check' passes all but one test:
--- snip ---
[...]
PASS: demo-nopic.test
FAIL: demo-make.test
[...]
--- snip ---
Here is what I get when I invoke demo-make.test after I have invoked
demo-nopic.test:
--- snip ---
=== Running demo-make.test
Making in ../demo
/bin/bash ./libtool --mode=compile --tag=CC gcc -DPACKAGE_NAME=\"demo\"
-DPACKAGE_TARNAME=\"demo\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"demo\
1.0\" -DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\"
-DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1
-DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
-o libhello_la-hello.lo `test -f 'hello.c' || echo
'/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo/'`hello.c
mkdir .libs
gcc -DPACKAGE_NAME=\"demo\" -DPACKAGE_TARNAME=\"demo\"
-DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"demo 1.0\""
-DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\" -DVERSION=\"1.0\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
hello.c -o .libs/libhello_la-hello.o
gcc -DPACKAGE_NAME=\"demo\" -DPACKAGE_TARNAME=\"demo\"
-DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"demo 1.0\""
-DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\" -DVERSION=\"1.0\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
hello.c -o libhello_la-hello.o >/dev/null 2>&1
/bin/bash ./libtool --mode=compile --tag=CC gcc -DPACKAGE_NAME=\"demo\"
-DPACKAGE_TARNAME=\"demo\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"demo\
1.0\" -DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\"
-DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1
-DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
-o libhello_la-foo.lo `test -f 'foo.c' || echo
'/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo/'`foo.c
gcc -DPACKAGE_NAME=\"demo\" -DPACKAGE_TARNAME=\"demo\"
-DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"demo 1.0\""
-DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\" -DVERSION=\"1.0\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
foo.c -o .libs/libhello_la-foo.o
gcc -DPACKAGE_NAME=\"demo\" -DPACKAGE_TARNAME=\"demo\"
-DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"demo 1.0\""
-DPACKAGE_BUGREPORT=\"address@hidden" -DPACKAGE=\"demo\" -DVERSION=\"1.0\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -I.
-I/home-local/menzel/src/testing/gcc/libtool-1.5.10/tests/../demo -g -O2 -c
foo.c -o libhello_la-foo.o >/dev/null 2>&1
/bin/bash ./libtool --mode=link --tag=CC gcc -g -O2
-L/home/crew/menzel/sw5.9-gcc3.4.2/lib -R/home/crew/menzel/sw5.9-gcc3.4.2/lib
-o libhello.la -rpath /usr/local/lib -no-undefined -version-info 3:12:1
libhello_la-hello.lo libhello_la-foo.lo -lm
gcc -shared -Wl,-h -Wl,libhello.so.2 -o .libs/libhello.so.2.1.12
.libs/libhello_la-hello.o .libs/libhello_la-foo.o
-R/home/crew/menzel/sw5.9-gcc3.4.2/lib -L/home/crew/menzel/sw5.9-gcc3.4.2/lib
-lm -lc
Text relocation remains referenced
against symbol offset in file
<unknown> 0x4 .libs/libhello_la-hello.o
<unknown> 0x8 .libs/libhello_la-hello.o
<unknown> 0x4 .libs/libhello_la-foo.o
<unknown> 0x8 .libs/libhello_la-foo.o
<unknown> 0xc .libs/libhello_la-foo.o
<unknown> 0x10 .libs/libhello_la-foo.o
<unknown> 0x18 .libs/libhello_la-foo.o
puts 0xc .libs/libhello_la-hello.o
printf 0x14 .libs/libhello_la-foo.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
make: *** [libhello.la] Error 1
--- snip ---
I tried to find out what is happening here and came up with the
following: Invoking gcc with the `-shared' option causes gcc to pass
the `-z text' to the linker. This option causes the linker to produce
the fatal error above. I suggest to add the option `-mimpure-text' to
the option `-shared'.
While I was looking in this I found that the variable
no_undefined_flag is set to ' -z text'. Shouldn't the be ' -z defs'?
As a test I made both changes in libtool.m4 and ran `make check'
again. All tests were passed. I have attached a diff of the changed
libtool.m4.
Here are the relevant sections of the man pages:
--- snip: gcc man page ---
[...]
-mimpure-text
-mimpure-text, used in addition to -shared, tells the
compiler to not pass -z text to the linker when linking
a shared object. Using this option, you can link
position-dependent code into a shared object.
-mimpure-text suppresses the ``relocations remain
against allocatable but non-writable sections'' linker
error message. However, the necessary relocations will
trigger copy-on-write, and the shared object is not
actually shared across processes. Instead of using
-mimpure-text, you should compile all source code with
-fpic or -fPIC.
This option is only available on SunOS and Solaris.
[...]
--- snip ---
--- snip: ld man page ---
[...]
-z defs | nodefs
The -z defs option forces a fatal error if any unde-
fined symbols remain at the end of the link. This is
the default when an executable is built, but for his-
toric reasons is not the default when building a
shared object. Use of the -z defs option is recom-
mended, as it assures the object being built is self-
contained, that is, that all its symbolic references
are resolved internally or to the object's immediate
dependencies.
The -z nodefs option allows undefined symbols. For
historic reasons, this is the default when a shared
object is built. When used with executables, the
behavior of references to such undefined symbols is
unspecified. Use of the -z nodefs option is not recom-
mended
[...]
-z text
In dynamic mode only, forces a fatal error if any
relocations against non-writable, allocatable sections
remain. For historic reasons, this is not the default
when building an executable or shared object. However,
its use is recommended to insure that the text segment
of the dynamic object being built is shareable between
multiple running processes, and that the object incurs
the least relocation overhead when loaded into memory.
[...]
--- snip ---
Bye,
Ralf Menzel
--- libtool-1.5.10/libtool.m4 2004-09-19 14:15:08.000000000 +0200
+++ libtool-1.5.10-patched/libtool.m4 2004-09-20 17:13:54.000000000 +0200
@@ -5691,11 +5691,11 @@
;;
solaris*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z defs'
if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o
$lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -mimpure-text ${wl}-h
${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" >
$lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo
"local: *; };" >> $lib.exp~
- $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib
$libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ $CC -shared -mimpure-text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname
-o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
else
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h
$soname -o $lib $libobjs $deplibs $linker_flags'
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" >
$lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo
"local: *; };" >> $lib.exp~
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- libtool 1.5.10 fails nopic test on Solaris,
Ralf Menzel <=