[fixed in 4.2] linker error with -fvisibility-inlines-hidden

Bug #109262 reported by Manuel Klimek
6
Affects Status Importance Assigned to Milestone
gcc-4.1 (Ubuntu)
Fix Released
Undecided
Matthias Klose

Bug Description

Stock feisty i386 install.
Compile the following small test program:

klimek@ew551l:~/temp$ cat test.cc
#include <string>

int main()
{
  std::string x;
  return 0;
}

klimek@ew551l:~/temp$ g++ -fvisibility-inlines-hidden -o test test.cc
/tmp/ccxS2ZNZ.o: In function `main':
test.cc:(.text+0x19): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'
test.cc:(.text+0x29): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/bin/ld: test: hidden symbol `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status

klimek@ew551l:~/temp$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

Revision history for this message
Matthias Klose (doko) wrote :

fixed in g++-4.2

Changed in gcc-4.1:
assignee: nobody → doko
status: Unconfirmed → In Progress
Revision history for this message
Francesco Montorsi (f18m-cpp217828) wrote :

I confirm this too (just hit this bug). It has been reported however that the same GCC version (4.1.2) compiled from vanilla sources does work correctly with that snippet of code.

Revision history for this message
Matthias Klose (doko) wrote :

4.2 is now the default compiler for hardy

Changed in gcc-4.1:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.