Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Solution to --> Re: dlopen() bug on Linux/Alpha
@ 1998-01-11  4:15 Dan Weeks
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Weeks @ 1998-01-11  4:15 UTC (permalink / raw)


Stefan Traby writes:
 > 
 > > We tried that one too.  We got the same results.  I beleive that
 > > "-export-dynamic" allows other dynamic libraries to see the symbols in 
 > > the one you are loading.  But that is just my understanding of it.
 > > 
 > > -danimal
 > 
 > Try to link the main (!) program with "-export-dynamic -shared"
 > 
 > > Stefan Traby writes:
 > >  > Hi Dan !
 > >  > 
 > >  > > Let me make a correction to this.  When the dlopen call is used it
 > >  > > does _not_ kill the executable, it only returns a null file handle.
 > >  > > When we use the exact same code on an SGI the shared library is opened 
 > >  > > and everything works fine.
 > >  > 
 > >  > The big question is, what "-ignore_unresolved" really does.
 > >  > Each dynamic library has a "dependency list".
 > >  > 
 > >  > Maybe "-ignore_unresolved" doesn't create dependency entries under Linux.
 > >  > This may cause runtime-linking to fail.
 > >  > 
 > >  > Try "-export-dynamic" 

Okay.  After the fantastic suggestion from Stefan Traby:

 ST: 'Try to link the main (!) program with "-export-dynamic -shared"'

rather than the dynamic library only we got dlopen to work.  This
might be the solution to GNU glibc PR number 387.  I am not going to
say it is a fix, but it is working for us.

To recap:
Red Hat Linux/Alpha 5.0
glibc 2.05.c build 13 from rpm
egec 1.0.1

Thanks everyone that gave suggestions and answers.  With your help we
got this "bug" that is really an error on our part fixed in a day.

-danimal

-- 
Dan Weeks <danimal@blueskystudios.com>
Blue Sky|VIFX http://www.blueskystudios.com/ http://www.vifx.com/
Harrison, New York 914/381.8400 - Los Angeles, California 310/822.8872
A Dan of many Sombreros!

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Solution to --&gt; Re: dlopen() bug on Linux/Alpha
@ 1998-01-11  8:59 Stefan Traby
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Traby @ 1998-01-11  8:59 UTC (permalink / raw)


Hi !

>  ST: 'Try to link the main (!) program with "-export-dynamic -shared"'
> 
> rather than the dynamic library only we got dlopen to work.  This
> might be the solution to GNU glibc PR number 387.  I am not going to
> say it is a fix, but it is working for us.

To maintainers: I don't have an AXP-machine and currently don't use gibc. 
Please check another special condition: Make a simple program
which does dlopen and dlsym (no, don't call main :-) on itself. 
Simplified I mean dlopen(argv[0],...) but argv[0] may not contain
the full path... 
Does it work ?
If and only if, why ? is (export == dlsym(, "export") in this special
case ?

Of corse this is a hack and not a real-world solution. On a non glibc 
GNU-Linux/i386 system, linking with "-shared" makes the 
program dump core _before_ main is called. SIGSEGV "#0 0x4 in ?? ()" 

The hack is simply based on a special, simplified point of view:
A program is a special case of an dynamic library. 
(it contains _start and main()). 
This may not be true and is not portable.

-- 
  ciao - 
    Stefan

Stefan Traby                            phone:  +43-3133-6107-2
Mitterlasznitzstr. 13                     fax:  +43-3133-6107-9
8302 Nestelbach                        mailto://stefan@sime.com
Austria

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Solution to --&gt; Re: dlopen() bug on Linux/Alpha
@ 1998-01-11 16:30 Richard Hadsell
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Hadsell @ 1998-01-11 16:30 UTC (permalink / raw)


Stefan Traby wrote:
> 
> Hi !
> 
> >  ST: 'Try to link the main (!) program with "-export-dynamic -shared"'
> >
> > rather than the dynamic library only we got dlopen to work.  This
> > might be the solution to GNU glibc PR number 387.  I am not going to
> > say it is a fix, but it is working for us.
> 
> To maintainers: I don't have an AXP-machine and currently don't use gibc.
> Please check another special condition: Make a simple program
> which does dlopen and dlsym (no, don't call main :-) on itself.
> Simplified I mean dlopen(argv[0],...) but argv[0] may not contain
> the full path...
> Does it work ?
> If and only if, why ? is (export == dlsym(, "export") in this special
> case ?
> 
> Of corse this is a hack and not a real-world solution. On a non glibc
> GNU-Linux/i386 system, linking with "-shared" makes the
> program dump core _before_ main is called. SIGSEGV "#0 0x4 in ?? ()"
> 
> The hack is simply based on a special, simplified point of view:
> A program is a special case of an dynamic library.
> (it contains _start and main()).
> This may not be true and is not portable.

I fixed the problem by using "-export-dynamic" when linking the
executable that calls dlopen().  I did not use "-shared".  The man page
for "ld" mentions that "-export-dynamic" is needed when using dlopen(),
but it doesn't say where it is needed.  I had incorrectly assumed it was
needed when building the shared library that would be linked by
dlopen(), because dlopen() and dlsym() would need to be able to see the
symbols defined in the library.  Instead, it seems to be equivalent to
the "-E" option on the HP-UX linker.

It would be nice for someone to improve the description of this option
on the man page.  Please pass this on to anyone who knows how to do
that.

Thanks for your help.

-- 
Dick Hadsell			914-381-8400  Fax: 914-381-9790
Reply-to:			hadsell@blueskystudios.com
Blue Sky | VIFX			http://www.blueskystudios.com
1 South Road, Harrison, NY 10528

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Solution to --&gt; Re: dlopen() bug on Linux/Alpha
@ 1998-01-11 17:00 N8YDAWG
  0 siblings, 0 replies; 4+ messages in thread
From: N8YDAWG @ 1998-01-11 17:00 UTC (permalink / raw)


wrong adress

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-01-11 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-01-11  8:59 Solution to --&gt; Re: dlopen() bug on Linux/Alpha Stefan Traby
  -- strict thread matches above, loose matches on Subject: below --
1998-01-11 17:00 N8YDAWG
1998-01-11 16:30 Richard Hadsell
1998-01-11  4:15 Dan Weeks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox