public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* optimizer bugs, -g weirdness and an Open Server patch
@ 1997-11-15 21:04 J. Kean Johnston
  1997-11-16 22:03 ` Jeffrey A Law
  0 siblings, 1 reply; 4+ messages in thread
From: J. Kean Johnston @ 1997-11-15 21:04 UTC (permalink / raw)
  To: egcs

Hi all.

Below is a patch for sco5.h to do the right thing with constant data
when using PIC mode. The ommision was causing (at least) X11R6 to compile
certain modules incorrectly.  Also included is Robert's previous patch
to use ASM_OUTPUT_ALIGNED_BSS. Also included is a change to the specs
to ensure that the PIC version of libgcc.a is used if the user ever
uses -shared to generate shared libraries.  I can now reliably (and correctly)
generate shared libraries with GCC on Open Server.

On a side note, I decided today to "stress" the compiler a little.
After making GCC (manually, not using make bootstrap, but using 4 stages
and building with the flags specified below), I build the rest of EGCS.
With the optimizations flags below, the first time it barfed was while
compiling libstdc++/sinst.cc.  It have an "internal compiler error".
When I am done with the rest of my tests I will look into this in more
depth.  The flags I was using were:

CXXFLAGS=-O99 -m486 -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop
         -fexpensive-optimizations
CFLAGS=$CXXFLAGS

Yes yes yes, -O99 isnt a real option but its big enough to get the max
optimizations I know of (I have had this argument a zillion times).

With 971114, compiling C++ with -g enables is causing labels to be
incorrectly generated.  For example, I get "unresolved symbol .L_T7895
with -g, works fine without -g. This bug sounds very familiar.

Anyway ... here is a patch which should go into the next snapshot, please:

Fri Nov 14 22:47:55 1997  J. Kean Johnston  <jkj@sco.com>

	* config/i386/sco5.h: Define ASM_OUTPUT_ALIGNED_BSS.
	Added SELECT_RTX_SECTION to do the right thing in PIC mode.
	Changed LIBGCC_SPEC and LIB_SPEC to link with correct libgcc.a

*** config/i386/sco5.h~	Sun Nov  2 18:43:35 1997
--- config/i386/sco5.h	Fri Nov 14 22:42:46 1997
***************
*** 284,289 ****
--- 284,297 ----
     }									\
  } while (0)
  
+ /* A C statement (sans semicolon) to output to the stdio stream
+    FILE the assembler definition of uninitialized global DECL named
+    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
+    Try to use asm_output_aligned_bss to implement this macro.  */
+ 
+ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) 		\
+   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+ 
  #undef ESCAPES
  #define ESCAPES \
  "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
***************
*** 367,372 ****
--- 375,393 ----
          fprintf ((FILE), "\n");						\
  } while (0) 
  
+ /* Must use data section for relocatable constants when pic.  */
+ #undef SELECT_RTX_SECTION
+ #define SELECT_RTX_SECTION(MODE,RTX)					\
+ {									\
+   if (TARGET_ELF) {							\
+     if (flag_pic && symbolic_operand (RTX))				\
+       data_section ();							\
+     else								\
+       const_section ();							\
+   } else								\
+     readonly_data_section();						\
+ }
+ 
  #undef ASM_OUTPUT_CASE_LABEL
  #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE)		\
  do {									\
***************
*** 883,889 ****
  
  #undef LIB_SPEC
  #define LIB_SPEC \
!  "%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
  
  #define MASK_COFF     		010000000000	/* Mask for elf generation */
  #define TARGET_COFF             (target_flags & MASK_COFF)
--- 904,914 ----
  
  #undef LIB_SPEC
  #define LIB_SPEC \
!  "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
! 
! #undef LIBGCC_SPEC
! #define LIBGCC_SPEC \
!  "%{!shared:-lgcc}"
  
  #define MASK_COFF     		010000000000	/* Mask for elf generation */
  #define TARGET_COFF             (target_flags & MASK_COFF)

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

* Re: optimizer bugs, -g weirdness and an Open Server patch
  1997-11-15 21:04 optimizer bugs, -g weirdness and an Open Server patch J. Kean Johnston
@ 1997-11-16 22:03 ` Jeffrey A Law
  1997-11-17  9:39   ` Robert Lipe
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey A Law @ 1997-11-16 22:03 UTC (permalink / raw)
  To: J. Kean Johnston; +Cc: egcs

  In message < 19971115210620.30844@sco.com >you write:
  > Anyway ... here is a patch which should go into the next snapshot, please:
  > 
  > Fri Nov 14 22:47:55 1997  J. Kean Johnston  <jkj@sco.com>
  > 
  > 	* config/i386/sco5.h: Define ASM_OUTPUT_ALIGNED_BSS.
  > 	Added SELECT_RTX_SECTION to do the right thing in PIC mode.
  > 	Changed LIBGCC_SPEC and LIB_SPEC to link with correct libgcc.a
I've installed this patch.

Just a random comment -- you might also need SELECT_SECTION defined -- I don't
know enough about sco to say for sure.

jeff

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

* Re: optimizer bugs, -g weirdness and an Open Server patch
  1997-11-16 22:03 ` Jeffrey A Law
@ 1997-11-17  9:39   ` Robert Lipe
  1997-11-17  9:50     ` Jeffrey A Law
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Lipe @ 1997-11-17  9:39 UTC (permalink / raw)
  To: law; +Cc: J. Kean Johnston, egcs

[ re: sco5.h patch to set  ASM_OUTPUT_ALIGNED_BSS ] 

> Just a random comment -- you might also need SELECT_SECTION defined -- I don't
> know enough about sco to say for sure.

SELECT_SECTION is defined in sco5.h.   Was this random comment triggered
based on knowing that it needed to be there, or upon seeing that it was
there and somehow suboptimal?


Though I haven't rebuilt with Kean's patch, I have done a full bootstrap
and test with the ASM_OUTPUT_ALIGNED_BSS patch installed and noticed no
difference in the dejagnu output.  

RJL

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

* Re: optimizer bugs, -g weirdness and an Open Server patch
  1997-11-17  9:39   ` Robert Lipe
@ 1997-11-17  9:50     ` Jeffrey A Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey A Law @ 1997-11-17  9:50 UTC (permalink / raw)
  To: Robert Lipe; +Cc: J. Kean Johnston, egcs

  In message < 19971117113837.22738@dgii.com >you write:
  > [ re: sco5.h patch to set  ASM_OUTPUT_ALIGNED_BSS ] 
  > 
  > > Just a random comment -- you might also need SELECT_SECTION defined -- I 
  > don't
  > > know enough about sco to say for sure.
  > 
  > SELECT_SECTION is defined in sco5.h.   Was this random comment triggered
  > based on knowing that it needed to be there, or upon seeing that it was
  > there and somehow suboptimal?
It was based on seeing SELECT_RTX_SECTION in the patch and not seeing
SELECT_SECTION in the patch :-)

If you've already got an appropriate SELECT_SECTION in sco5.h, then ignore
my comment.

jeff

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

end of thread, other threads:[~1997-11-17  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-15 21:04 optimizer bugs, -g weirdness and an Open Server patch J. Kean Johnston
1997-11-16 22:03 ` Jeffrey A Law
1997-11-17  9:39   ` Robert Lipe
1997-11-17  9:50     ` Jeffrey A Law

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