From 09d688ff604a18ede94318d871d3d932b53b8dbe Mon Sep 17 00:00:00 2001
From: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 18 Aug 2001 00:53:20 +0000
Subject: [PATCH] 	* defaults.h (UNALIGNED_SHORT_ASM_OP,
 UNALIGNED_INT_ASM_OP, 	UNALIGNED_DOUBLE_INT_ASM_OP, ASM_BYTE_OP): Move from
 ... 	* dwarf2asm.c: ... here. 	* dwarfout.c: Remove them.

	* varasm.c (assemble_integer): Add align parameter.
	(assemble_real, output_constant, output_constructor): Likewise.
	* output.h: Update decls.
	* dwarf2asm.c, final.c, varasm.c, config/darwin.c, config/nextstep.c,
	config/alpha/alpha.c, config/arm/arm.md, config/clipper/clipper.c,
	config/m88k/m88k.c, config/mcore/mcore.md, config/mips/mips.h,
	config/mips/mips.md, config/pa/pa.c, config/rs6000/rs6000.c,
	config/rs6000/rs6000.h, config/s390/s390.h, config/sh/sh.md:
	Update all callers.

	* final.c (end_final): Abort profile block generation if we
	havn't layed it out properly.
	* output.h (assemble_eh_integer): Remove stale decl.
	* varasm.c (assemble_zeros): Tidy; use assemble_integer.
	(min_align): New.
	(assemble_integer): Handle unaligned data.
	(assemble_real): Abort on unaligned data.
	(output_constructor): Don't assume ASM_OUTPUT_ALIGN 0 does
	anything useful.
	(default_dtor_section_asm_out_destructor): Use assemble_align.
	(default_named_section_asm_out_constructor): Likewise.
	(default_ctor_section_asm_out_constructor): Likewise.
	* config/darwin.c (machopic_asm_out_constructor): Likewise.
	(machopic_asm_out_destructor): Likewise.
	* config/nextstep.c (nextstep_asm_out_constructor): Likewise.
	(nextstep_asm_out_destructor): Likewise.
	* config/alpha/alpha.c (vms_asm_out_constructor): Likewise.
	(vms_asm_out_destructor): Likewise.

        * java/class.c (emit_register_classes): Add align parameter to
        call to assemble_integer.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44992 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                |  36 ++++++
 gcc/config/alpha/alpha.c     |   6 +-
 gcc/config/arm/arm.md        |  12 +-
 gcc/config/clipper/clipper.c |   4 +-
 gcc/config/darwin.c          |  14 +-
 gcc/config/m88k/m88k.c       |   4 +-
 gcc/config/mcore/mcore.md    |   2 +-
 gcc/config/mips/mips.h       |   4 +-
 gcc/config/mips/mips.md      |  12 +-
 gcc/config/nextstep.c        |   6 +-
 gcc/config/pa/pa.c           |   4 +-
 gcc/config/rs6000/rs6000.c   |   4 +-
 gcc/config/rs6000/rs6000.h   |   4 +-
 gcc/config/s390/s390.h       |  83 ++++++------
 gcc/config/sh/sh.md          |  10 +-
 gcc/defaults.h               |  17 +++
 gcc/dwarf2asm.c              |  42 ++----
 gcc/dwarfout.c               |   9 --
 gcc/final.c                  |  95 ++++++++------
 gcc/java/ChangeLog           |   5 +
 gcc/java/class.c             |   2 +-
 gcc/output.h                 |  21 +--
 gcc/varasm.c                 | 239 ++++++++++++++++++++++-------------
 23 files changed, 374 insertions(+), 261 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index da042fe08405..12b76ccb4f57 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,39 @@
+2001-08-17  Richard Henderson  <rth@redhat.com>
+
+	* defaults.h (UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP,
+	UNALIGNED_DOUBLE_INT_ASM_OP, ASM_BYTE_OP): Move from ...
+	* dwarf2asm.c: ... here.
+	* dwarfout.c: Remove them.
+
+	* varasm.c (assemble_integer): Add align parameter.
+	(assemble_real, output_constant, output_constructor): Likewise.
+	* output.h: Update decls.
+	* dwarf2asm.c, final.c, varasm.c, config/darwin.c, config/nextstep.c,
+	config/alpha/alpha.c, config/arm/arm.md, config/clipper/clipper.c,
+	config/m88k/m88k.c, config/mcore/mcore.md, config/mips/mips.h,
+	config/mips/mips.md, config/pa/pa.c, config/rs6000/rs6000.c,
+	config/rs6000/rs6000.h, config/s390/s390.h, config/sh/sh.md:
+	Update all callers.
+
+	* final.c (end_final): Abort profile block generation if we
+	havn't layed it out properly.
+	* output.h (assemble_eh_integer): Remove stale decl.
+	* varasm.c (assemble_zeros): Tidy; use assemble_integer.
+	(min_align): New.
+	(assemble_integer): Handle unaligned data.
+	(assemble_real): Abort on unaligned data.
+	(output_constructor): Don't assume ASM_OUTPUT_ALIGN 0 does
+	anything useful.
+	(default_dtor_section_asm_out_destructor): Use assemble_align.
+	(default_named_section_asm_out_constructor): Likewise.
+	(default_ctor_section_asm_out_constructor): Likewise.
+	* config/darwin.c (machopic_asm_out_constructor): Likewise.
+	(machopic_asm_out_destructor): Likewise.
+	* config/nextstep.c (nextstep_asm_out_constructor): Likewise.
+	(nextstep_asm_out_destructor): Likewise.
+	* config/alpha/alpha.c (vms_asm_out_constructor): Likewise.
+	(vms_asm_out_destructor): Likewise.
+
 2001-08-17  Richard Henderson  <rth@redhat.com>
 
 	* config/mips/iris6.h (TARGET_IRIX6): New.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 741a5ee97a48..731f6a6a0905 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -6595,7 +6595,8 @@ vms_asm_out_constructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   ctors_section ();
-  assemble_integer (symbol, UNITS_PER_WORD, 1);
+  assemble_align (BITS_PER_WORD);
+  assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
 }
 
 static void
@@ -6604,7 +6605,8 @@ vms_asm_out_destructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   dtors_section ();
-  assemble_integer (symbol, UNITS_PER_WORD, 1);
+  assemble_align (BITS_PER_WORD);
+  assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
 }
 #else
 
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index fea195483d55..5565aeeaf1ff 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -9064,7 +9064,7 @@
   "TARGET_THUMB"
   "*
   making_const_table = TRUE;
-  assemble_integer (operands[0], 1, 1);
+  assemble_integer (operands[0], 1, BITS_PER_WORD, 1);
   assemble_zeros (3);
   return \"\";
   "
@@ -9076,7 +9076,7 @@
   "TARGET_THUMB"
   "*
   making_const_table = TRUE;
-  assemble_integer (operands[0], 2, 1);
+  assemble_integer (operands[0], 2, BITS_PER_WORD, 1);
   assemble_zeros (2);
   return \"\";
   "
@@ -9095,11 +9095,11 @@
       {
         union real_extract u;
         memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-        assemble_real (u.d, GET_MODE (operands[0]));
+        assemble_real (u.d, GET_MODE (operands[0]), BITS_PER_WORD);
         break;
       }
       default:
-        assemble_integer (operands[0], 4, 1);
+        assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
         break;
       }
     return \"\";
@@ -9119,11 +9119,11 @@
         {
           union real_extract u;
           memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-          assemble_real (u.d, GET_MODE (operands[0]));
+          assemble_real (u.d, GET_MODE (operands[0]), BITS_PER_WORD);
           break;
         }
       default:
-        assemble_integer (operands[0], 8, 1);
+        assemble_integer (operands[0], 8, BITS_PER_WORD, 1);
         break;
       }
     return \"\";
diff --git a/gcc/config/clipper/clipper.c b/gcc/config/clipper/clipper.c
index 8104b859fceb..37756e941c5f 100644
--- a/gcc/config/clipper/clipper.c
+++ b/gcc/config/clipper/clipper.c
@@ -712,6 +712,6 @@ clix_asm_out_destructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   fini_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
-  assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
+  assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index f2bd5bd614a3..d00b7bda6005 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -924,10 +924,11 @@ machopic_finish (asm_out_file)
 	  )
 	{
 	  data_section ();
-	  assemble_align (UNITS_PER_WORD * BITS_PER_UNIT);
+	  assemble_align (GET_MODE_ALIGNMENT (Pmode));
 	  assemble_label (lazy_name);
 	  assemble_integer (gen_rtx (SYMBOL_REF, Pmode, sym_name),
-			    GET_MODE_SIZE (Pmode), 1);
+			    GET_MODE_SIZE (Pmode),
+			    GET_MODE_ALIGNMENT (Pmode), 1);
 	}
       else
 	{
@@ -939,7 +940,8 @@ machopic_finish (asm_out_file)
 	  assemble_name (asm_out_file, sym_name); 
 	  fprintf (asm_out_file, "\n");
 
-	  assemble_integer (const0_rtx, GET_MODE_SIZE (Pmode), 1);
+	  assemble_integer (const0_rtx, GET_MODE_SIZE (Pmode),
+			    GET_MODE_ALIGNMENT (Pmode), 1);
 	}
     }
 }
@@ -1117,7 +1119,8 @@ machopic_asm_out_constructor (symbol, priority)
     mod_init_section ();
   else
     constructor_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 
   if (!flag_pic)
     fprintf (asm_out_file, ".reference .constructors_used\n");
@@ -1132,7 +1135,8 @@ machopic_asm_out_destructor (symbol, priority)
     mod_term_section ();
   else
     destructor_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 
   if (!flag_pic)
     fprintf (asm_out_file, ".reference .destructors_used\n");
diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c
index c1b9a6b7c349..1c0bd15417a5 100644
--- a/gcc/config/m88k/m88k.c
+++ b/gcc/config/m88k/m88k.c
@@ -3311,8 +3311,8 @@ m88k_svr3_asm_out_destructor (symbol, priority)
   int i;
 
   fini_section ();
-  assemble_integer (symbol, UNITS_PER_WORD, 1);
+  assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
   for (i = 1; i < 4; i++)
-    assemble_integer (constm1_rtx, UNITS_PER_WORD, 1);
+    assemble_integer (constm1_rtx, UNITS_PER_WORD, BITS_PER_WORD, 1);
 }
 #endif
diff --git a/gcc/config/mcore/mcore.md b/gcc/config/mcore/mcore.md
index 4cc15370cf80..1a37bbbebdde 100644
--- a/gcc/config/mcore/mcore.md
+++ b/gcc/config/mcore/mcore.md
@@ -3409,7 +3409,7 @@
  ""
  "*
 {
-  assemble_integer (operands[0], 4, 1);
+  assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
   return \"\";
 }"
  [(set_attr "length" "4")])
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index d86cf1c98637..b3c4dd40321f 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -4304,9 +4304,9 @@ do {									\
   else									\
     {									\
       assemble_integer (operand_subword ((VALUE), 0, 0, DImode),	\
-			UNITS_PER_WORD, 1);				\
+			UNITS_PER_WORD, BITS_PER_WORD, 1);		\
       assemble_integer (operand_subword ((VALUE), 1, 0, DImode),	\
-			UNITS_PER_WORD, 1);				\
+			UNITS_PER_WORD, BITS_PER_WORD, 1);		\
     }									\
 } while (0)
 
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index d0ab2a32059f..6c4e32ca22b0 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -10382,7 +10382,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   "TARGET_MIPS16"
   "*
 {
-  assemble_integer (operands[0], 1, 1);
+  assemble_integer (operands[0], 1, BITS_PER_UNIT, 1);
   return \"\";
 }"
   [(set_attr "type"	"unknown")
@@ -10394,7 +10394,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   "TARGET_MIPS16"
   "*
 {
-  assemble_integer (operands[0], 2, 1);
+  assemble_integer (operands[0], 2, BITS_PER_UNIT * 2, 1);
   return \"\";
 }"
   [(set_attr "type"	"unknown")
@@ -10406,7 +10406,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   "TARGET_MIPS16"
   "*
 {
-  assemble_integer (operands[0], 4, 1);
+  assemble_integer (operands[0], 4, BITS_PER_UNIT * 4, 1);
   return \"\";
 }"
   [(set_attr "type"	"unknown")
@@ -10418,7 +10418,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   "TARGET_MIPS16"
   "*
 {
-  assemble_integer (operands[0], 8, 1);
+  assemble_integer (operands[0], 8, BITS_PER_UNIT * 8, 1);
   return \"\";
 }"
   [(set_attr "type"	"unknown")
@@ -10435,7 +10435,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   if (GET_CODE (operands[0]) != CONST_DOUBLE)
     abort ();
   memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-  assemble_real (u.d, SFmode);
+  assemble_real (u.d, SFmode, GET_MODE_ALIGNMENT (SFmode));
   return \"\";
 }"
   [(set_attr "type"	"unknown")
@@ -10452,7 +10452,7 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j\\t%2"
   if (GET_CODE (operands[0]) != CONST_DOUBLE)
     abort ();
   memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-  assemble_real (u.d, DFmode);
+  assemble_real (u.d, DFmode, GET_MODE_ALIGNMENT (DFmode));
   return \"\";
 }"
   [(set_attr "type"	"unknown")
diff --git a/gcc/config/nextstep.c b/gcc/config/nextstep.c
index 94492d4998e9..bbe0cd68fa49 100644
--- a/gcc/config/nextstep.c
+++ b/gcc/config/nextstep.c
@@ -96,7 +96,8 @@ nextstep_asm_out_constructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   constructor_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
   fprintf (asm_out_file, ".reference .constructors_used\n");
 }
 
@@ -106,7 +107,8 @@ nextstep_asm_out_destructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   destructor_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
   fprintf (asm_out_file, ".reference .destructors_used\n");
 }
 
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index d4fe968008e2..5517f99f7f49 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -4377,8 +4377,8 @@ output_deferred_plabels (file)
   for (i = 0; i < n_deferred_plabels; i++)
     {
       ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (deferred_plabels[i].internal_label));
-      assemble_integer (gen_rtx_SYMBOL_REF (VOIDmode,
-					    deferred_plabels[i].name), 4, 1);
+      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, deferred_plabels[i].name),
+			4, 32, 1);
     }
 }
 
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 838315ea7dc1..f8a168dabf7c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8745,7 +8745,7 @@ rs6000_elf_asm_out_constructor (symbol, priority)
       fputs (")@fixup\n", asm_out_file);
     }
   else
-    assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+    assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 
 static void
@@ -8776,7 +8776,7 @@ rs6000_elf_asm_out_destructor (symbol, priority)
       fputs (")@fixup\n", asm_out_file);
     }
   else
-    assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+    assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 #endif
 
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 8c7ba3369ec8..f87c1eb83394 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2475,9 +2475,9 @@ do {									\
   if (TARGET_32BIT)							\
     {									\
       assemble_integer (operand_subword ((VALUE), 0, 0, DImode),	\
-                        UNITS_PER_WORD, 1);				\
+                        UNITS_PER_WORD, BITS_PER_WORD, 1);		\
       assemble_integer (operand_subword ((VALUE), 1, 0, DImode),	\
-                        UNITS_PER_WORD, 1);				\
+                        UNITS_PER_WORD, BITS_PER_WORD, 1);		\
     }									\
   else									\
     {									\
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 066811a8c4ef..2e52dd2b217d 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -1807,7 +1807,7 @@ extern int s390_nr_constants;
     /* Mark entries referenced by other entries */			\
     for (pool = first_pool; pool; pool = pool->next)		       	\
       if (pool->mark)							\
-        mark_constants (pool->constant);					\
+        mark_constants (pool->constant);				\
 								       	\
     s390_asm_output_pool_prologue (FILE, FUNNAME, fndecl, size);     	\
 }
@@ -1818,46 +1818,47 @@ extern int s390_nr_constants;
 #define ASM_OUTPUT_POOL_EPILOGUE(FILE, FUNNAME, fndecl, size) return;
 
 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, EXP, MODE, ALIGN, LABELNO, WIN) \
-{                                                                       \
-  if ((s390_pool_count == 0) || (s390_pool_count > 0 && LABELNO >= 0)) 	\
-    {									\
-      fprintf (FILE, ".LC%d:\n", LABELNO);                              \
-      LABELNO = ~LABELNO;                                               \
-    }                                                                   \
-  if (s390_pool_count > 0)						\
-    {									\
-      fprintf (FILE, ".LC%d_%X:\n", ~LABELNO, s390_pool_count);         \
-    }                            					\
-									\
-  /* Output the value of the constant itself.  */			\
-  switch (GET_MODE_CLASS (pool->mode))					\
-    {									\
-    case MODE_FLOAT:							\
-      if (GET_CODE (x) != CONST_DOUBLE)					\
-	abort ();							\
-      									\
-      memcpy ((char *) &u, (char *) &CONST_DOUBLE_LOW (x), sizeof u);	\
-      assemble_real (u.d, pool->mode);					\
-      break;								\
-      									\
-    case MODE_INT:							\
-    case MODE_PARTIAL_INT:						\
-      if (flag_pic && (GET_CODE (x) == CONST ||                         \
-		   GET_CODE (x) == SYMBOL_REF ||                        \
-                   GET_CODE (x) == LABEL_REF ))                         \
-        {								\
-          fprintf (FILE, "%s\t",TARGET_64BIT ? ASM_QUAD : ASM_LONG);	\
-          s390_output_symbolic_const (FILE, x); 			\
-          fputc ('\n', (FILE));						\
-	}                                                               \
-      else                                                              \
-        assemble_integer (x, GET_MODE_SIZE (pool->mode), 1);		\
-      break;								\
-      									\
-    default:								\
-      abort ();								\
-    }									\
-  goto WIN;								\
+{									    \
+  if ((s390_pool_count == 0) || (s390_pool_count > 0 && LABELNO >= 0))	    \
+    {									    \
+      fprintf (FILE, ".LC%d:\n", LABELNO);				    \
+      LABELNO = ~LABELNO;						    \
+    }									    \
+  if (s390_pool_count > 0)						    \
+    {									    \
+      fprintf (FILE, ".LC%d_%X:\n", ~LABELNO, s390_pool_count);		    \
+    }									    \
+									    \
+  /* Output the value of the constant itself.  */			    \
+  switch (GET_MODE_CLASS (MODE))					    \
+    {									    \
+    case MODE_FLOAT:							    \
+      if (GET_CODE (EXP) != CONST_DOUBLE)				    \
+	abort ();							    \
+									    \
+      memcpy ((char *) &u, (char *) &CONST_DOUBLE_LOW (EXP), sizeof u);	    \
+      assemble_real (u.d, MODE, ALIGN);					    \
+      break;								    \
+									    \
+    case MODE_INT:							    \
+    case MODE_PARTIAL_INT:						    \
+      if (flag_pic							    \
+	  && (GET_CODE (EXP) == CONST					    \
+	      || GET_CODE (EXP) == SYMBOL_REF				    \
+	      || GET_CODE (EXP) == LABEL_REF ))				    \
+        {								    \
+          fprintf (FILE, "%s\t",TARGET_64BIT ? ASM_QUAD : ASM_LONG);	    \
+          s390_output_symbolic_const (FILE, EXP);			    \
+          fputc ('\n', (FILE));						    \
+	}								    \
+      else								    \
+        assemble_integer (EXP, GET_MODE_SIZE (MODE), ALIGN, 1);		    \
+      break;								    \
+									    \
+    default:								    \
+      abort ();								    \
+    }									    \
+  goto WIN;								    \
 }
 
 #endif 
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 284429198e2e..69857c32024c 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -4131,7 +4131,7 @@
  "*
 {
   if (operands[1] != const0_rtx)
-    assemble_integer (operands[0], 2, 1);
+    assemble_integer (operands[0], 2, BITS_PER_UNIT * 2, 1);
   return \"\";
 }"
  [(set_attr "length" "2")
@@ -4147,7 +4147,7 @@
  "*
 {
   if (operands[1] != const0_rtx)
-    assemble_integer (operands[0], 4, 1);
+    assemble_integer (operands[0], 4, BITS_PER_UNIT * 4, 1);
   return \"\";
 }"
  [(set_attr "length" "4")
@@ -4163,7 +4163,7 @@
  "*
 {
   if (operands[1] != const0_rtx)
-    assemble_integer (operands[0], 8, 1);
+    assemble_integer (operands[0], 8, BITS_PER_UNIT * 8, 1);
   return \"\";
 }"
  [(set_attr "length" "8")
@@ -4182,7 +4182,7 @@
     {
       union real_extract u;
       memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-      assemble_real (u.d, SFmode);
+      assemble_real (u.d, SFmode, GET_MODE_ALIGNMENT (SFmode));
     }
   return \"\";
 }"
@@ -4202,7 +4202,7 @@
     {
       union real_extract u;
       memcpy (&u, &CONST_DOUBLE_LOW (operands[0]), sizeof u);
-      assemble_real (u.d, DFmode);
+      assemble_real (u.d, DFmode, GET_MODE_ALIGNMENT (DFmode));
     }
   return \"\";
 }"
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 14635b3e2c91..44eedc8e02b0 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -383,4 +383,21 @@ do {								\
 #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true
 #endif
 
+/* GAS and SYSV4 assemblers accept these.  */
+#ifdef OBJECT_FORMAT_ELF
+#ifndef UNALIGNED_SHORT_ASM_OP
+#define UNALIGNED_SHORT_ASM_OP		"\t.2byte\t"
+#endif
+#ifndef UNALIGNED_INT_ASM_OP
+#define UNALIGNED_INT_ASM_OP		"\t.4byte\t"
+#endif
+#ifndef UNALIGNED_DOUBLE_INT_ASM_OP
+#define UNALIGNED_DOUBLE_INT_ASM_OP	"\t.8byte\t"
+#endif
+#endif /* OBJECT_FORMAT_ELF */
+
+#ifndef ASM_BYTE_OP
+#define ASM_BYTE_OP			"\t.byte\t"
+#endif
+
 #endif  /* ! GCC_DEFAULTS_H */
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 15ae68dd2128..087cd684b983 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -37,26 +37,6 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_COMMENT_START ";#"
 #endif
 
-/* Definitions of defaults for assembler-dependent names of various
-   pseudo-ops and section names.  These may be overridden in the tm.h
-   file (if necessary) for a particular assembler.  */
-
-#ifdef OBJECT_FORMAT_ELF
-#ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP		"\t.2byte\t"
-#endif
-#ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP		"\t.4byte\t"
-#endif
-#ifndef UNALIGNED_DOUBLE_INT_ASM_OP
-#define UNALIGNED_DOUBLE_INT_ASM_OP	"\t.8byte\t"
-#endif
-#endif /* OBJECT_FORMAT_ELF */
-
-#ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP			"\t.byte\t"
-#endif
-
 /* We don't have unaligned support, let's hope the normal output works for
    .debug_frame.  But we know it won't work for .debug_info.  */
 #if !defined(UNALIGNED_INT_ASM_OP) && defined(DWARF2_DEBUGGING_INFO)
@@ -64,6 +44,9 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 
+/* Despite the fact that assemble_integer handles unaligned data,
+   continue emitting things by hand when possible, since that makes
+   the assembler commentary come out prettier.  */
 #ifdef UNALIGNED_INT_ASM_OP
 static const char * unaligned_integer_asm_op  PARAMS ((int));
 
@@ -123,7 +106,7 @@ dw2_asm_output_data VPARAMS ((int size, unsigned HOST_WIDE_INT value,
   fputs (unaligned_integer_asm_op (size), asm_out_file);
   fprintf (asm_out_file, HOST_WIDE_INT_PRINT_HEX, value);
 #else
-  assemble_integer (GEN_INT (value), size, 1);
+  assemble_integer (GEN_INT (value), size, BITS_PER_UNIT, 1);
 #endif
 
   if (flag_debug_asm && comment)
@@ -168,10 +151,9 @@ dw2_asm_output_delta VPARAMS ((int size, const char *lab1, const char *lab2,
   fputc ('-', asm_out_file);
   assemble_name (asm_out_file, lab2);
 #else
-  assemble_integer (gen_rtx_MINUS (smallest_mode_for_size (size, MODE_INT),
-				   gen_rtx_SYMBOL_REF (Pmode, lab1),
+  assemble_integer (gen_rtx_MINUS (Pmode, gen_rtx_SYMBOL_REF (Pmode, lab1),
 				   gen_rtx_SYMBOL_REF (Pmode, lab2)),
-		    size, 1);
+		    size, BITS_PER_UNIT, 1);
 #endif
 
   if (flag_debug_asm && comment)
@@ -216,7 +198,7 @@ dw2_asm_output_offset VPARAMS ((int size, const char *label,
   fputs (unaligned_integer_asm_op (size), asm_out_file);
   assemble_name (asm_out_file, label);
 #else
-  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, 1);
+  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, BITS_PER_UNIT, 1);
 #endif
 #endif
 
@@ -300,7 +282,7 @@ dw2_asm_output_addr VPARAMS ((int size, const char *label,
   fputs (unaligned_integer_asm_op (size), asm_out_file);
   assemble_name (asm_out_file, label);
 #else
-  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, 1);
+  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, label), size, BITS_PER_UNIT, 1);
 #endif
 
   if (flag_debug_asm && comment)
@@ -338,7 +320,7 @@ dw2_asm_output_addr_rtx VPARAMS ((int size, rtx addr,
   fputs (unaligned_integer_asm_op (size), asm_out_file);
   output_addr_const (asm_out_file, addr);
 #else
-  assemble_integer (addr, size, 1);
+  assemble_integer (addr, size, BITS_PER_UNIT, 1);
 #endif
 
   if (flag_debug_asm && comment)
@@ -898,7 +880,7 @@ dw2_output_indirect_constant_1 (node, data)
   sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym);
 
   ASM_OUTPUT_LABEL (asm_out_file, label);
-  assemble_integer (sym_ref, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_integer (sym_ref, POINTER_SIZE / BITS_PER_UNIT, BITS_PER_UNIT, 1);
 
   return 0;
 }
@@ -956,7 +938,7 @@ dw2_asm_output_encoded_addr_rtx VPARAMS ((int encoding,
 
   /* NULL is _always_ represented as a plain zero.  */
   if (addr == const0_rtx)
-    assemble_integer (addr, size, 1);
+    assemble_integer (addr, size, BITS_PER_UNIT, 1);
   else
     {
     restart:
@@ -989,7 +971,7 @@ dw2_asm_output_encoded_addr_rtx VPARAMS ((int encoding,
 	  fputs (unaligned_integer_asm_op (size), asm_out_file);
 	  output_addr_const (asm_out_file, addr);
 #else
-	  assemble_integer (addr, size, 1);
+	  assemble_integer (addr, size, BITS_PER_UNIT, 1);
 #endif
 	  break;
 
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c
index 5c8b8bc6a2d5..b245f235e23b 100644
--- a/gcc/dwarfout.c
+++ b/gcc/dwarfout.c
@@ -948,15 +948,6 @@ static void retry_incomplete_types	PARAMS ((void));
 #ifndef VERSION_ASM_OP
 #define VERSION_ASM_OP		"\t.version\t"
 #endif
-#ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP	"\t.2byte\t"
-#endif
-#ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP	"\t.4byte\t"
-#endif
-#ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP		"\t.byte\t"
-#endif
 #ifndef SET_ASM_OP
 #define SET_ASM_OP		"\t.set\t"
 #endif
diff --git a/gcc/final.c b/gcc/final.c
index d32248196a00..ec57842e079d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -291,6 +291,7 @@ end_final (filename)
       int long_bytes = LONG_TYPE_SIZE / BITS_PER_UNIT;
       int gcov_type_bytes = GCOV_TYPE_SIZE / BITS_PER_UNIT;
       int pointer_bytes = POINTER_SIZE / BITS_PER_UNIT;
+      unsigned int align2 = LONG_TYPE_SIZE;
 
       if (profile_block_flag)
 	size = long_bytes * count_basic_blocks;
@@ -302,6 +303,12 @@ end_final (filename)
       rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
 		 * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
 
+      /* ??? This _really_ ought to be done with a structure layout
+	 and with assemble_constructor.  If long_bytes != pointer_bytes
+	 we'll be emitting unaligned data at some point.  */
+      if (long_bytes != pointer_bytes)
+	abort ();
+
       data_section ();
 
       /* Output the main header, of 11 words:
@@ -323,70 +330,74 @@ end_final (filename)
       ASM_OUTPUT_ALIGN (asm_out_file, align);
 
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 0);
-      /* zero word */
-      assemble_integer (const0_rtx, long_bytes, 1);
 
-      /* address of filename */
+      /* Zero word.  */
+      assemble_integer (const0_rtx, long_bytes, align2, 1);
+
+      /* Address of filename.  */
       ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 1);
-      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes, 1);
+      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes,
+			align2, 1);
 
-      /* address of count table */
+      /* Address of count table.  */
       ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
-      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes, 1);
+      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes,
+			align2, 1);
 
-      /* count of the # of basic blocks or # of instrumented arcs */
+      /* Count of the # of basic blocks or # of instrumented arcs.  */
       if (profile_block_flag)
-	assemble_integer (GEN_INT (count_basic_blocks), long_bytes, 1);
-      else
-	assemble_integer (GEN_INT (count_instrumented_edges), long_bytes, 1);
+      assemble_integer (GEN_INT (profile_block_flag
+				 ? count_basic_blocks
+				 : count_instrumented_edges),
+			long_bytes, align2, 1);
 
-      /* zero word (link field) */
-      assemble_integer (const0_rtx, pointer_bytes, 1);
+      /* Zero word (link field).  */
+      assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 
       /* address of basic block start address table */
       if (profile_block_flag)
 	{
 	  ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3);
-	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes,
-			    1);
+	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
+			    pointer_bytes, align2, 1);
 	}
       else
-	assemble_integer (const0_rtx, pointer_bytes, 1);
+	assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 
-      /* byte count for extended structure.  */
-      assemble_integer (GEN_INT (11 * UNITS_PER_WORD), long_bytes, 1);
+      /* Byte count for extended structure.  */
+      assemble_integer (GEN_INT (11 * UNITS_PER_WORD), long_bytes, align2, 1);
 
-      /* address of function name table */
+      /* Address of function name table.  */
       if (profile_block_flag)
 	{
 	  ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 4);
-	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes,
-			    1);
+	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
+			    pointer_bytes, align2, 1);
 	}
       else
-	assemble_integer (const0_rtx, pointer_bytes, 1);
+	assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 
-      /* address of line number and filename tables if debugging.  */
+      /* Address of line number and filename tables if debugging.  */
       if (write_symbols != NO_DEBUG && profile_block_flag)
 	{
 	  ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 5);
 	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
-			    pointer_bytes, 1);
+			    pointer_bytes, align2, 1);
 	  ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 6);
 	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
-			    pointer_bytes, 1);
+			    pointer_bytes, align2, 1);
 	}
       else
 	{
-	  assemble_integer (const0_rtx, pointer_bytes, 1);
-	  assemble_integer (const0_rtx, pointer_bytes, 1);
+	  assemble_integer (const0_rtx, pointer_bytes, align2, 1);
+	  assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 	}
 
-      /* space for extension ptr (link field) */
-      assemble_integer (const0_rtx, UNITS_PER_WORD, 1);
+      /* Space for extension ptr (link field).  */
+      assemble_integer (const0_rtx, UNITS_PER_WORD, align2, 1);
 
-      /* Output the file name changing the suffix to .d for Sun tcov
-	 compatibility.  */
+      /* Output the file name changing the suffix to .d for
+	 Sun tcov compatibility.  */
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 1);
       {
 	char *cwd = getpwd ();
@@ -460,7 +471,7 @@ end_final (filename)
 	    {
 	      ASM_GENERATE_INTERNAL_LABEL (name, "LPB", i);
 	      assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
-				pointer_bytes, 1);
+				pointer_bytes, align2, 1);
 	    }
 	}
 
@@ -475,14 +486,14 @@ end_final (filename)
 		  ASM_GENERATE_INTERNAL_LABEL (name, "LPBC",
 					       ptr->func_label_num);
 		  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
-				    pointer_bytes, 1);
+				    pointer_bytes, align2, 1);
 		}
 	      else
-		assemble_integer (const0_rtx, pointer_bytes, 1);
+		assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 	    }
 
 	  for (; i < count_basic_blocks; i++)
-	    assemble_integer (const0_rtx, pointer_bytes, 1);
+	    assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 	}
 
       if (write_symbols != NO_DEBUG && profile_block_flag)
@@ -490,10 +501,10 @@ end_final (filename)
 	  /* Output the table of line numbers.  */
 	  ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 5);
 	  for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++)
-	    assemble_integer (GEN_INT (ptr->line_num), long_bytes, 1);
+	    assemble_integer (GEN_INT (ptr->line_num), long_bytes, align2, 1);
 
 	  for (; i < count_basic_blocks; i++)
-	    assemble_integer (const0_rtx, long_bytes, 1);
+	    assemble_integer (const0_rtx, long_bytes, align2, 1);
 
 	  /* Output the table of file names.  */
 	  ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 6);
@@ -504,14 +515,14 @@ end_final (filename)
 		  ASM_GENERATE_INTERNAL_LABEL (name, "LPBC",
 					       ptr->file_label_num);
 		  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
-				    pointer_bytes, 1);
+				    pointer_bytes, align2, 1);
 		}
 	      else
-		assemble_integer (const0_rtx, pointer_bytes, 1);
+		assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 	    }
 
 	  for (; i < count_basic_blocks; i++)
-	    assemble_integer (const0_rtx, pointer_bytes, 1);
+	    assemble_integer (const0_rtx, pointer_bytes, align2, 1);
 	}
 
       /* End with the address of the table of addresses,
@@ -519,8 +530,8 @@ end_final (filename)
       if (profile_block_flag)
 	{
 	  ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3);
-	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes,
-			    1);
+	  assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name),
+			    pointer_bytes, align2, 1);
 	}
     }
 }
@@ -1684,7 +1695,7 @@ profile_function (file)
   data_section ();
   ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
   ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no);
-  assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, 1);
+  assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
 #endif
 
   function_section (current_function_decl);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 6db866fd59b6..8c2b79108069 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-17  Richard Henderson  <rth@redhat.com>
+
+	* class.c (emit_register_classes): Add align parameter to
+	call to assemble_integer.
+
 2001-08-16  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
 	* jcf-parse.c (load_class): New locals saved and class_loaded. If
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 0f68e5ca75b2..e8f7e6f312aa 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1893,7 +1893,7 @@ emit_register_classes ()
       assemble_align (POINTER_SIZE);
       for (t = registered_class; t; t = TREE_CHAIN (t))
 	assemble_integer (XEXP (DECL_RTL (t), 0),
-			  POINTER_SIZE / BITS_PER_UNIT, 1);
+			  POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 #else
       abort ();
 #endif
diff --git a/gcc/output.h b/gcc/output.h
index b5aea51efeda..4c4c5aebcc1e 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -287,18 +287,17 @@ extern void assemble_eh_label		PARAMS ((const char *));
 extern void assemble_name		PARAMS ((FILE *, const char *));
 
 #ifdef RTX_CODE
-/* Assemble the integer constant X into an object of SIZE bytes.
-   X must be either a CONST_INT or CONST_DOUBLE.
-
-   Return 1 if we were able to output the constant, otherwise 0.  If FORCE is
-   non-zero, abort if we can't output the constant.  */
-extern int assemble_integer		PARAMS ((rtx, int, int));
-extern int assemble_eh_integer		PARAMS ((rtx, int, int));
+/* Assemble the integer constant X into an object of SIZE bytes.  ALIGN is
+   the alignment of the integer in bits.  Return 1 if we were able to output
+   the constant, otherwise 0.  If FORCE is non-zero, abort if we can't output
+   the constant.  */
+extern int assemble_integer		PARAMS ((rtx, unsigned, unsigned, int));
 
 #ifdef REAL_VALUE_TYPE
 /* Assemble the floating-point constant D into an object of size MODE.  */
 extern void assemble_real		PARAMS ((REAL_VALUE_TYPE,
-					       enum machine_mode));
+					         enum machine_mode,
+						 unsigned));
 #endif
 #endif
 
@@ -341,8 +340,10 @@ extern tree initializer_constant_valid_p	PARAMS ((tree, tree));
    Assumes output_addressed_constants has been done on EXP already.
 
    Generate exactly SIZE bytes of assembler data, padding at the end
-   with zeros if necessary.  SIZE must always be specified.  */
-extern void output_constant		PARAMS ((tree, int));
+   with zeros if necessary.  SIZE must always be specified.
+
+   ALIGN is the alignment in bits that may be assumed for the data.  */
+extern void output_constant		PARAMS ((tree, int, unsigned));
 #endif
 
 #ifdef RTX_CODE
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 8b340624b8ef..24380c290196 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -161,7 +161,8 @@ static int mark_constant		PARAMS ((rtx *current_rtx, void *data));
 static int output_addressed_constants	PARAMS ((tree));
 static void output_after_function_constants PARAMS ((void));
 static unsigned HOST_WIDE_INT array_size_for_constructor PARAMS ((tree));
-static void output_constructor		PARAMS ((tree, int));
+static unsigned min_align		PARAMS ((unsigned, unsigned));
+static void output_constructor		PARAMS ((tree, int, unsigned));
 #ifdef ASM_WEAKEN_LABEL
 static void remove_from_pending_weak_list	PARAMS ((const char *));
 #endif
@@ -952,7 +953,7 @@ default_named_section_asm_out_destructor (symbol, priority)
 
   named_section_flags (section, SECTION_WRITE);
   assemble_align (POINTER_SIZE);
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 
 #ifdef DTORS_SECTION_ASM_OP
@@ -973,7 +974,8 @@ default_dtor_section_asm_out_destructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   dtors_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 #endif
 
@@ -1012,7 +1014,8 @@ default_named_section_asm_out_constructor (symbol, priority)
     }
 
   named_section_flags (section, SECTION_WRITE);
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 
 #ifdef CTORS_SECTION_ASM_OP
@@ -1033,7 +1036,8 @@ default_ctor_section_asm_out_constructor (symbol, priority)
      int priority ATTRIBUTE_UNUSED;
 {
   ctors_section ();
-  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+  assemble_align (POINTER_SIZE);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 }
 #endif
 
@@ -1172,29 +1176,8 @@ assemble_zeros (size)
   if (ASM_NO_SKIP_IN_TEXT && in_text_section ())
     {
       int i;
-
-      for (i = 0; i < size - 20; i += 20)
-	{
-#ifdef ASM_BYTE_OP
-	  fprintf (asm_out_file,
-		   "%s0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n", ASM_BYTE_OP);
-#else
-	  fprintf (asm_out_file,
-		   "\tbyte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n");
-#endif
-	}
-      if (i < size)
-        {
-#ifdef ASM_BYTE_OP
-	  fprintf (asm_out_file, "%s0", ASM_BYTE_OP);
-#else
-	  fprintf (asm_out_file, "\tbyte 0");
-#endif
-	  i++;
-	  for (; i < size; i++)
-	    fprintf (asm_out_file, ",0");
-	  fprintf (asm_out_file, "\n");
-	}
+      for (i = 0; i < size; i++)
+	assemble_integer (const0_rtx, 1, BITS_PER_UNIT, 1);
     }
   else
 #endif
@@ -1584,7 +1567,8 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
       if (DECL_INITIAL (decl))
 	/* Output the actual data.  */
 	output_constant (DECL_INITIAL (decl),
-			 tree_low_cst (DECL_SIZE_UNIT (decl), 1));
+			 tree_low_cst (DECL_SIZE_UNIT (decl), 1),
+			 align);
       else
 	/* Leave space for it.  */
 	assemble_zeros (tree_low_cst (DECL_SIZE_UNIT (decl), 1));
@@ -1801,52 +1785,90 @@ assemble_trampoline_template ()
 }
 #endif
 
-/* Assemble the integer constant X into an object of SIZE bytes.
-   X must be either a CONST_INT or CONST_DOUBLE.
+/* A and B are either alignments or offsets.  Return the minimum alignment
+   that may be assumed after adding the two together.  */
+
+static inline unsigned
+min_align (a, b)
+     unsigned int a, b;
+{
+  return (a | b) & -(a | b);
+}
 
-   Return 1 if we were able to output the constant, otherwise 0.  If FORCE is
-   non-zero, abort if we can't output the constant.  */
+/* Assemble the integer constant X into an object of SIZE bytes.  ALIGN is
+   the alignment of the integer in bits.  Return 1 if we were able to output
+   the constant, otherwise 0.  If FORCE is non-zero, abort if we can't output
+   the constant.  */
 
 int
-assemble_integer (x, size, force)
+assemble_integer (x, size, align, force)
      rtx x;
-     int size;
+     unsigned int size;
+     unsigned int align;
      int force;
 {
   /* First try to use the standard 1, 2, 4, 8, and 16 byte
      ASM_OUTPUT... macros.  */
 
-  switch (size)
-    {
+  if (align >= size * BITS_PER_UNIT)
+    switch (size)
+      {
 #ifdef ASM_OUTPUT_CHAR
-    case 1:
-      ASM_OUTPUT_CHAR (asm_out_file, x);
-      return 1;
+      case 1:
+	ASM_OUTPUT_CHAR (asm_out_file, x);
+	return 1;
 #endif
-
 #ifdef ASM_OUTPUT_SHORT
-    case 2:
-      ASM_OUTPUT_SHORT (asm_out_file, x);
-      return 1;
+      case 2:
+	ASM_OUTPUT_SHORT (asm_out_file, x);
+	return 1;
 #endif
-
 #ifdef ASM_OUTPUT_INT
-    case 4:
-      ASM_OUTPUT_INT (asm_out_file, x);
-      return 1;
+      case 4:
+	ASM_OUTPUT_INT (asm_out_file, x);
+	return 1;
 #endif
-
 #ifdef ASM_OUTPUT_DOUBLE_INT
-    case 8:
-      ASM_OUTPUT_DOUBLE_INT (asm_out_file, x);
-      return 1;
+      case 8:
+	ASM_OUTPUT_DOUBLE_INT (asm_out_file, x);
+	return 1;
 #endif
-
 #ifdef ASM_OUTPUT_QUADRUPLE_INT
-    case 16:
-      ASM_OUTPUT_QUADRUPLE_INT (asm_out_file, x);
-      return 1;
+      case 16:
+	ASM_OUTPUT_QUADRUPLE_INT (asm_out_file, x);
+	return 1;
+#endif
+      }
+  else
+    {
+      const char *asm_op = NULL;
+
+      switch (size)
+	{
+#ifdef UNALIGNED_SHORT_ASM_OP
+	case 2:
+	  asm_op = UNALIGNED_SHORT_ASM_OP;
+	  break;
+#endif
+#ifdef UNALIGNED_INT_ASM_OP
+	case 4:
+	  asm_op = UNALIGNED_INT_ASM_OP;
+	  break;
+#endif
+#ifdef UNALIGNED_DOUBLE_INT_ASM_OP
+	case 8:
+	  asm_op = UNALIGNED_DOUBLE_INT_ASM_OP;
+	  break;
 #endif
+	}
+
+      if (asm_op)
+	{
+	  fputs (asm_op, asm_out_file);
+	  output_addr_const (asm_out_file, x);
+	  fputc ('\n', asm_out_file);
+	  return 1;
+	}
     }
 
   /* If we couldn't do it that way, there are two other possibilities: First,
@@ -1861,24 +1883,22 @@ assemble_integer (x, size, force)
     }
 #endif
 
-  /* Finally, if SIZE is larger than a single word, try to output the constant
+  /* If SIZE is larger than a single word, try to output the constant
      one word at a time.  */
 
   if (size > UNITS_PER_WORD)
     {
-      int i;
       enum machine_mode mode
 	= mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
-      rtx word;
+      unsigned align2 = min_align (align, BITS_PER_WORD);
+      unsigned int i;
 
       for (i = 0; i < size / UNITS_PER_WORD; i++)
 	{
-	  word = operand_subword (x, i, 0, mode);
-
+	  rtx word = operand_subword (x, i, 0, mode);
 	  if (word == 0)
 	    break;
-
-	  if (! assemble_integer (word, UNITS_PER_WORD, 0))
+	  if (! assemble_integer (word, UNITS_PER_WORD, align2, 0))
 	    break;
 	}
 
@@ -1890,6 +1910,32 @@ assemble_integer (x, size, force)
 	abort ();
     }
 
+  /* If unaligned, and this is a constant, emit it one byte at a time.  */
+  if (align < size * BITS_PER_UNIT)
+    {
+      enum machine_mode omode, imode;
+      unsigned int i;
+ 
+      omode = mode_for_size (BITS_PER_UNIT, MODE_INT, 0);
+      imode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
+
+      for (i = 0; i < size; i++)
+	{
+	  rtx byte = simplify_subreg (omode, x, imode, i);
+	  if (byte == 0)
+	    break;
+	  if (! assemble_integer (byte, 1, BITS_PER_UNIT, 0))
+	    break;
+	}
+
+      if (i == size)
+	return 1;
+      /* If we output at least one byte and then could not finish,
+	 there is no valid way to continue.  */
+      if (i > 0)
+	abort ();
+    }
+
   if (force)
     abort ();
 
@@ -1953,14 +1999,25 @@ assemble_real_1 (p)
 }
 
 void
-assemble_real (d, mode)
+assemble_real (d, mode, align)
      REAL_VALUE_TYPE d;
      enum machine_mode mode;
+     unsigned int align;
 {
   struct assemble_real_args args;
   args.d = &d;
   args.mode = mode;
 
+  /* We cannot emit unaligned floating point constants.  This is slightly
+     complicated in that we don't know what "unaligned" means exactly.  */
+#ifdef BIGGEST_FIELD_ALIGNMENT
+  if (align >= BIGGEST_FIELD_ALIGNMENT)
+    ;
+  else
+#endif
+  if (align < GET_MODE_ALIGNMENT (mode))
+    abort ();
+
   if (do_float_handler (assemble_real_1, (PTR) &args))
     return;
 
@@ -3280,7 +3337,8 @@ output_constant_def_contents (exp, reloc, labelno)
 		   (TREE_CODE (exp) == STRING_CST
 		    ? MAX (TREE_STRING_LENGTH (exp),
 			   int_size_in_bytes (TREE_TYPE (exp)))
-		    : int_size_in_bytes (TREE_TYPE (exp))));
+		    : int_size_in_bytes (TREE_TYPE (exp))),
+		   align);
 
 }
 
@@ -3841,12 +3899,12 @@ output_constant_pool (fnname, fndecl)
 	    abort ();
 
 	  memcpy ((char *) &u, (char *) &CONST_DOUBLE_LOW (x), sizeof u);
-	  assemble_real (u.d, pool->mode);
+	  assemble_real (u.d, pool->mode, pool->align);
 	  break;
 
 	case MODE_INT:
 	case MODE_PARTIAL_INT:
-	  assemble_integer (x, GET_MODE_SIZE (pool->mode), 1);
+	  assemble_integer (x, GET_MODE_SIZE (pool->mode), pool->align, 1);
 	  break;
 
 	default:
@@ -3856,7 +3914,6 @@ output_constant_pool (fnname, fndecl)
 #ifdef ASM_OUTPUT_SPECIAL_POOL_ENTRY
     done: ;
 #endif
-
     }
 
 #ifdef ASM_OUTPUT_POOL_EPILOGUE
@@ -4258,12 +4315,15 @@ initializer_constant_valid_p (value, endtype)
 
    There a case in which we would fail to output exactly SIZE bytes:
    for a structure constructor that wants to produce more than SIZE bytes.
-   But such constructors will never be generated for any possible input.  */
+   But such constructors will never be generated for any possible input.
+
+   ALIGN is the alignment of the data in bits.  */
 
 void
-output_constant (exp, size)
-     register tree exp;
-     register int size;
+output_constant (exp, size, align)
+     tree exp;
+     int size;
+     unsigned int align;
 {
   register enum tree_code code = TREE_CODE (TREE_TYPE (exp));
 
@@ -4318,7 +4378,7 @@ output_constant (exp, size)
 
       if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
 					   EXPAND_INITIALIZER),
-			      size, 0))
+			      size, align, 0))
 	error ("initializer for integer value is too complicated");
       size = 0;
       break;
@@ -4328,20 +4388,22 @@ output_constant (exp, size)
 	error ("initializer for floating value is not a floating constant");
 
       assemble_real (TREE_REAL_CST (exp),
-		     mode_for_size (size * BITS_PER_UNIT, MODE_FLOAT, 0));
+		     mode_for_size (size * BITS_PER_UNIT, MODE_FLOAT, 0),
+		     align);
       size = 0;
       break;
 
     case COMPLEX_TYPE:
-      output_constant (TREE_REALPART (exp), size / 2);
-      output_constant (TREE_IMAGPART (exp), size / 2);
+      output_constant (TREE_REALPART (exp), size / 2, align);
+      output_constant (TREE_IMAGPART (exp), size / 2,
+		       min_align (align, BITS_PER_UNIT * (size / 2)));
       size -= (size / 2) * 2;
       break;
 
     case ARRAY_TYPE:
       if (TREE_CODE (exp) == CONSTRUCTOR)
 	{
-	  output_constructor (exp, size);
+	  output_constructor (exp, size, align);
 	  return;
 	}
       else if (TREE_CODE (exp) == STRING_CST)
@@ -4364,7 +4426,7 @@ output_constant (exp, size)
     case RECORD_TYPE:
     case UNION_TYPE:
       if (TREE_CODE (exp) == CONSTRUCTOR)
-	output_constructor (exp, size);
+	output_constructor (exp, size, align);
       else
 	abort ();
       return;
@@ -4373,7 +4435,7 @@ output_constant (exp, size)
       if (TREE_CODE (exp) == INTEGER_CST)
 	assemble_integer (expand_expr (exp, NULL_RTX,
 				       VOIDmode, EXPAND_INITIALIZER),
-			  size, 1);
+			  size, align, 1);
       else if (TREE_CODE (exp) == CONSTRUCTOR)
 	{
 	  unsigned char *buffer = (unsigned char *) alloca (size);
@@ -4434,9 +4496,10 @@ array_size_for_constructor (val)
    Generate at least SIZE bytes, padding if necessary.  */
 
 static void
-output_constructor (exp, size)
+output_constructor (exp, size, align)
      tree exp;
      int size;
+     unsigned int align;
 {
   tree type = TREE_TYPE (exp);
   register tree link, field = 0;
@@ -4496,6 +4559,7 @@ output_constructor (exp, size)
 	  HOST_WIDE_INT lo_index = tree_low_cst (TREE_OPERAND (index, 0), 0);
 	  HOST_WIDE_INT hi_index = tree_low_cst (TREE_OPERAND (index, 1), 0);
 	  HOST_WIDE_INT index;
+	  unsigned int align2 = min_align (align, fieldsize * BITS_PER_UNIT);
 
 	  for (index = lo_index; index <= hi_index; index++)
 	    {
@@ -4503,7 +4567,7 @@ output_constructor (exp, size)
 	      if (val == 0)
 		assemble_zeros (fieldsize);
 	      else
-		output_constant (val, fieldsize);
+		output_constant (val, fieldsize, align2);
 
 	      /* Count its size.  */
 	      total_bytes += fieldsize;
@@ -4517,6 +4581,7 @@ output_constructor (exp, size)
 	  /* Since this structure is static,
 	     we know the positions are constant.  */
 	  HOST_WIDE_INT pos = field ? int_byte_position (field) : 0;
+	  unsigned int align2;
 
 	  if (index != 0)
 	    pos = (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (val)), 1)
@@ -4539,13 +4604,9 @@ output_constructor (exp, size)
 	      total_bytes = pos;
 	    }
 
-          else if (field != 0 && DECL_PACKED (field))
-	    /* Some assemblers automaticallly align a datum according to its
-	       size if no align directive is specified.  The datum, however,
-	       may be declared with 'packed' attribute, so we have to disable
-	       such a feature.  */
-	    ASM_OUTPUT_ALIGN (asm_out_file, 0);
-
+	  /* Find the alignment of this element.  */
+	  align2 = min_align (align, BITS_PER_UNIT * pos);
+	  
 	  /* Determine size this element should occupy.  */
 	  if (field)
 	    {
@@ -4581,7 +4642,7 @@ output_constructor (exp, size)
 	  if (val == 0)
 	    assemble_zeros (fieldsize);
 	  else
-	    output_constant (val, fieldsize);
+	    output_constant (val, fieldsize, align2);
 
 	  /* Count its size.  */
 	  total_bytes += fieldsize;
-- 
GitLab