This is the mail archive of the gcc-prs@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]

c/3982: Incorrect Initialization in shared objects on Solaris (Regression to 2.95.3)



>Number:         3982
>Category:       c
>Synopsis:       Incorrect Initialization in shared objects on Solaris 2.7
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 10 05:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.1 20010807 (prerelease)
>Organization:
>Environment:
System: SunOS rumba 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: ../gcc/configure --prefix=/home/kahlert/GCC --enable-languages=c++,f77,java --enable-threads=posix --with-gnu-as --with-gnu-ld
>Description:
The problem was reported by Jim Liu in the newsgroup gnu.gcc.help.
I verified it using the latest snapshots:
- The program works on Linux with 3.0.1 prerelease.
- It works on Solaris 2.7 using gcc-2.95.3.
- It fails on Solaris 2.7 using gcc-3.0.1 prerelease
- According to Jim Liu it fails with gcc-3.0 on Solaris-2.7
  and works with 3.0 for Solaris 2.8.
I could not check gcc-3.0.1 on Solaris 2.8, because i do not have access 
to such a machine.

>How-To-Repeat:
cat myso.c
#include <string.h>
#include <stdio.h>

char *p = "Test Message";

int GlobalLength()
{  
   return(strlen(p));
}


cat main.c
#include <stdio.h>

extern int GlobalLength();

int main()
{   
   printf("global length==%d\n",  GlobalLength());
}

gcc -fPIC -shared -o libmyso.so myso.c
gcc -o main main.c -L. -lmyso
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:.
./main
Segmentation fault
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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