This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

PATCH : Gas ppc aix .comm default alignment


This is a patch for ppc .comm and .lcomm symbol alignment.  

In some cases, mixing the native and gas assembled common symbols will
fail because of different behaviours for the default alignment of the
.comm pseudo op

The native aix 4.3.3 ppc assembler aligns .comm to 4 bytes  

The native aix 4.3.3 ppc assembler aligns .lcomm symbols to 4 bytes.  So
even though .lcomm was not causing problems, I changed its alignment to
match the native assembler.

Also included in the patch is an addition to the ppc gas testsuite to
check for the .comm alignment

Tom


-- 
Tom Rix 
GCC Engineer
trix@redhat.com
256.704.9201
diff -cpr src/gas/ChangeLog src-new/gas/ChangeLog
*** src/gas/ChangeLog	Thu Jun 14 00:58:11 2001
--- src-new/gas/ChangeLog	Mon Jun 18 08:30:53 2001
***************
*** 1,3 ****
--- 1,7 ----
+ 2000-06-18  Tom Rix <trix@redhat.com>
+ 
+ 	* config/tc-ppc.c (ppc_comm) : change default alignment to 4 bytes
+ 
  2001-06-13  Philip Blundell  <philb@gnu.org>
  
  	* config/tc-arm.c (thumb_shift): Improve wording of error message.
diff -cpr src/gas/config/tc-ppc.c src-new/gas/config/tc-ppc.c
*** src/gas/config/tc-ppc.c	Tue May 29 07:53:22 2001
--- src-new/gas/config/tc-ppc.c	Mon Jun 18 08:30:55 2001
*************** static boolean ppc_stab_symbol;
*** 2340,2346 ****
  
  /* The .comm and .lcomm pseudo-ops for XCOFF.  XCOFF puts common
     symbols in the .bss segment as though they were local common
!    symbols, and uses a different smclas.  */
  
  static void
  ppc_comm (lcomm)
--- 2340,2347 ----
  
  /* The .comm and .lcomm pseudo-ops for XCOFF.  XCOFF puts common
     symbols in the .bss segment as though they were local common
!    symbols, and uses a different smclas.  The native Aix 4.3.3 assember
!    aligns .comm and .lcomm to 4 bytes */
  
  static void
  ppc_comm (lcomm)
*************** ppc_comm (lcomm)
*** 2382,2388 ****
      {
        /* The third argument to .comm is the alignment.  */
        if (*input_line_pointer != ',')
! 	align = 3;
        else
  	{
  	  ++input_line_pointer;
--- 2383,2389 ----
      {
        /* The third argument to .comm is the alignment.  */
        if (*input_line_pointer != ',')
! 	align = 2;
        else
  	{
  	  ++input_line_pointer;
*************** ppc_comm (lcomm)
*** 2390,2396 ****
  	  if (align <= 0)
  	    {
  	      as_warn (_("ignoring bad alignment"));
! 	      align = 3;
  	    }
  	}
      }
--- 2391,2397 ----
  	  if (align <= 0)
  	    {
  	      as_warn (_("ignoring bad alignment"));
! 	      align = 2;
  	    }
  	}
      }
*************** ppc_comm (lcomm)
*** 2399,2412 ****
        char *lcomm_name;
        char lcomm_endc;
  
!       if (size <= 1)
! 	align = 0;
!       else if (size <= 2)
! 	align = 1;
!       else if (size <= 4)
! 	align = 2;
!       else
! 	align = 3;
  
        /* The third argument to .lcomm appears to be the real local
  	 common symbol to create.  References to the symbol named in
--- 2400,2406 ----
        char *lcomm_name;
        char lcomm_endc;
  
!       align = 2;
  
        /* The third argument to .lcomm appears to be the real local
  	 common symbol to create.  References to the symbol named in
diff -cpr src/gas/testsuite/ChangeLog src-new/gas/testsuite/ChangeLog
*** src/gas/testsuite/ChangeLog	Wed Jun 13 06:42:42 2001
--- src-new/gas/testsuite/ChangeLog	Mon Jun 18 08:30:57 2001
***************
*** 1,3 ****
--- 1,8 ----
+ 2001-06-18  Tom Rix  <trix@redhat.com>
+ 
+ 	* gas/ppc/aix.exp : new file, aix specific tests
+ 	* gas/ppc/align.s : new file, .comm alignment test
+ 	
  2001-06-13  Andreas Jaeger  <aj@suse.de>
  
  	* gas/vtable/vtable.exp (run_list_test): Don't run on sparc64.
diff -cpr src/gas/testsuite/gas/ppc/aix.exp src-new/gas/testsuite/gas/ppc/aix.exp
*** src/gas/testsuite/gas/ppc/aix.exp	Mon Jun 18 09:02:26 2001
--- src-new/gas/testsuite/gas/ppc/aix.exp	Mon Jun 18 09:05:52 2001
***************
*** 0 ****
--- 1,63 ----
+ # Copyright (C) 2001 Free Software Foundation, Inc.
+ 
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ # 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ # 
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ #
+ # Contributed by Redhat
+ 
+ #
+ # Aix on PowerPC tests
+ #
+ proc do_align_test {} {
+     set testname "align.s: Alignment of symbols part 1"
+     set x0 0
+     set x1 0
+     set x2 0
+     set x3 0
+     set x4 0
+ 
+     set testname "align.s (part 2)"
+ 
+     if [gas_test_old "align.s" "" "Alignment of symbols part 1"] {
+ 	objdump_start_no_subdir "a.out" "-t"
+ 
+ 	while 1 {
+ 	    expect {
+ 		-re "AUX val    16 prmhsh 0 snhsh 0 typ 3 algn 2 clss 5 stb 0 snstb 0" { set x0 1 }
+ 		-re "AUX val    32 prmhsh 0 snhsh 0 typ 3 algn 1 clss 5 stb 0 snstb 0" { set x1 1 }
+ 		-re "AUX val    64 prmhsh 0 snhsh 0 typ 3 algn 2 clss 5 stb 0 snstb 0" { set x2 1 }
+ 		-re "AUX val   128 prmhsh 0 snhsh 0 typ 3 algn 3 clss 5 stb 0 snstb 0" { set x3 1 }
+ 		-re "AUX val   256 prmhsh 0 snhsh 0 typ 3 algn 4 clss 5 stb 0 snstb 0" { set x4 1 }
+ 		-re "\[^\n\]*\n"				{ }
+ 		timeout				{ perror "timeout\n"; break }
+ 		eof				{ break }
+ 	    }
+ 	}
+ 
+ 	objdump_finish
+ 
+ 	if [all_ones $x0 $x1 $x2 $x3 $x4] then {
+ 	    pass $testname
+ 	} else {
+ 	    fail $testname
+ 	}
+     }
+ }
+ 
+ 
+ if [istarget powerpc*-*-aix4.3*] then {
+ 
+     # Make sure that symbols are correctly aligned 
+     do_align_test
+ }
diff -cpr src/gas/testsuite/gas/ppc/align.s src-new/gas/testsuite/gas/ppc/align.s
*** src/gas/testsuite/gas/ppc/align.s	Mon Jun 18 09:02:37 2001
--- src-new/gas/testsuite/gas/ppc/align.s	Mon Jun 18 08:31:08 2001
***************
*** 0 ****
--- 1,6 ----
+ 	.comm default_align_4,16
+ 	.comm align_1,32,1
+ 	.comm align_2,64,2
+ 	.comm align_4,128,3
+ 	.comm align_8,256,4
+ 	
\ No newline at end of file

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