public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Shared C++ libs on i386-pc-solaris2.5.1
@ 1997-09-07  5:42 James Macnicol
  1997-09-07 10:11 ` H.J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: James Macnicol @ 1997-09-07  5:42 UTC (permalink / raw)
  To: egcs

>        Has anyone managed to build egcs under Solaris x86 2.5.1?
>        I cannot get any shared C++ libraries to link (including the
>        libstdc++.so that is built as part of the distribution -- see below),
>
>Looks like this is a bug in the gcc x86/solaris support.  The shared library
>support is not completely correct (a common problem).  I do not have access
>to such a system, so I can't be sure what the correct fix is.  However, just
>comparing against the sparc/solaris support, I am guessing that libgcc.a was
>not compiled PIC.
>
>Does this patch solve your problem?

	Sure does.  Thanks!

	I have now successfully built egcs 970904 on Solaris x86 2.5.1.  Some
comments/observations I have are :

-	I had problems with compiling a certain file in my current project
since the machine would start thrashing and eventually say "virtual
memory
exhausted".  I traced it to a C++ header file which had an inline member
function; moving that out of the header and into the implementation
solved
the problem.  On a better note, this project now builds without the
internal
compiler errors it has with gcc 2.7.2.2.

-	Doing make -j4 MAKE="make -j4" for the egcs build (i.e. a parallel
build)
still causes problems although it seems better than the previous
releases I
tried to build.

-	Tcl 8.0 will not build with egcs-970904 since "__ctype" is not found
by
the linker.  Tcl 8.0 compiles fine with gcc 2.7.2.2.



Thanks.


James


--
James Macnicol
J.Macnicol@student.anu.edu.au
http://goblet.anu.edu.au/~m9305357/home.html

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
  1997-09-07  5:42 Shared C++ libs on i386-pc-solaris2.5.1 James Macnicol
@ 1997-09-07 10:11 ` H.J. Lu
  0 siblings, 0 replies; 9+ messages in thread
From: H.J. Lu @ 1997-09-07 10:11 UTC (permalink / raw)
  To: James Macnicol; +Cc: egcs

> 
> -	Doing make -j4 MAKE="make -j4" for the egcs build (i.e. a parallel
> build)
> still causes problems although it seems better than the previous
> releases I
> tried to build.
> 

I have no problems with -j 6 on my SMP box. But I have sent in
quite a few patches to fix it. Among them, 2 are left out:


Tue Aug 26 07:43:18 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)

        * Makefile.in (check-g++): Set/export LD_LIBRARY_PATH if necessary.
        (testsuite/site.exp): New target.
        (check-gcc, check-g++): Depend on testsuite/site.exp.
        Don't stop for failure.

Mon Aug 25 17:31:49 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)

        * Makefile (all): Remove sub-all.
        (stmp-sub-all): New target. Renamed from sub-all.
        (info, texinfo): Also depend on stmp-sub-all.
        (clean): Also remove stmp*.
        (maintainer-clean): New target. Same as realclean.

If you check egcs archive, you should be able to find them.



H.J.

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
  1997-09-11 10:01   ` Jeffrey A Law
@ 1997-09-11 13:20     ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1997-09-11 13:20 UTC (permalink / raw)
  To: law; +Cc: m9305357, egcs

> On some systems (PAs running hpux), you can't have a text/readonly data
> item which is initialized to the address of another item.
> 
> ie
> 
> 	.word foo
> 
> isn't valid if it's going into the text or readonly data section.

This is not the case on an i386 ELF system.

In the main application there is a nasty hack called .dynbss which the
linker creates to hold all of the variable references.  So the symbols
are really at constant addresses, and have their contents filled in at
run time.  (It is odeious and breaks when symbol sizes (read arrays)
change.)

A shared library, on the other hand, is tagged with DT_TEXTREL which
tells the loader that it should temporarily remap everything read-write.
Thus, while outputting read-only data that contains relocactions should
be avoided (because of the mprotect penalty), it does function correctly.

All this is if course how things are _supposed_ to work.  If you've got
a broken loader on some system...


r~

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
  1997-09-10 22:37 ` James Macnicol
@ 1997-09-11 10:01   ` Jeffrey A Law
  1997-09-11 13:20     ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 1997-09-11 10:01 UTC (permalink / raw)
  To: James Macnicol; +Cc: egcs

  In message < 34174E74.7057@bohm.anu.edu.au >you write:
  > > Gcc is emitting a reference to __ctype into the constant pool.  This is
  > > a place where constants are stored if they aren't valid as immediates in
  > > an instruction.  This is for instance where floating point constants are
  > > stored.
[ ... ]
  > > 
  > > Tue Sep  9 16:29:42 1997  Jim Wilson  <wilson@cygnus.com>
  > > 
  > >         * i386/sco5.h (READONLY_DATA_SECTION): Define.
[ ... ]

  > 	Alas, this isn't the solution for i386-pc-solaris2.5.1.
  > READONLY_DATA_SECTION() is already defined as above in 
  > gcc/config/i386/svr4.h which is included in the Solaris x86 config.
Hmmmm.

On some systems (PAs running hpux), you can't have a text/readonly data
item which is initialized to the address of another item.

ie

	.word foo

isn't valid if it's going into the text or readonly data section.

This is becaue the dynamic linker can't modify that memory location
at runtime if "foo" is resolved from a shared library.

Maybe you're running into a similar problem.

Jeff

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
       [not found] <199709100139.SAA07609@cygnus.com>
  1997-09-09 19:54 ` James Macnicol
@ 1997-09-10 22:37 ` James Macnicol
  1997-09-11 10:01   ` Jeffrey A Law
  1 sibling, 1 reply; 9+ messages in thread
From: James Macnicol @ 1997-09-10 22:37 UTC (permalink / raw)
  To: egcs

>         -Tcl 8.0 will not build with egcs-970904 since "__ctype" is not found
>         by
>         the linker.  Tcl 8.0 compiles fine with gcc 2.7.2.2.
> 
> I was just discussing a similar problem with one of the i386-sco5 users.
> Was this a shared library build?  The following info may be useful.
> 
> --
> 
> Gcc is emitting a reference to __ctype into the constant pool.  This is
> a place where constants are stored if they aren't valid as immediates in
> an instruction.  This is for instance where floating point constants are
> stored.
> 
> This is happening because of a change to the cse pass, which is causing
> some constants to be forced into the constant pool that weren't before.
> This is a somewhat questionable optimization, since it may increase the
> size of the program without giving faster code.  In any case, if you compile
> with -O2, the constant pool itself is optimized, and unused constants are
> removed.  So this problem goes away at -O2.
> 
> This constant pool entry should have gone into the the readonly data section
> (or into the data section), instead of the default text section.
> 
> This change was copied from the svr4.h file, so I suspect that it will
> fix your problem.
> 
> If not, then try the definition of SELECT_RTX_SECTION from sparc/sysv4.h.
> This will put the constant pool entry into the data section.
> 
> Tue Sep  9 16:29:42 1997  Jim Wilson  <wilson@cygnus.com>
> 
>         * i386/sco5.h (READONLY_DATA_SECTION): Define.
> 
> Index: sco5.h
> ===================================================================
> RCS file: /cvs/cvsfiles/egcs/gcc/config/i386/sco5.h,v
> retrieving revision 1.1.1.1
> diff -p -r1.1.1.1 sco5.h
> *** sco5.h      1997/08/11 15:57:18     1.1.1.1
> --- sco5.h      1997/09/09 23:27:54
> *************** do {                                                                    \
> *** 573,578 ****
> --- 573,580 ----
>     CTORS_SECTION_FUNCTION                                              \
>     DTORS_SECTION_FUNCTION
> 
> + #define READONLY_DATA_SECTION() const_section ()
> +
>   #undef CONST_SECTION_FUNCTION
>   #define CONST_SECTION_FUNCTION                                                \
>   void                                                                  \

	Alas, this isn't the solution for i386-pc-solaris2.5.1.
READONLY_DATA_SECTION() is already defined as above in 
gcc/config/i386/svr4.h which is included in the Solaris x86 config.

	Rebuilding Tcl 8.0 with -O2 also does not remove the
error.

	Something I forgot in the original post was to say that
gcc/objc/archive.c needs a dose of <stdarg.h> to pick up the va_*
macros.



James

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
       [not found] <199709100139.SAA07609@cygnus.com>
@ 1997-09-09 19:54 ` James Macnicol
  1997-09-10 22:37 ` James Macnicol
  1 sibling, 0 replies; 9+ messages in thread
From: James Macnicol @ 1997-09-09 19:54 UTC (permalink / raw)
  To: egcs; +Cc: Jim Wilson

>         -I had problems with compiling a certain file in my current project
>         since the machine would start thrashing and eventually say "virtual
>         memory
>         exhausted".  I traced it to a C++ header file which had an inline member
>         function; moving that out of the header and into the implementation
>         solved
>         the problem.  On a better note, this project now builds without the
>         internal
>         compiler errors it has with gcc 2.7.2.2.
> 
> I don't know enough about C++ to handle C++ specific problems.  If you
> submit a testcase, you might be able to get a response from one of the
> other volunteers.

	I have since determined it's an STL-related problem.  Even in
implementation files, calls to the push_back member of "list" cause
this problem.  The cases I have seen are when pushing types I have
written (i.e. not standard types).  I'm sorry I can't give any more
detail than that at this stage.  I'll see if I can come up with
something.

	I will report tomorrow on the shared libraries stuff with
Tcl on Solaris x86.



James


P.S.  My apologies to Jim Wilson .... I meant the last message to go
to the list, not to him personally.  I will check my To: and Cc:
lines more carefully next time.

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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
  1997-09-04 15:05 ` Jim Wilson
@ 1997-09-04 16:55   ` Jeffrey A Law
  0 siblings, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 1997-09-04 16:55 UTC (permalink / raw)
  To: Jim Wilson; +Cc: James Macnicol, egcs

  In message < 199709042205.PAA24609@cygnus.com >you write:
  > Looks like this is a bug in the gcc x86/solaris support.  The shared library
  > support is not completely correct (a common problem).  I do not have access
  > to such a system, so I can't be sure what the correct fix is.  However, just
  > comparing against the sparc/solaris support, I am guessing that libgcc.a was
  > not compiled PIC.
  > 
  > Does this patch solve your problem?
  > 
  > Thu Sep  4 15:02:27 1997  Jim Wilson  <wilson@cygnus.com>
  > 
  > 	* i386/t-sol2 (TARGET_LIBGCC2_CFLAGS): Define to -fPIC.
I'm pretty sure this is the right fix...  Even if some problems remain.

I went ahead and installed it.

jeff


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

* Re: Shared C++ libs on i386-pc-solaris2.5.1
       [not found] <34096EF5.5768EC4F@student.anu.edu.au>
@ 1997-09-04 15:05 ` Jim Wilson
  1997-09-04 16:55   ` Jeffrey A Law
  0 siblings, 1 reply; 9+ messages in thread
From: Jim Wilson @ 1997-09-04 15:05 UTC (permalink / raw)
  To: James Macnicol; +Cc: egcs

	Has anyone managed to build egcs under Solaris x86 2.5.1?
	I cannot get any shared C++ libraries to link (including the
	libstdc++.so that is built as part of the distribution -- see below),

Looks like this is a bug in the gcc x86/solaris support.  The shared library
support is not completely correct (a common problem).  I do not have access
to such a system, so I can't be sure what the correct fix is.  However, just
comparing against the sparc/solaris support, I am guessing that libgcc.a was
not compiled PIC.

Does this patch solve your problem?

Thu Sep  4 15:02:27 1997  Jim Wilson  <wilson@cygnus.com>

	* i386/t-sol2 (TARGET_LIBGCC2_CFLAGS): Define to -fPIC.

Index: t-sol2
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/config/i386/t-sol2,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 t-sol2
*** t-sol2	1997/08/11 15:57:17	1.1.1.1
--- t-sol2	1997/09/04 22:02:12
*************** crtn.o: $(srcdir)/config/i386/sol2-cn.as
*** 33,35 ****
--- 33,36 ----
  # routines in crtstuff.c.
  
  CRTSTUFF_T_CFLAGS = -fPIC
+ TARGET_LIBGCC2_CFLAGS = -fPIC


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

* Shared C++ libs on i386-pc-solaris2.5.1
  1997-08-31  2:07 egcs 970828 and X11 on linux/x86 H.J. Lu
@ 1997-08-31 13:17 ` James Macnicol
  0 siblings, 0 replies; 9+ messages in thread
From: James Macnicol @ 1997-08-31 13:17 UTC (permalink / raw)
  To: egcs

Hello,

	Has anyone managed to build egcs under Solaris x86 2.5.1?
I cannot get any shared C++ libraries to link (including the
libstdc++.so that is built as part of the distribution -- see below),


make[2]: Leaving directory `/export/home/opt/egcs-970828/libio'
/export/home/opt/egcs-970828/gcc/xgcc
-B/export/home/opt/egcs-970828/gcc/ -g -O2 -fno-implicit-templates -h
libstdc++.so.2.8.0 -shared -o libstdc++.so.2.8.0 `cat piclist` -lm
Text relocation remains                       referenced
    against symbol                  offset      in file
__eh_type                           0xe3       
/export/home/opt/egcs-970828/gcc/libgcc.a(_eh.o)
__eh_type                           0x36a      
/export/home/opt/egcs-970828/gcc/libgcc.a(exception.o)
[snip]
__eh_cleanup                        0x243      
/export/home/opt/egcs-970828/gcc/libgcc.a(exception.o)
[snip]
__eh_in_catch                       0x448      
/export/home/opt/egcs-970828/gcc/libgcc.a(exception.o)
__get_dynamic_handler_chain         0x50a      
/export/home/opt/egcs-970828/gcc/libgcc.a(tinfo.o)
[snip]
__terminate                         0x325      
/export/home/opt/egcs-970828/gcc/libgcc.a(exception.o)
[snip]
__sjthrow                           0x24c      
/export/home/opt/egcs-970828/gcc/libgcc.a(exception.o)
[snip]

There are a lot more errors than this, including references to stdc
things
malloc, free etc.  I just tried did a normal configure with
--enable-shared
and let it run (I built gcc in three stages by hand since make from
the toplevel directory doesn't seem to do that).  I am using the
standard
Sun assembler and linker (I realize C++ debugging won't work but I can
live with that for now).

Any ideas?


--
James Macnicol
J.Macnicol@student.anu.edu.au
http://goblet.anu.edu.au/~m9305357/home.html

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

end of thread, other threads:[~1997-09-11 13:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-07  5:42 Shared C++ libs on i386-pc-solaris2.5.1 James Macnicol
1997-09-07 10:11 ` H.J. Lu
     [not found] <199709100139.SAA07609@cygnus.com>
1997-09-09 19:54 ` James Macnicol
1997-09-10 22:37 ` James Macnicol
1997-09-11 10:01   ` Jeffrey A Law
1997-09-11 13:20     ` Richard Henderson
     [not found] <34096EF5.5768EC4F@student.anu.edu.au>
1997-09-04 15:05 ` Jim Wilson
1997-09-04 16:55   ` Jeffrey A Law
  -- strict thread matches above, loose matches on Subject: below --
1997-08-31  2:07 egcs 970828 and X11 on linux/x86 H.J. Lu
1997-08-31 13:17 ` Shared C++ libs on i386-pc-solaris2.5.1 James Macnicol

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).