public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39130]  New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
@ 2009-02-08  6:25 ykalidas at gmail dot com
  2009-02-08  6:29 ` [Bug c/39130] " ykalidas at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ykalidas at gmail dot com @ 2009-02-08  6:25 UTC (permalink / raw)
  To: gcc-bugs

Freshly compiled code calls and excutes a function in a non-existent library.

Details below :

#gcc -v
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11)

How to reproduce the problem :

#Directories required "./shared"

#source code head'ed below

==> 1.c <==
#include <stdio.h>

void fun() {
        printf("1\n");
}


==> 2.c <==
#include <stdio.h>

void fun() {
        printf("2\n");
}

#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char **argv) 
{
   void *lib_handle;
   void (*fn)();
   char *error;

while(1) {

   lib_handle = dlopen("./shared/libkali.so", RTLD_LAZY);
   if (!lib_handle) 
   {
      fprintf(stderr, "%s\n", dlerror());
      exit(1);
   }

   fn = dlsym(lib_handle, "fun");
   if ((error = dlerror()) != NULL)  
   {
      fprintf(stderr, "%s\n", error);
      exit(1);
   }

   (*fn)();

   dlclose(lib_handle);

}//while

   return 0;
}


#gcc -Wall -fPIC -c 1.c
#gcc -Wall -fPIC -c 2.c
#gcc -shared -Wl,-soname,lib1.so.1 -o lib1.so.1.0 1.o
#gcc -shared -Wl,-soname,lib2.so.1 -o lib2.so.1.0 2.o
#gcc -rdynamic -o progdl progdl.c -ldl

#Following shared library will be changed to test plug-in (lib1.so.1.0 or
lib2.so.1.0)

#ln -sf `pwd`/lib1.so.1.0 shared/libkali.so; ln -sf `pwd`/lib1.so.1.0
shared/libkali.so.1
#ln -sf `pwd`/lib2.so.1.0 shared/libkali.so; ln -sf `pwd`/lib2.so.1.0
shared/libkali.so.1


-- 
           Summary: [libdl] (Now and then) dynamic loading/un-loading of
                    shared libraries not happening
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ykalidas at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

* [Bug c/39130] [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
  2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
@ 2009-02-08  6:29 ` ykalidas at gmail dot com
  2009-02-08  6:30 ` ykalidas at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ykalidas at gmail dot com @ 2009-02-08  6:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ykalidas at gmail dot com  2009-02-08 06:29 -------
Created an attachment (id=17271)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17271&action=view)
Plug-in function

void fun(); is a function that would be made available through a shared object.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

* [Bug c/39130] [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
  2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
  2009-02-08  6:29 ` [Bug c/39130] " ykalidas at gmail dot com
  2009-02-08  6:30 ` ykalidas at gmail dot com
@ 2009-02-08  6:30 ` ykalidas at gmail dot com
  2009-02-08  6:47 ` ykalidas at gmail dot com
  2009-02-26 23:34 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: ykalidas at gmail dot com @ 2009-02-08  6:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ykalidas at gmail dot com  2009-02-08 06:29 -------
Created an attachment (id=17272)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17272&action=view)
Plug-in function

void fun(); would be made available through a shared object.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

* [Bug c/39130] [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
  2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
  2009-02-08  6:29 ` [Bug c/39130] " ykalidas at gmail dot com
@ 2009-02-08  6:30 ` ykalidas at gmail dot com
  2009-02-08  6:30 ` ykalidas at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ykalidas at gmail dot com @ 2009-02-08  6:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ykalidas at gmail dot com  2009-02-08 06:30 -------
Created an attachment (id=17273)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17273&action=view)
program invoking shared lib's function.

Program that loads the function in the shared library.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

* [Bug c/39130] [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
  2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
                   ` (2 preceding siblings ...)
  2009-02-08  6:30 ` ykalidas at gmail dot com
@ 2009-02-08  6:47 ` ykalidas at gmail dot com
  2009-02-26 23:34 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: ykalidas at gmail dot com @ 2009-02-08  6:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ykalidas at gmail dot com  2009-02-08 06:47 -------
PROBLEM -

when i change the libkali.so.1 and libkali.so in ./shared/ to point to either
of the libraries lib1.so.1.0 or lib2.so.1.0,

the program run only one of the codes to which it pointed earlier.

Example
#ln -sf `pwd`/lib1.so.1.0 shared/libkali.so; ln -sf `pwd`/lib1.so.1.0
shared/libkali.so.1
#./progdl would STILL INVOKE fun() in lib2.so.1.0 EVEN IF THE FILE IS REMOVED.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

* [Bug c/39130] [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening
  2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
                   ` (3 preceding siblings ...)
  2009-02-08  6:47 ` ykalidas at gmail dot com
@ 2009-02-26 23:34 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-26 23:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-02-26 23:34 -------
This is not a bug in GCC, GCC does not provide dlopen.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130


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

end of thread, other threads:[~2009-02-26 23:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-08  6:25 [Bug c/39130] New: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening ykalidas at gmail dot com
2009-02-08  6:29 ` [Bug c/39130] " ykalidas at gmail dot com
2009-02-08  6:30 ` ykalidas at gmail dot com
2009-02-08  6:30 ` ykalidas at gmail dot com
2009-02-08  6:47 ` ykalidas at gmail dot com
2009-02-26 23:34 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).