This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

target/2203: dlopen() crashes on AIX when compiling with g++



>Number:         2203
>Category:       target
>Synopsis:       dlopen() crashes on AIX when compiling with g++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 07 05:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Göran Uddeborg
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
AIX 4.3.2
IBM RS/6000 43P/140 (333 MHz MPC604e CPU) 
gcc configured with --enable-shared --prefix=/opt/gnu
>Description:
I can't use dlopen() in a program I compile with g++ 2.95.2.
It appears to crash in some initialisation done by dlopen(),
but I don't quite understand why.  Nor what to do about it.
Any help/pointers/ideas would be appreciated.

Since I don't quite understand why this goes wrong, I can't
be sure it is an error in the compiler.  But it does work
with IBM's xlC, so it is at least compiler RELATED.

I've tried gcc configured without "--enable-shared" too,
with any apparent difference.
>How-To-Repeat:
I compile the attached program with
  g++ -g -o sample-main -Wl,-brtl sample-main.cc

Then I create a file "shared.cc" with the single line
  int i;
and compile it with
  g++ -g -o shared.so -shared shared.cc
This generates four warnings (which I don't understand
either)
  ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DI
  ld: 0711-224 WARNING: Duplicate symbol: ._GLOBAL__DD
  ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DI
  ld: 0711-224 WARNING: Duplicate symbol: _GLOBAL__DD
  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

Now, running sample-main stops in a segmentation violation.
A stack trace looks like this:
(gdb) bt
#0  0xd0442bac in ostream_withassign::operator= ()
#1  0xd0453ae4 in Iostream_init::__ct ()
#2  0xd0453850 in __sinit64_x_2fu_5fC_2b_2b_2fmcnamara_2fuslppk299_2fstream_2fcstreams_2ec ()
#3  0xd045fd28 in initialize_one_library ()
#4  0xd045efc0 in initialize_libs ()
#5  0xd045f644 in grab_orig_libs ()
#6  0xd0460488 in loadAndInit ()
#7  0xd0246fb4 in dlopen ()
#8  0x10000370 in main (argc=1, argv=0x2ff22498) at sample-main.cc:8
#9  0x100001dc in __start ()
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="sample-main.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="sample-main.cc"

Ly8gVGhlIGVzc2VudGlhbCBwYXJ0IG9mIHdoYXQgd2UgZ2V0IHdoZW4gd2UgZG8gIiNpbmNsdWRl
IDxkbGZjbi5oPiIKZXh0ZXJuICJDIiB7CmV4dGVybiB2b2lkCSpkbG9wZW4oY29uc3QgY2hhciAq
LCBpbnQpOwp9CgptYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgCnsKICB2b2lkICpoYW5kbGUg
PSBkbG9wZW4oIi4vc2hhcmVkLnNvIiwgMHgwMDAwMDAwNCApOwogIHJldHVybiAwOwp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]