This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[RFA] XCOFF DBX and function sections


Jeff,

	We discussed GCC's -ffunction-sections failure in the face of
debugging information back in 2000.  At the time, we decided to give up
because updating dbxout.c was an endless thread to pull.

	My recent fix to the XCOFF-side of select_sections (along with the
ELF fixes) re-exposed a bug in the -fbranch-probabilities functionality.
When that functionality was first introduced, I needed to redefine the HOT
and UNLIKELY sections as the standard text sections.  With the
select_sections change, I needed to update those definitions.  It turns
out that select_sections now will get the section names right with the
separate section names, so those definitions are no longer needed at all.

	Returning to the default definitions works in all cases except
when debugging is enabled.  I went back to the original proposed change to
FORCE_TEXT.  That change bootstraps fully with no new regressions and
fixes most of the -fbranch-probabilities failures.  One other tweak fixes
the remaining bug.

	The two small patches for which I am requesting approval are
below.  The AIX assembler bug referenced in the comment have long been
fixed.  This change may not make -ffunction-sections work completely on
AIX, but it is an improvement and is necessary to fix the
-fbranch-probabilities regressions.

	Does this incremental improvement look okay to you?

Thanks, David


        * dbxout.c (FORCE_TEXT): Switch to current_function_decl, not
        text_section.
        * xcoffout.h (DBX_STATIC_BLOCK_START): Remove explicit change to 
	text section.

Index: dbxout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dbxout.c,v
retrieving revision 1.124
diff -c -p -r1.124 dbxout.c
*** dbxout.c	15 Aug 2002 19:59:28 -0000	1.124
--- dbxout.c	8 Sep 2002 02:46:07 -0000
*************** static int source_label_number = 1;
*** 155,161 ****
  #endif
  
  #ifdef DEBUG_SYMS_TEXT
! #define FORCE_TEXT text_section ();
  #else
  #define FORCE_TEXT
  #endif
--- 155,161 ----
  #endif
  
  #ifdef DEBUG_SYMS_TEXT
! #define FORCE_TEXT function_section (current_function_decl);
  #else
  #define FORCE_TEXT
  #endif
Index: xcoffout.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/xcoffout.h,v
retrieving revision 1.18
diff -c -p -r1.18 xcoffout.h
*** xcoffout.h	15 Aug 2002 19:59:29 -0000	1.18
--- xcoffout.h	8 Sep 2002 02:46:07 -0000
*************** Software Foundation, 59 Temple Place - S
*** 47,76 ****
  
  #define DBX_STATIC_CONST_VAR_CODE N_STSYM
  
! /* For static variables, output code to define the start of a static block.
! 
!    ??? The IBM rs6000/AIX assembler has a bug that causes bss block debug
!    info to be occasionally lost.  A simple example is this:
! 	int a; static int b;
!    The commands `gcc -g -c tmp.c; dump -t tmp.o' gives
! [10]	m   0x00000016         1     0    0x8f  0x0000            .bs
! [11]	m   0x00000000         1     0    0x90  0x0000            .es
! ...
! [21]	m   0x00000000        -2     0    0x85  0x0000            b:S-1
!    which is wrong.  The `b:S-1' must be between the `.bs' and `.es'.
!    We can apparently work around the problem by forcing the text section
!    (even if we are already in the text section) immediately before outputting
!    the `.bs'.  This should be fixed in the next major AIX release (3.3?).  */
  
  #define DBX_STATIC_BLOCK_START(ASMFILE,CODE)				\
  {									\
    if ((CODE) == N_STSYM)						\
      fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
    else if ((CODE) == N_LCSYM)						\
!     {									\
!       fprintf ((ASMFILE), "%s\n", TEXT_SECTION_ASM_OP);			\
!       fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name);	\
!     }									\
  }
  
  /* For static variables, output code to define the end of a static block.  */
--- 47,60 ----
  
  #define DBX_STATIC_CONST_VAR_CODE N_STSYM
  
! /* For static variables, output code to define the start of a static block.  */
  
  #define DBX_STATIC_BLOCK_START(ASMFILE,CODE)				\
  {									\
    if ((CODE) == N_STSYM)						\
      fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
    else if ((CODE) == N_LCSYM)						\
!     fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name);		\
  }
  
  /* For static variables, output code to define the end of a static block.  */


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