This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/4435: undefined or misdefined symbol
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/4435: undefined or misdefined symbol
- From: george at sun01 dot elity dot net
- Date: Mon, 1 Oct 2001 11:44:43 -0400 (EDT)
- Reply-To: gsicherm at elity dot com
>Number: 4435
>Category: libstdc++
>Synopsis: Object file has undefined basic_string symbol as local.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Mon Oct 01 08:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: G. L. Sicherman
>Release: 3.0.1
>Organization:
Lucent Technologies
>Environment:
System: AIX aocsmro3 3 4 000383244C00
Architecture: powerpc-ibm
host: aix4.3.3.0
build: aix4.3.3.0
target: aix4.3.3.0
configured with: /home/gcc/gcc-3.0.1/configure --with-gcc-version-trigger=/home/gcc/gcc-3.0.1/gcc/version.c --host=powerpc-ibm-aix4.3.3.0 --without-java --without-zlib --without-info --norecursion
>Description:
A simple C++ program tries to access the private symbol
_Rep::_max_size in the basic_string module. Here is the
loadmap output:
(ld): halt 4
(ld): setopt r/o->w
(ld): setopt nodelcsect
(ld): savename a.out
(ld): filelist 8 2
(ld): i /lib/crt0.o
(ld): i /tmp/cccZ9m7a.o
(ld): i /tmp/ccECfIAF.o
(ld): lib /usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.0.1/../../../libstdc++.a
(ld): lib /usr/lib/libm.a
(ld): lib /usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.0.1/../../../libgcc_s.a
(ld): i /usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.0.1/libgcc.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libstdc++.a[libstdc++.so.3]: 1247 symbols imported.
LIBRARY: Shared object libgcc_s.a[shr.o]: 88 symbols imported.
LIBRARY: Shared object libc.a[shr.o]: 2206 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 11 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 78 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 8
(ld): exports /tmp/cc0MalCI.x
EXPORTS: Symbols exported: 32
(ld): initfini _GLOBAL__FI_a_out _GLOBAL__FD_a_out
(ld): resolve
RESOLVE: 160 of 4936 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 34 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
Symbol Inpndx TY CL Source-File(Object-File) OR Import-File{Shared-object}
RLD: Address Section Rld-type Referencing Symbol
----------------------------------------------------------------------------------------------
_ZNSs4_Rep11_S_max_sizeE [52] ER RW try.C(/tmp/ccECfIAF.o)
00005d48 .data R_POS [542] <_ZNSs4_Rep11_S_max_sizeE>
.pthread_mutex_lock [94] ER PR try.C(/tmp/ccECfIAF.o)
000047fc .text R_RBR [296] <._Z20__gthread_mutex_lockP15pthread_mutex_t>
.pthread_mutex_unlock [96] ER PR try.C(/tmp/ccECfIAF.o)
00004894 .text R_RBR [298] <._Z22__gthread_mutex_unlockP15pthread_mutex_t>
ER: The return code is 8.
Moreover, the output of "nm try.o | fgrep _S_max_size" identifies
the symbol _ZNSs4_Rep11_S_max_sizeE in one place as undefined, and
in another as local data:
_ZNSs4_Rep11_S_max_sizeE U -
_ZNSs4_Rep11_S_max_sizeE d 23880 4
So far as I can tell, this symbol is not defined in the module.
It does not appear as a definition in the assembler output.
>How-To-Repeat:
I compiled this simple C++ file try.C:
#include <iostream.h>
main()
{
cout << "hello, world\n";
}
This was the compiler command:
g++ -Wl,-bloadmap:/tmp/loadmap try.C -lstdc++
>Fix:
None known. I suspect that this statement in the _InputIterator
template in basic_string.h is at fault:
size_type
max_size() const { return _Rep::_S_max_size; }
If the variable _S_max_size is private to struct _Rep,
how can you hope to access it like this? This should
probably be _Rep::max_size(), which is a public function.
Maybe it's a template problem. I see this statement
in the preprocessor output, but not in the preprocessor
output of g++ 3.0 under Solaris 2.8, though it's still
in bits/basic_string.h.
>Release-Note:
>Audit-Trail:
>Unformatted: