This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

PATCH: PR ld/13616: linker should pad executable sections with nops, not zeros


Linker pads text sections with nop via linker script.  It doesn't work
on orphaned sections. This patch adds a fill function to bfd_arch_info
so that each arch can provide appropriate no-op sequence based on size
and endian.  I added x86 fill function and the default fill function
keeps existing behavior.  I also changed the x86 ELF linkers to use x86
fill function instead of fixed no-op.  OK to install?

Thanks.


H.J.
---
bfd/

2012-01-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/13616
	* archures.c (bfd_arch_info): Add fill.
	(bfd_default_arch_struct): Add bfd_arch_default_fill.
	(bfd_arch_default_fill): New.

	* cpu-alpha.c: Add bfd_arch_default_fill to bfd_arch_info
	initializer.
	* cpu-arc.c: Likewise.
	* cpu-arm.c: Likewise.
	* cpu-avr.c: Likewise.
	* cpu-bfin.c: Likewise.
	* cpu-cr16.c: Likewise.
	* cpu-cr16c.c: Likewise.
	* cpu-cris.c: Likewise.
	* cpu-crx.c: Likewise.
	* cpu-d10v.c: Likewise.
	* cpu-d30v.c: Likewise.
	* cpu-dlx.c: Likewise.
	* cpu-epiphany.c: Likewise.
	* cpu-fr30.c: Likewise.
	* cpu-frv.c: Likewise.
	* cpu-h8300.c: Likewise.
	* cpu-h8500.c: Likewise.
	* cpu-hppa.c: Likewise.
	* cpu-i370.c: Likewise.
	* cpu-i860.c: Likewise.
	* cpu-i960.c: Likewise.
	* cpu-ia64.c: Likewise.
	* cpu-ip2k.c: Likewise.
	* cpu-iq2000.c: Likewise.
	* cpu-lm32.c: Likewise.
	* cpu-m10200.c: Likewise.
	* cpu-m10300.c: Likewise.
	* cpu-m32c.c: Likewise.
	* cpu-m32r.c: Likewise.
	* cpu-m68hc11.c: Likewise.
	* cpu-m68hc12.c: Likewise.
	* cpu-m68k.c: Likewise.
	* cpu-m88k.c: Likewise.
	* cpu-mcore.c: Likewise.
	* cpu-mep.c: Likewise.
	* cpu-microblaze.c: Likewise.
	* cpu-mips.c: Likewise.
	* cpu-mmix.c: Likewise.
	* cpu-moxie.c: Likewise.
	* cpu-msp430.c: Likewise.
	* cpu-mt.c: Likewise.
	* cpu-ns32k.c: Likewise.
	* cpu-openrisc.c: Likewise.
	* cpu-or32.c: Likewise.
	* cpu-pdp11.c: Likewise.
	* cpu-pj.c: Likewise.
	* cpu-plugin.c: Likewise.
	* cpu-powerpc.c: Likewise.
	* cpu-rl78.c: Likewise.
	* cpu-rs6000.c: Likewise.
	* cpu-rx.c: Likewise.
	* cpu-s390.c: Likewise.
	* cpu-score.c: Likewise.
	* cpu-sh.c: Likewise.
	* cpu-sparc.c: Likewise.
	* cpu-spu.c: Likewise.
	* cpu-tic30.c: Likewise.
	* cpu-tic4x.c: Likewise.
	* cpu-tic54x.c: Likewise.
	* cpu-tic6x.c: Likewise.
	* cpu-tic80.c: Likewise.
	* cpu-tilegx.c: Likewise.
	* cpu-tilepro.c: Likewise.
	* cpu-v850.c: Likewise.
	* cpu-vax.c: Likewise.
	* cpu-w65.c: Likewise.
	* cpu-we32k.c: Likewise.
	* cpu-xc16x.c: Likewise.
	* cpu-xstormy16.c: Likewise.
	* cpu-xtensa.c: Likewise.
	* cpu-z80.c: Likewise.
	* cpu-z8k.c: Likewise.

	* cpu-i386.c: Include "libiberty.h".
	(bfd_arch_i386_fill): New. 
	Add bfd_arch_i386_fill to  bfd_arch_info initializer.

	* cpu-k1om.c: Add bfd_arch_i386_fill to  bfd_arch_info initializer.
	* cpu-l1om.c: Likewise.

	* linker.c (default_data_link_order): Call abfd->arch_info->fill 
	if fill size is 0.

	* bfd-in2.h: Regenerated.

include/

2012-01-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/13616
	* bfdlink.h (bfd_link_order): Update comments on data size.

ld/

2012-01-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/13616
	* emulparams/elf32_x86_64.sh: Remove NOP.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_i386_be.sh: Likewise.
	* emulparams/elf_i386_ldso.sh: Likewise.
	* emulparams/elf_i386_vxworks.sh: Likewise.
	* emulparams/elf_k1om.sh: Likewise.
	* emulparams/elf_l1om.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.

	* ldlang.c (zero_fill): Initialized to 0.

	* ldwrite.c (build_link_order): Set data size to linker odrder
	size when they are the same.

	* scripttempl/elf.sc: Don't specify fill if NOP is undefined.

ld/testsuite/

2012-01-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/13616
	* ld-i386/tlsbindesc.dd: Update no-op padding.
	* ld-i386/tlsnopic.dd: Likewise. 
	* ld-i386/tlspic.dd: Likewise. 
	* ld-x86-64/tlsbin.dd: Likewise. 
	* ld-x86-64/tlsbindesc.dd: Likewise. 
	* ld-x86-64/tlspic.dd: Likewise. 

diff --git a/bfd/archures.c b/bfd/archures.c
index f609534..c833cbf 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -485,6 +485,12 @@ DESCRIPTION
 .
 .  bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
 .
+.  {* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
+.     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
+.     TRUE, the buffer contains code.  *}
+.  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
+.		  bfd_boolean code);
+.
 .  const struct bfd_arch_info *next;
 .}
 .bfd_arch_info_type;
@@ -814,6 +820,7 @@ const bfd_arch_info_type bfd_default_arch_struct = {
   32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
 
@@ -1309,3 +1316,29 @@ bfd_arch_mach_octets_per_byte (enum bfd_architecture arch,
     return ap->bits_per_byte / 8;
   return 1;
 }
+
+/*
+INTERNAL_FUNCTION
+	bfd_arch_default_fill
+
+SYNOPSIS
+	void *bfd_arch_default_fill (bfd_size_type count,
+				     bfd_boolean is_bigendian,
+				     bfd_boolean code);
+
+DESCRIPTION
+	Allocate via bfd_malloc and return a fill buffer of size COUNT.
+	If IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If
+	CODE is TRUE, the buffer contains code.
+*/
+
+void *
+bfd_arch_default_fill (bfd_size_type count,
+		       bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+		       bfd_boolean code ATTRIBUTE_UNUSED)
+{
+  void *fill = bfd_malloc (count);
+  if (fill != NULL)
+    memset (fill, 0, count);
+  return fill;
+}
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 1523660..5072e43 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2161,7 +2161,6 @@ enum bfd_architecture
 #define bfd_mach_tilegx    1
   bfd_arch_last
   };
-
 typedef struct bfd_arch_info
 {
   int bits_per_word;
@@ -2181,6 +2180,12 @@ typedef struct bfd_arch_info
 
   bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
 
+  /* Allocate via bfd_malloc and return a fill buffer of size COUNT.  If
+     IS_BIGENDIAN is TRUE, the order of bytes is big endian.  If CODE is
+     TRUE, the buffer contains code.  */
+  void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
+                 bfd_boolean code);
+
   const struct bfd_arch_info *next;
 }
 bfd_arch_info_type;
diff --git a/bfd/cpu-alpha.c b/bfd/cpu-alpha.c
index 9456b65..902eb8d 100644
--- a/bfd/cpu-alpha.c
+++ b/bfd/cpu-alpha.c
@@ -36,6 +36,7 @@
     DEFAULT,						\
     bfd_default_compatible, 				\
     bfd_default_scan,					\
+    bfd_arch_default_fill,				\
     NEXT,						\
   }
 
diff --git a/bfd/cpu-arc.c b/bfd/cpu-arc.c
index 820c948..5acfc1c 100644
--- a/bfd/cpu-arc.c
+++ b/bfd/cpu-arc.c
@@ -37,6 +37,7 @@
     default_p,				\
     bfd_default_compatible,		\
     bfd_default_scan,			\
+    bfd_arch_default_fill,		\
     next,				\
   }
 
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index 2238720..21a8d0f 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -124,7 +124,8 @@ scan (const struct bfd_arch_info *info, const char *string)
 }
 
 #define N(number, print, default, next)  \
-{  32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
+{  32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, \
+   scan, bfd_arch_default_fill, next }
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index 07ba6dc..37ccee1 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -96,6 +96,7 @@ compatible (const bfd_arch_info_type * a,
   default,			/* Is this the default ?  */	\
   compatible,							\
   bfd_default_scan,						\
+  bfd_arch_default_fill,					\
   next								\
 }
 
diff --git a/bfd/cpu-bfin.c b/bfd/cpu-bfin.c
index 37e314b..ec515ea 100644
--- a/bfd/cpu-bfin.c
+++ b/bfd/cpu-bfin.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_bfin_arch =
     4,                	/* Section align power.  */
     TRUE,             	/* The one and only.  */
     bfd_default_compatible, 
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-cr16.c b/bfd/cpu-cr16.c
index 6c77738..bcaaf60 100644
--- a/bfd/cpu-cr16.c
+++ b/bfd/cpu-cr16.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_cr16_arch =
     1,                /* Unsigned int section alignment power.  */
     TRUE,             /* The one and only.  */
     bfd_default_compatible, 
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-cr16c.c b/bfd/cpu-cr16c.c
index e8ee1db..7653f2c 100644
--- a/bfd/cpu-cr16c.c
+++ b/bfd/cpu-cr16c.c
@@ -34,6 +34,7 @@ const bfd_arch_info_type bfd_cr16c_arch =
     1,
     TRUE, 	/* The one and only.  */
     bfd_default_compatible, 
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-cris.c b/bfd/cpu-cris.c
index c77e8f5..9cdcf18 100644
--- a/bfd/cpu-cris.c
+++ b/bfd/cpu-cris.c
@@ -69,7 +69,7 @@ get_compatible (a,b)
 
 #define N(NUMBER, PRINT, NEXT)  \
  { 32, 32, 8, bfd_arch_cris, NUMBER, "cris", PRINT, 1, FALSE, \
-   get_compatible, bfd_default_scan, NEXT }
+   get_compatible, bfd_default_scan, bfd_arch_default_fill, NEXT }
 
 static const bfd_arch_info_type bfd_cris_arch_compat_v10_v32 =
  N (bfd_mach_cris_v10_v32, "cris:common_v10_v32", NULL);
@@ -98,6 +98,7 @@ const bfd_arch_info_type bfd_cris_arch =
 				   bfd_arch_info_type.  */
   bfd_default_scan,		/* Check if a bfd_arch_info_type is a
 				   match.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   &bfd_cris_arch_v32		/* Pointer to next bfd_arch_info_type in
 				   the same family.  */
 };
diff --git a/bfd/cpu-crx.c b/bfd/cpu-crx.c
index 3201c3c..8edd2ca 100644
--- a/bfd/cpu-crx.c
+++ b/bfd/cpu-crx.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_crx_arch =
     1,      	/* Unsigned int section alignment power.  */
     TRUE, 	/* The one and only.  */
     bfd_default_compatible, 
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-d10v.c b/bfd/cpu-d10v.c
index b161115..7bc208e 100644
--- a/bfd/cpu-d10v.c
+++ b/bfd/cpu-d10v.c
@@ -37,6 +37,7 @@ static const bfd_arch_info_type d10v_ts3_info =
   FALSE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
 
@@ -53,6 +54,7 @@ static const bfd_arch_info_type d10v_ts2_info =
   FALSE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   & d10v_ts3_info,
 };
 
@@ -69,5 +71,6 @@ const bfd_arch_info_type bfd_d10v_arch =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   & d10v_ts2_info,
 };
diff --git a/bfd/cpu-d30v.c b/bfd/cpu-d30v.c
index d528e9b..69515eb 100644
--- a/bfd/cpu-d30v.c
+++ b/bfd/cpu-d30v.c
@@ -36,5 +36,6 @@ const bfd_arch_info_type bfd_d30v_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
 };
diff --git a/bfd/cpu-dlx.c b/bfd/cpu-dlx.c
index fda48dc..2c17849 100644
--- a/bfd/cpu-dlx.c
+++ b/bfd/cpu-dlx.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_dlx_arch =
     4,
     TRUE, /* The one and only.  */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
 };
diff --git a/bfd/cpu-epiphany.c b/bfd/cpu-epiphany.c
index 13427c1..9cf723e 100644
--- a/bfd/cpu-epiphany.c
+++ b/bfd/cpu-epiphany.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type bfd_epiphany16_arch =
   FALSE,			/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 };
 
@@ -52,5 +53,6 @@ const bfd_arch_info_type bfd_epiphany_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   & bfd_epiphany16_arch	/* Next in list.  */
 };
diff --git a/bfd/cpu-fr30.c b/bfd/cpu-fr30.c
index b60e43e..dc2e5fa 100644
--- a/bfd/cpu-fr30.c
+++ b/bfd/cpu-fr30.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_fr30_arch =
   TRUE,				/* the default ? */
   bfd_default_compatible,	/* architecture comparison fn */
   bfd_default_scan,		/* string to architecture convert fn */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* next in list */
 };
diff --git a/bfd/cpu-frv.c b/bfd/cpu-frv.c
index fd2aedb..ac4d898 100644
--- a/bfd/cpu-frv.c
+++ b/bfd/cpu-frv.c
@@ -35,6 +35,7 @@
   DEFAULT,			/* is this the default? */		\
   bfd_default_compatible,	/* architecture comparison fn */	\
   bfd_default_scan,		/* string to architecture convert fn */	\
+  bfd_arch_default_fill,	/* Default fill.  */			\
   NEXT				/* next in list */			\
 }
 
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index 0fd77d6..e667a03 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -127,6 +127,7 @@ static const bfd_arch_info_type h8300sxn_info_struct =
   FALSE,			/* the default machine */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   0
 };
 
@@ -143,6 +144,7 @@ static const bfd_arch_info_type h8300sx_info_struct =
   FALSE,			/* the default machine */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   &h8300sxn_info_struct
 };
 
@@ -159,6 +161,7 @@ static const bfd_arch_info_type h8300sn_info_struct =
   FALSE,			/* The default machine.  */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   &h8300sx_info_struct
 };
 
@@ -175,6 +178,7 @@ static const bfd_arch_info_type h8300hn_info_struct =
   FALSE,			/* The default machine.  */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   &h8300sn_info_struct
 };
 
@@ -191,6 +195,7 @@ static const bfd_arch_info_type h8300s_info_struct =
   FALSE,			/* The default machine.  */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   & h8300hn_info_struct
 };
 
@@ -207,6 +212,7 @@ static const bfd_arch_info_type h8300h_info_struct =
   FALSE,			/* The default machine.  */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   &h8300s_info_struct
 };
 
@@ -223,6 +229,7 @@ const bfd_arch_info_type bfd_h8300_arch =
   TRUE,				/* The default machine.  */
   compatible,
   h8300_scan,
+  bfd_arch_default_fill,
   &h8300h_info_struct
 };
 
diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c
index 362d369..b87179b 100644
--- a/bfd/cpu-h8500.c
+++ b/bfd/cpu-h8500.c
@@ -56,5 +56,6 @@ const bfd_arch_info_type bfd_h8500_arch =
   TRUE,				/* the default machine */
   bfd_default_compatible,
   scan_mach,
+  bfd_arch_default_fill,
   0,
 };
diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c
index 034e321..885a11a 100644
--- a/bfd/cpu-hppa.c
+++ b/bfd/cpu-hppa.c
@@ -35,7 +35,8 @@ static const bfd_arch_info_type bfd_hppa10_arch =
   3,
   TRUE,				/* Unless we use 1.1 specific features */
   bfd_default_compatible,
-  bfd_default_scan ,
+  bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
 
@@ -52,7 +53,8 @@ static const bfd_arch_info_type bfd_hppa20_arch =
   3,
   FALSE,			/* Unless we use 1.1 specific features */
   bfd_default_compatible,
-  bfd_default_scan ,
+  bfd_default_scan,
+  bfd_arch_default_fill,
   &bfd_hppa10_arch,
 };
 
@@ -69,7 +71,8 @@ static const bfd_arch_info_type bfd_hppa20w_arch =
   3,
   FALSE,			/* Unless we use 1.1 specific features */
   bfd_default_compatible,
-  bfd_default_scan ,
+  bfd_default_scan,
+  bfd_arch_default_fill,
   &bfd_hppa20_arch,
 };
 
@@ -85,6 +88,7 @@ const bfd_arch_info_type bfd_hppa_arch =
   3,
   FALSE,			/* 1.1 specific features used */
   bfd_default_compatible,
-  bfd_default_scan ,
+  bfd_default_scan,
+  bfd_arch_default_fill,
   &bfd_hppa20w_arch,
 };
diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c
index d12b9ae..99daf88 100644
--- a/bfd/cpu-i370.c
+++ b/bfd/cpu-i370.c
@@ -40,6 +40,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE, 	/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[1]
   },
   {
@@ -54,6 +55,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE, 	/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0
   },
 };
@@ -71,5 +73,6 @@ const bfd_arch_info_type bfd_i370_arch =
   TRUE, 	/* The default.  */
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   & arch_info_struct[0]
 };
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index f98c0e5..f8991cf 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -23,6 +23,9 @@
 #include "sysdep.h"
 #include "bfd.h"
 #include "libbfd.h"
+#include "libiberty.h"
+
+extern void * bfd_arch_i386_fill (bfd_size_type, bfd_boolean, bfd_boolean);
 
 static const bfd_arch_info_type *
 bfd_i386_compatible (const bfd_arch_info_type *a,
@@ -38,6 +41,62 @@ bfd_i386_compatible (const bfd_arch_info_type *a,
   return compat;
 }
 
+/* Fill the buffer with zero or nop instruction if CODE is TRUE.  */
+
+void *
+bfd_arch_i386_fill (bfd_size_type count,
+		    bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
+		    bfd_boolean code)
+{
+  /* nop */
+  static const char nop_1[] = { 0x90 };	
+  /* nopw */
+  static const char nop_2[] = { 0x66, 0x90 };
+  /* nopl (%[re]ax) */
+  static const char nop_3[] = { 0x0f, 0x1f, 0x00 };
+  /* nopl 0(%[re]ax) */
+  static const char nop_4[] = { 0x0f, 0x1f, 0x40, 0x00 };
+  /* nopl 0(%[re]ax,%[re]ax,1) */
+  static const char nop_5[] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 };
+  /* nopw 0(%[re]ax,%[re]ax,1) */
+  static const char nop_6[] = { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 };
+  /* nopl 0L(%[re]ax) */
+  static const char nop_7[] = { 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00 };
+  /* nopl 0L(%[re]ax,%[re]ax,1) */
+  static const char nop_8[] =
+    { 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00};
+  /* nopw 0L(%[re]ax,%[re]ax,1) */
+  static const char nop_9[] =
+    { 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 };
+  /* nopw %cs:0L(%[re]ax,%[re]ax,1) */
+  static const char nop_10[] =
+    { 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 };
+  static const char *const nops[] =
+    { nop_1, nop_2, nop_3, nop_4, nop_5,
+      nop_6, nop_7, nop_8, nop_9, nop_10 };
+
+  void *fill = bfd_malloc (count);
+  if (fill == NULL)
+    return fill;
+
+  if (code)
+    {
+      bfd_byte *p = fill;
+      while (count >= ARRAY_SIZE (nops))
+	{
+	  memcpy (p, nops[ARRAY_SIZE (nops) - 1], ARRAY_SIZE (nops));
+	  p += ARRAY_SIZE (nops);
+	  count -= ARRAY_SIZE (nops);
+	}
+      if (count != 0)
+	memcpy (p, nops[count - 1], count);
+    }
+  else
+    memset (fill, 0, count);
+
+  return fill;
+}
+
 static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -51,6 +110,7 @@ static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   0
 };
 
@@ -67,6 +127,7 @@ static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_x64_32_arch_intel_syntax,
 };
 
@@ -83,6 +144,7 @@ static const bfd_arch_info_type bfd_i386_arch_intel_syntax =
   TRUE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_x86_64_arch_intel_syntax
 };
 
@@ -99,6 +161,7 @@ static const bfd_arch_info_type i8086_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_i386_arch_intel_syntax
 };
 
@@ -115,6 +178,7 @@ static const bfd_arch_info_type bfd_x64_32_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &i8086_arch
 };
 
@@ -131,6 +195,7 @@ static const bfd_arch_info_type bfd_x86_64_arch =
   FALSE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_x64_32_arch
 };
 
@@ -147,5 +212,6 @@ const bfd_arch_info_type bfd_i386_arch =
   TRUE,
   bfd_i386_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_x86_64_arch
 };
diff --git a/bfd/cpu-i860.c b/bfd/cpu-i860.c
index ae9ebcd..77c5e84 100644
--- a/bfd/cpu-i860.c
+++ b/bfd/cpu-i860.c
@@ -38,5 +38,6 @@ const bfd_arch_info_type bfd_i860_arch =
     TRUE,			/* Is this the default architecture? */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,				/* Next in list */
   };
diff --git a/bfd/cpu-i960.c b/bfd/cpu-i960.c
index c7d9231..cef2f80 100644
--- a/bfd/cpu-i960.c
+++ b/bfd/cpu-i960.c
@@ -166,7 +166,8 @@ compatible (a,b)
 }
 
 #define N(a,b,d,n) \
-{ 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,}
+{ 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach, \
+  bfd_arch_default_fill, n,}
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
diff --git a/bfd/cpu-ia64.c b/bfd/cpu-ia64.c
index c97de1a..4ea37c7 100644
--- a/bfd/cpu-ia64.c
+++ b/bfd/cpu-ia64.c
@@ -35,7 +35,8 @@ const bfd_arch_info_type bfd_ia64_elf32_arch =
     3,	/* log2 of section alignment */
     TRUE, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
 
@@ -51,7 +52,8 @@ const bfd_arch_info_type bfd_ia64_arch =
     3,	/* log2 of section alignment */
     TRUE, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_ia64_elf32_arch,
   };
 
diff --git a/bfd/cpu-ip2k.c b/bfd/cpu-ip2k.c
index 0b959bd..d8eaf3c 100644
--- a/bfd/cpu-ip2k.c
+++ b/bfd/cpu-ip2k.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_ip2k_nonext_arch =
   FALSE,		        /* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 };
 
@@ -51,5 +52,6 @@ const bfd_arch_info_type bfd_ip2k_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   & bfd_ip2k_nonext_arch	/* Next in list.  */
 };
diff --git a/bfd/cpu-iq2000.c b/bfd/cpu-iq2000.c
index 72d8363..648380e 100644
--- a/bfd/cpu-iq2000.c
+++ b/bfd/cpu-iq2000.c
@@ -36,6 +36,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* the default ? */
     bfd_default_compatible,	/* architecture comparison fn */
     bfd_default_scan,		/* string to architecture convert fn */
+    bfd_arch_default_fill,	/* Default fill.  */
     NULL			/* next in list */
   }
 };
@@ -53,5 +54,6 @@ const bfd_arch_info_type bfd_iq2000_arch =
   TRUE,				/* the default ? */
   bfd_default_compatible,	/* architecture comparison fn */
   bfd_default_scan,		/* string to architecture convert fn */
+  bfd_arch_default_fill,	/* Default fill.  */
   &arch_info_struct[0],		/* next in list */
 };
diff --git a/bfd/cpu-k1om.c b/bfd/cpu-k1om.c
index fa030ae..f9958e4 100644
--- a/bfd/cpu-k1om.c
+++ b/bfd/cpu-k1om.c
@@ -23,6 +23,8 @@
 #include "bfd.h"
 #include "libbfd.h"
 
+extern void * bfd_arch_i386_fill (bfd_size_type, bfd_boolean, bfd_boolean);
+
 static const bfd_arch_info_type bfd_k1om_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -36,6 +38,7 @@ static const bfd_arch_info_type bfd_k1om_arch_intel_syntax =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   0
 };
 
@@ -52,5 +55,6 @@ const bfd_arch_info_type bfd_k1om_arch =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_k1om_arch_intel_syntax
 };
diff --git a/bfd/cpu-l1om.c b/bfd/cpu-l1om.c
index c1057c4..0fabd49 100644
--- a/bfd/cpu-l1om.c
+++ b/bfd/cpu-l1om.c
@@ -23,6 +23,8 @@
 #include "bfd.h"
 #include "libbfd.h"
 
+extern void * bfd_arch_i386_fill (bfd_size_type, bfd_boolean, bfd_boolean);
+
 static const bfd_arch_info_type bfd_l1om_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
@@ -36,6 +38,7 @@ static const bfd_arch_info_type bfd_l1om_arch_intel_syntax =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   0
 };
 
@@ -52,5 +55,6 @@ const bfd_arch_info_type bfd_l1om_arch =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_i386_fill,
   &bfd_l1om_arch_intel_syntax
 };
diff --git a/bfd/cpu-lm32.c b/bfd/cpu-lm32.c
index 227612f..5ddce04 100644
--- a/bfd/cpu-lm32.c
+++ b/bfd/cpu-lm32.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type bfd_lm32_arch =
     TRUE,                         /* Is this the default machine for the target.  */
     bfd_default_compatible,       /* Function callback to test if two files have compatible machines.  */
     bfd_default_scan,
+    bfd_arch_default_fill,
     NULL                          /* Next.  */
 };
 
diff --git a/bfd/cpu-m10200.c b/bfd/cpu-m10200.c
index 218891d..f42a5ea 100644
--- a/bfd/cpu-m10200.c
+++ b/bfd/cpu-m10200.c
@@ -34,6 +34,7 @@ const bfd_arch_info_type bfd_mn10200_arch =
     2,
     TRUE, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-m10300.c b/bfd/cpu-m10300.c
index 7f89665..6fd8c67 100644
--- a/bfd/cpu-m10300.c
+++ b/bfd/cpu-m10300.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type bfd_am33_2_arch =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
 
@@ -52,6 +53,7 @@ const bfd_arch_info_type bfd_am33_arch =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_am33_2_arch,
   };
 
@@ -68,5 +70,6 @@ const bfd_arch_info_type bfd_mn10300_arch =
     TRUE, /* the one and only */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_am33_arch,
   };
diff --git a/bfd/cpu-m32c.c b/bfd/cpu-m32c.c
index d2f9cb1..9c26938 100644
--- a/bfd/cpu-m32c.c
+++ b/bfd/cpu-m32c.c
@@ -49,6 +49,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* the default ? */
     bfd_default_compatible,	/* architecture comparison fn */
     m32c_scan,			/* string to architecture convert fn */
+    bfd_arch_default_fill,	/* Default fill.  */
     NULL			/* next in list */
   },
 };
@@ -66,5 +67,6 @@ const bfd_arch_info_type bfd_m32c_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   m32c_scan,			/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   &arch_info_struct[0],		/* Next in list.  */
 };
diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c
index 8180d6c..8f373b4 100644
--- a/bfd/cpu-m32r.c
+++ b/bfd/cpu-m32r.c
@@ -25,7 +25,7 @@
 
 #define N(number, print, default, next)  \
 {  32, 32, 8, bfd_arch_m32r, number, "m32r", print, 4, default, \
-     bfd_default_compatible, bfd_default_scan, next }
+     bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
 
 #define M32R2_NEXT   & arch_info_struct [1]
 #define NEXT         & arch_info_struct [0]
diff --git a/bfd/cpu-m68hc11.c b/bfd/cpu-m68hc11.c
index 313d820..7f3c074 100644
--- a/bfd/cpu-m68hc11.c
+++ b/bfd/cpu-m68hc11.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_m68hc11_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
 };
diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c
index 2a115b9..2dbf627 100644
--- a/bfd/cpu-m68hc12.c
+++ b/bfd/cpu-m68hc12.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_m68hc12s_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
 };
 
@@ -51,5 +52,6 @@ const bfd_arch_info_type bfd_m68hc12_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_m68hc12s_arch,
 };
diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c
index ec9bccd..009ff04 100644
--- a/bfd/cpu-m68k.c
+++ b/bfd/cpu-m68k.c
@@ -30,7 +30,8 @@ bfd_m68k_compatible (const bfd_arch_info_type *a,
 		     const bfd_arch_info_type *b);
 
 #define N(name, print,d,next)  \
-{  32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, }
+{  32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible, \
+   bfd_default_scan, bfd_arch_default_fill, next, }
 
 static const bfd_arch_info_type arch_info_struct[] =
   {
diff --git a/bfd/cpu-m88k.c b/bfd/cpu-m88k.c
index 7e7c18d..d345902 100644
--- a/bfd/cpu-m88k.c
+++ b/bfd/cpu-m88k.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type bfd_m88k_arch =
     3,
     TRUE, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-mcore.c b/bfd/cpu-mcore.c
index c01dd10..80b3290 100644
--- a/bfd/cpu-mcore.c
+++ b/bfd/cpu-mcore.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_mcore_arch =
   TRUE,		  		/* Is this the default architecture ? */
   bfd_default_compatible,	/* Architecture comparison function */
   bfd_default_scan,	   	/* String to architecture conversion */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL			   	/* Next in list */
 };
diff --git a/bfd/cpu-mep.c b/bfd/cpu-mep.c
index 7ac871f..94cb080 100644
--- a/bfd/cpu-mep.c
+++ b/bfd/cpu-mep.c
@@ -22,7 +22,8 @@
 #include "libbfd.h"
 
 #define MA(x, n, def, y) { 32, 32, 8, bfd_arch_mep, x, "mep", n, \
-	2, def, bfd_default_compatible, bfd_default_scan, y }
+	2, def, bfd_default_compatible, bfd_default_scan, \
+	bfd_arch_default_fill, y }
 
 static const bfd_arch_info_type bfd_c5_arch = MA (bfd_mach_mep_c5, "c5", FALSE, NULL);
 static const bfd_arch_info_type bfd_h1_arch = MA (bfd_mach_mep_h1, "h1", FALSE, & bfd_c5_arch);
diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
index 45a4a2b..c59fa45 100644
--- a/bfd/cpu-microblaze.c
+++ b/bfd/cpu-microblaze.c
@@ -36,5 +36,6 @@ const bfd_arch_info_type bfd_microblaze_arch =
   TRUE,		  		/* Is this the default architecture ?  */
   bfd_default_compatible,	/* Architecture comparison function.  */
   bfd_default_scan,	   	/* String to architecture conversion.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL			   	/* Next in list.  */
 };
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index ed86f11..c55cbf0 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -55,6 +55,7 @@ mips_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
     DEFAULT,						\
     mips_compatible,					\
     bfd_default_scan,					\
+    bfd_arch_default_fill,				\
     NEXT,						\
   }
 
diff --git a/bfd/cpu-mmix.c b/bfd/cpu-mmix.c
index 6cf8753..f706b49 100644
--- a/bfd/cpu-mmix.c
+++ b/bfd/cpu-mmix.c
@@ -38,5 +38,6 @@ bfd_mmix_arch =
    TRUE,			/* This is the default architecture.  */
    bfd_default_compatible,	/* Architecture comparison function.  */
    bfd_default_scan,		/* String to architecture conversion.  */
+   bfd_arch_default_fill,	/* Default fill.  */
    NULL				/* Next in list.  */
 };
diff --git a/bfd/cpu-moxie.c b/bfd/cpu-moxie.c
index 39debbc..f514fe7 100644
--- a/bfd/cpu-moxie.c
+++ b/bfd/cpu-moxie.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_moxie_arch =
     2,                /* Unsigned int section alignment power.  */
     TRUE,             /* The one and only.  */
     bfd_default_compatible, 
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-msp430.c b/bfd/cpu-msp430.c
index 63c301a..a17f4c5 100644
--- a/bfd/cpu-msp430.c
+++ b/bfd/cpu-msp430.c
@@ -39,6 +39,7 @@ static const bfd_arch_info_type *compatible
   default,			/* The default machine.  */	\
   compatible,							\
   bfd_default_scan,						\
+  bfd_arch_default_fill,					\
   next								\
 }
 
diff --git a/bfd/cpu-mt.c b/bfd/cpu-mt.c
index 519871d..0ec10c8 100644
--- a/bfd/cpu-mt.c
+++ b/bfd/cpu-mt.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type arch_info_struct[] =
   FALSE,		        /* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   &arch_info_struct[1]          /* Next in list.  */
 },
 {
@@ -50,6 +51,7 @@ const bfd_arch_info_type arch_info_struct[] =
   FALSE,		        /* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 },
 };
@@ -67,6 +69,7 @@ const bfd_arch_info_type bfd_mt_arch =
   TRUE,		        	/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   &arch_info_struct[0]		/* Next in list.  */
 };
 
diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c
index 216b248..28fff5a 100644
--- a/bfd/cpu-ns32k.c
+++ b/bfd/cpu-ns32k.c
@@ -27,7 +27,8 @@
 #include "ns32k.h"
 
 #define N(machine, printable, d, next)  \
-{  32, 32, 8, bfd_arch_ns32k, machine, "ns32k",printable,3,d,bfd_default_compatible,bfd_default_scan, next, }
+{  32, 32, 8, bfd_arch_ns32k, machine, "ns32k",printable,3,d, \
+   bfd_default_compatible,bfd_default_scan,bfd_arch_default_fill,next, }
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
diff --git a/bfd/cpu-openrisc.c b/bfd/cpu-openrisc.c
index a430349..8e3e878 100644
--- a/bfd/cpu-openrisc.c
+++ b/bfd/cpu-openrisc.c
@@ -36,6 +36,7 @@
     DEFAULT,                                                  \
     bfd_default_compatible,                                   \
     bfd_default_scan,                                         \
+    bfd_arch_default_fill,				      \
     NEXT,                                                     \
   }
 
diff --git a/bfd/cpu-or32.c b/bfd/cpu-or32.c
index b9803ed..34ea52b 100644
--- a/bfd/cpu-or32.c
+++ b/bfd/cpu-or32.c
@@ -35,7 +35,8 @@ const bfd_arch_info_type bfd_or32_arch =
     4,
     TRUE,         /* The one and only.  */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
 
diff --git a/bfd/cpu-pdp11.c b/bfd/cpu-pdp11.c
index 3147f56..57c3068 100644
--- a/bfd/cpu-pdp11.c
+++ b/bfd/cpu-pdp11.c
@@ -34,7 +34,8 @@ const bfd_arch_info_type bfd_pdp11_arch =
     1,		/* aligment = 16 bit */
     TRUE, /* the one and only */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
 
diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c
index bb5c85b..3576227 100644
--- a/bfd/cpu-pj.c
+++ b/bfd/cpu-pj.c
@@ -37,5 +37,6 @@ const bfd_arch_info_type bfd_pj_arch =
   TRUE,				/* the default machine */
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0
 };
diff --git a/bfd/cpu-plugin.c b/bfd/cpu-plugin.c
index f0f7dbd..6b25c58 100644
--- a/bfd/cpu-plugin.c
+++ b/bfd/cpu-plugin.c
@@ -36,5 +36,6 @@ const bfd_arch_info_type bfd_plugin_arch =
   TRUE,
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0
 };
diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c
index 9bd60af..6a652b2 100644
--- a/bfd/cpu-powerpc.c
+++ b/bfd/cpu-powerpc.c
@@ -65,6 +65,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     TRUE, /* default for 64 bit target */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[1]
   },
   /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
@@ -81,6 +82,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE,
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[2],
   },
 #else
@@ -97,6 +99,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     TRUE, /* default for 32 bit target */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[1],
   },
   /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
@@ -113,6 +116,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE,
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[2]
   },
 #endif
@@ -128,6 +132,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[3]
   },
   {
@@ -142,6 +147,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[4]
   },
   {
@@ -156,6 +162,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[5]
   },
   {
@@ -170,6 +177,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[6]
   },
   {
@@ -184,6 +192,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[7]
   },
   {
@@ -198,6 +207,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[8]
   },
   {
@@ -212,6 +222,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[9]
   },
   {
@@ -226,6 +237,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[10]
   },
   {
@@ -240,6 +252,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[11]
   },
   {
@@ -254,6 +267,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[12]
   },
   {
@@ -268,6 +282,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[13]
   },
   {
@@ -282,6 +297,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE,
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[14]
   },
   {
@@ -296,6 +312,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[15]
   },
   {
@@ -310,6 +327,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[16]
   },
   {
@@ -324,6 +342,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[17]
   },
   {
@@ -338,6 +357,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_powerpc_archs[18]
   },
   {
@@ -352,6 +372,7 @@ const bfd_arch_info_type bfd_powerpc_archs[] =
     FALSE, /* not the default */
     powerpc_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0
   }
 };
diff --git a/bfd/cpu-rl78.c b/bfd/cpu-rl78.c
index 66024ae..6fb72e6 100644
--- a/bfd/cpu-rl78.c
+++ b/bfd/cpu-rl78.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_rl78_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 };
diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c
index 91d0431..c914816 100644
--- a/bfd/cpu-rs6000.c
+++ b/bfd/cpu-rs6000.c
@@ -65,6 +65,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE, /* not the default */
     rs6000_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[1]
   },
   {
@@ -79,6 +80,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE, /* not the default */
     rs6000_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[2]
   },
   {
@@ -93,6 +95,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE, /* not the default */
     rs6000_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0
   }
 };
@@ -110,5 +113,6 @@ const bfd_arch_info_type bfd_rs6000_arch =
     TRUE, /* the default */
     rs6000_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[0]
   };
diff --git a/bfd/cpu-rx.c b/bfd/cpu-rx.c
index 92eebb0..31489ad 100644
--- a/bfd/cpu-rx.c
+++ b/bfd/cpu-rx.c
@@ -36,6 +36,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* The default ?  */
     bfd_default_compatible,	/* Architecture comparison fn.  */
     bfd_default_scan,		/* String to architecture convert fn.  */
+    bfd_arch_default_fill,	/* Default fill.  */
     NULL			/* Next in list.  */
   },
 };
@@ -53,5 +54,6 @@ const bfd_arch_info_type bfd_rx_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   & arch_info_struct[0],	/* Next in list.  */
 };
diff --git a/bfd/cpu-s390.c b/bfd/cpu-s390.c
index 805e825..1a581e4 100644
--- a/bfd/cpu-s390.c
+++ b/bfd/cpu-s390.c
@@ -36,6 +36,7 @@ const bfd_arch_info_type bfd_s390_64_arch =
     TRUE, /* the default */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     NULL
 };
 
@@ -52,5 +53,6 @@ const bfd_arch_info_type bfd_s390_arch =
     TRUE, /* the default */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &bfd_s390_64_arch
 };
diff --git a/bfd/cpu-score.c b/bfd/cpu-score.c
index 0ed4095..7a8d7b4 100644
--- a/bfd/cpu-score.c
+++ b/bfd/cpu-score.c
@@ -56,6 +56,7 @@ compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
   default,			/* The default machine.  */	\
   compatible,							\
   bfd_default_scan,						\
+  bfd_arch_default_fill,					\
   next								\
 }
 
diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c
index af97a47..6fe6c15 100644
--- a/bfd/cpu-sh.c
+++ b/bfd/cpu-sh.c
@@ -61,6 +61,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2_NEXT
   },
   {
@@ -75,6 +76,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2E_NEXT
   },
   {
@@ -89,6 +91,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH_DSP_NEXT
   },
   {
@@ -103,6 +106,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH3_NEXT
   },
   {
@@ -117,6 +121,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH3_NOMMU_NEXT
   },
   {
@@ -131,6 +136,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH3_DSP_NEXT
   },
   {
@@ -145,6 +151,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH3E_NEXT
   },
   {
@@ -159,6 +166,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4_NEXT
   },
   {
@@ -173,6 +181,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4A_NEXT
   },
   {
@@ -187,6 +196,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4AL_DSP_NEXT
   },
   {
@@ -201,6 +211,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4_NOFPU_NEXT
   },
   {
@@ -215,6 +226,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4_NOMMU_NOFPU_NEXT
   },
   {
@@ -229,6 +241,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH4A_NOFPU_NEXT
   },
   {
@@ -243,6 +256,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_NEXT
   },
   {
@@ -257,6 +271,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_NOFPU_NEXT
   },
   {
@@ -271,6 +286,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_NOFPU_OR_SH4_NOMMU_NOFPU_NEXT
   },
   {
@@ -285,6 +301,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_NOFPU_OR_SH3_NOMMU_NEXT
   },
   {
@@ -299,6 +316,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_OR_SH4_NEXT
   },
   {
@@ -313,6 +331,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH2A_OR_SH3E_NEXT
   },
   {
@@ -327,6 +346,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,			/* Not the default.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     SH64_NEXT
   },
 };
@@ -344,6 +364,7 @@ const bfd_arch_info_type bfd_sh_arch =
   TRUE,				/* The default machine.  */
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   SH_NEXT
 };
 
diff --git a/bfd/cpu-sparc.c b/bfd/cpu-sparc.c
index f86ccc5..ccdd7d1 100644
--- a/bfd/cpu-sparc.c
+++ b/bfd/cpu-sparc.c
@@ -37,6 +37,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[1],
   },
   {
@@ -51,6 +52,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[2],
   },
   {
@@ -65,6 +67,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[3],
   },
   {
@@ -79,6 +82,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[4],
   },
   {
@@ -93,6 +97,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[5],
   },
   {
@@ -107,6 +112,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[6],
   },
   {
@@ -121,6 +127,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[7],
   },
   {
@@ -135,6 +142,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[8],
   },
   {
@@ -149,6 +157,7 @@ static const bfd_arch_info_type arch_info_struct[] =
     FALSE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   }
 };
@@ -166,5 +175,6 @@ const bfd_arch_info_type bfd_sparc_arch =
     TRUE, /* the default */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     &arch_info_struct[0],
   };
diff --git a/bfd/cpu-spu.c b/bfd/cpu-spu.c
index 64ba357..b3dfc62 100644
--- a/bfd/cpu-spu.c
+++ b/bfd/cpu-spu.c
@@ -49,6 +49,7 @@ const bfd_arch_info_type bfd_spu_arch[] =
     TRUE, 		/* the default machine for the architecture */
     spu_compatible,	/* the spu is only compatible with itself, see above */
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,			/* next -- there are none! */
   }
 };
diff --git a/bfd/cpu-tic30.c b/bfd/cpu-tic30.c
index e08cf47..a9d291d 100644
--- a/bfd/cpu-tic30.c
+++ b/bfd/cpu-tic30.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_tic30_arch =
   TRUE,				/* the one and only */
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c
index bd8b8f4..e962233 100644
--- a/bfd/cpu-tic4x.c
+++ b/bfd/cpu-tic4x.c
@@ -64,6 +64,7 @@ const bfd_arch_info_type bfd_tic3x_arch =
     FALSE,			/* Not the default architecture.  */
     bfd_default_compatible,
     tic4x_scan,
+    bfd_arch_default_fill,
     0
   };
 
@@ -80,6 +81,7 @@ const bfd_arch_info_type bfd_tic4x_arch =
     TRUE,			/* The default architecture.  */
     bfd_default_compatible,
     tic4x_scan,
+    bfd_arch_default_fill,
     &bfd_tic3x_arch,
   };
 
diff --git a/bfd/cpu-tic54x.c b/bfd/cpu-tic54x.c
index b7e316c..95d990e 100644
--- a/bfd/cpu-tic54x.c
+++ b/bfd/cpu-tic54x.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_tic54x_arch =
   TRUE,				/* the one and only */
   bfd_default_compatible,
   bfd_default_scan,
+  bfd_arch_default_fill,
   0,
 };
diff --git a/bfd/cpu-tic6x.c b/bfd/cpu-tic6x.c
index 163f4b3..d5a9cb9 100644
--- a/bfd/cpu-tic6x.c
+++ b/bfd/cpu-tic6x.c
@@ -36,5 +36,6 @@ const bfd_arch_info_type bfd_tic6x_arch =
     TRUE, /* Default machine for this architecture.  */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-tic80.c b/bfd/cpu-tic80.c
index f030ce1..c11233d 100644
--- a/bfd/cpu-tic80.c
+++ b/bfd/cpu-tic80.c
@@ -35,6 +35,7 @@ const bfd_arch_info_type bfd_tic80_arch =
     2,				/* section alignment power */
     TRUE,			/* default machine for architecture */
     bfd_default_compatible,
-    bfd_default_scan ,
+    bfd_default_scan,
+    bfd_arch_default_fill,
     NULL,				/* Pointer to next in chain */
   };
diff --git a/bfd/cpu-tilegx.c b/bfd/cpu-tilegx.c
index aa2fe80..dc9bc63 100644
--- a/bfd/cpu-tilegx.c
+++ b/bfd/cpu-tilegx.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_tilegx_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-tilepro.c b/bfd/cpu-tilepro.c
index cadd006..33bfab0 100644
--- a/bfd/cpu-tilepro.c
+++ b/bfd/cpu-tilepro.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_tilepro_arch =
     TRUE,
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index 6ebc96c..d124220 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -26,7 +26,7 @@
 
 #define N(number, print, default, next)  \
 {  32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \
-     bfd_default_compatible, bfd_default_scan, next }
+   bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
 
 #define NEXT NULL
 
diff --git a/bfd/cpu-vax.c b/bfd/cpu-vax.c
index c9d9c8d..9e2b19d 100644
--- a/bfd/cpu-vax.c
+++ b/bfd/cpu-vax.c
@@ -37,5 +37,6 @@ const bfd_arch_info_type bfd_vax_arch =
     TRUE, /* the one and only */
     bfd_default_compatible,
     bfd_default_scan,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-w65.c b/bfd/cpu-w65.c
index e5e78d9..0200d70 100644
--- a/bfd/cpu-w65.c
+++ b/bfd/cpu-w65.c
@@ -52,5 +52,6 @@ const bfd_arch_info_type bfd_w65_arch =
   TRUE,				/* the default machine */
   bfd_default_compatible,
   scan_mach,
+  bfd_arch_default_fill,
   0,
 };
diff --git a/bfd/cpu-we32k.c b/bfd/cpu-we32k.c
index d93d76a..99a8ff0 100644
--- a/bfd/cpu-we32k.c
+++ b/bfd/cpu-we32k.c
@@ -36,5 +36,6 @@ const bfd_arch_info_type bfd_we32k_arch =
     TRUE, /* the one and only */
     bfd_default_compatible,
     bfd_default_scan ,
+    bfd_arch_default_fill,
     0,
   };
diff --git a/bfd/cpu-xc16x.c b/bfd/cpu-xc16x.c
index 552952c..3d28659 100644
--- a/bfd/cpu-xc16x.c
+++ b/bfd/cpu-xc16x.c
@@ -37,6 +37,7 @@ const bfd_arch_info_type xc16xs_info_struct =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 };
 
@@ -53,6 +54,7 @@ const bfd_arch_info_type xc16xl_info_struct =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   & xc16xs_info_struct		/* Next in list.  */
 };
 
@@ -69,5 +71,6 @@ const bfd_arch_info_type bfd_xc16x_arch =
   TRUE,				/* The default ?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   & xc16xl_info_struct		/* Next in list.  */
 };
diff --git a/bfd/cpu-xstormy16.c b/bfd/cpu-xstormy16.c
index d1c7e56..94de989 100644
--- a/bfd/cpu-xstormy16.c
+++ b/bfd/cpu-xstormy16.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_xstormy16_arch =
   TRUE,				/* the default ? */
   bfd_default_compatible,	/* architecture comparison fn */
   bfd_default_scan,		/* string to architecture convert fn */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* next in list */
 };
diff --git a/bfd/cpu-xtensa.c b/bfd/cpu-xtensa.c
index ee3767a..5c1008e 100644
--- a/bfd/cpu-xtensa.c
+++ b/bfd/cpu-xtensa.c
@@ -35,5 +35,6 @@ const bfd_arch_info_type bfd_xtensa_arch =
   TRUE,				/* The default?  */
   bfd_default_compatible,	/* Architecture comparison fn.  */
   bfd_default_scan,		/* String to architecture convert fn.  */
+  bfd_arch_default_fill,	/* Default fill.  */
   NULL				/* Next in list.  */
 };
diff --git a/bfd/cpu-z80.c b/bfd/cpu-z80.c
index 5da39f1..a46f71d 100644
--- a/bfd/cpu-z80.c
+++ b/bfd/cpu-z80.c
@@ -42,7 +42,7 @@ compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
 
 #define N(name,print,default,next)  \
 { 16, 16, 8, bfd_arch_z80, name, "z80", print, 0, default, \
-    compatible, bfd_default_scan, next }
+  compatible, bfd_default_scan, bfd_arch_default_fill, next }
 
 #define M(n) &arch_info_struct[n]
 
diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c
index 6e910e9..fd34218 100644
--- a/bfd/cpu-z8k.c
+++ b/bfd/cpu-z8k.c
@@ -38,11 +38,12 @@ compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
 static const bfd_arch_info_type arch_info_struct[] =
 {
   { 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, FALSE,
-    compatible, bfd_default_scan, 0 }
+    compatible, bfd_default_scan, bfd_arch_default_fill, 0 }
 };
 
 const bfd_arch_info_type bfd_z8k_arch =
 {
   32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, TRUE,
-  compatible, bfd_default_scan, &arch_info_struct[0]
+  compatible, bfd_default_scan, bfd_arch_default_fill,
+  &arch_info_struct[0]
 };
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 5e1cfe0..19c96cb 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2575,4 +2575,8 @@ const bfd_arch_info_type *bfd_default_compatible
 bfd_boolean bfd_default_scan
    (const struct bfd_arch_info *info, const char *string);
 
+void *bfd_arch_default_fill (bfd_size_type count,
+    bfd_boolean is_bigendian,
+    bfd_boolean code);
+
 /* Extracted from elf.c.  */
diff --git a/bfd/linker.c b/bfd/linker.c
index 7a01e11..c787b44 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -2664,7 +2664,10 @@ default_data_link_order (bfd *abfd,
 
   fill = link_order->u.data.contents;
   fill_size = link_order->u.data.size;
-  if (fill_size != 0 && fill_size < size)
+  if (fill_size == 0)
+    fill = abfd->arch_info->fill (size, bfd_big_endian (abfd),
+				  (sec->flags & SEC_CODE) != 0);
+  else if (fill_size < size)
     {
       bfd_byte *p;
       fill = (bfd_byte *) bfd_malloc (size);
@@ -2691,7 +2694,7 @@ default_data_link_order (bfd *abfd,
   loc = link_order->offset * bfd_octets_per_byte (abfd);
   result = bfd_set_section_contents (abfd, sec, fill, loc, size);
 
-  if (fill != link_order->u.data.contents)
+  if (fill != NULL && fill != link_order->u.data.contents)
     free (fill);
   return result;
 }
diff --git a/include/bfdlink.h b/include/bfdlink.h
index be85329..c79d8f0 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -674,8 +674,8 @@ struct bfd_link_order
 	} indirect;
       struct
 	{
-	  /* Size of contents, or zero when contents size == size
-	     within output section.
+	  /* Size of contents, or zero when contents should be filled by 
+	     the architecture-dependent fill function.
 	     A non-zero value allows filling of the output section
 	     with an arbitrary repeated pattern.  */
 	  unsigned int size;
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index d26a67f..fb94003 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -8,7 +8,6 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="i386:x64-32"
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index 1d1e4b4..2b2f910 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -7,7 +7,6 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=i386
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh
index efe1a86..1e27faa 100644
--- a/ld/emulparams/elf_i386_be.sh
+++ b/ld/emulparams/elf_i386_be.sh
@@ -5,7 +5,6 @@ TEXT_START_ADDR=0x80000000
 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i386
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 NO_SMALL_DATA=yes
diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh
index 183731d..e1a2cb7 100644
--- a/ld/emulparams/elf_i386_ldso.sh
+++ b/ld/emulparams/elf_i386_ldso.sh
@@ -6,7 +6,6 @@ TEXT_START_ADDR=0x08048000
 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 ARCH=i386
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh
index 6933128..61839c8 100644
--- a/ld/emulparams/elf_i386_vxworks.sh
+++ b/ld/emulparams/elf_i386_vxworks.sh
@@ -6,7 +6,6 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH=i386
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_k1om.sh b/ld/emulparams/elf_k1om.sh
index ad4b955..d28ffc0 100644
--- a/ld/emulparams/elf_k1om.sh
+++ b/ld/emulparams/elf_k1om.sh
@@ -9,7 +9,6 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="k1om"
 MACHINE=
 COMPILE_IN=yes
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_l1om.sh b/ld/emulparams/elf_l1om.sh
index 1d22d69..80152fe 100644
--- a/ld/emulparams/elf_l1om.sh
+++ b/ld/emulparams/elf_l1om.sh
@@ -9,7 +9,6 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="l1om"
 MACHINE=
 COMPILE_IN=yes
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index a921878..c38e845 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -8,7 +8,6 @@ MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
 ARCH="i386:x86-64"
 MACHINE=
-NOP=0x90909090
 TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 5e01fc0..24fd7da 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4600,7 +4600,7 @@ insert_pad (lang_statement_union_type **ptr,
 	    asection *output_section,
 	    bfd_vma dot)
 {
-  static fill_type zero_fill = { 1, { 0 } };
+  static fill_type zero_fill;
   lang_statement_union_type *pad = NULL;
 
   if (ptr != &statement_list.head)
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index b7a1469..481fef4 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -183,6 +183,7 @@ build_link_order (lang_statement_union_type *statement)
 	  default:
 	    abort ();
 	  }
+	link_order->u.data.size = link_order->size;
       }
       break;
 
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 149eec7..7994b5f 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -1,6 +1,6 @@
 #
 # Unusual variables checked by this code:
-#	NOP - four byte opcode for no-op (defaults to 0)
+#	NOP - four byte opcode for no-op (defaults to none)
 #	NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
 #		empty.
 #	SMALL_DATA_CTOR - .ctors contains small data.
@@ -91,6 +91,12 @@
 #
 #  Each of these can also have corresponding .rel.* and .rela.* sections.
 
+if test -n "$NOP"; then
+  FILL="=$NOP"
+else
+  FILL=
+fi
+
 test -z "$RODATA_NAME" && RODATA_NAME=rodata
 test -z "$SDATA_NAME" && SDATA_NAME=sdata
 test -z "$SBSS_NAME" && SBSS_NAME=sbss
@@ -438,7 +444,7 @@ cat <<EOF
     ${RELOCATING+${INIT_START}}
     KEEP (*(.init))
     ${RELOCATING+${INIT_END}}
-  } =${NOP-0}
+  } ${FILL}
 
   ${TEXT_PLT+${PLT}}
   ${TINY_READONLY_SECTION}
@@ -453,13 +459,13 @@ cat <<EOF
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
-  } =${NOP-0}
+  } ${FILL}
   .fini         ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
     KEEP (*(.fini))
     ${RELOCATING+${FINI_END}}
-  } =${NOP-0}
+  } ${FILL}
   ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);}
   ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);}
   ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);}
diff --git a/ld/testsuite/ld-i386/tlsbindesc.dd b/ld/testsuite/ld-i386/tlsbindesc.dd
index db54764..79a26d1 100644
--- a/ld/testsuite/ld-i386/tlsbindesc.dd
+++ b/ld/testsuite/ld-i386/tlsbindesc.dd
@@ -223,8 +223,7 @@ Disassembly of section .text:
  [0-9a-f]+:	8b 5d fc[ 	]+mov    -0x4\(%ebp\),%ebx
  [0-9a-f]+:	c9[ 	]+leave *
  [0-9a-f]+:	c3[ 	]+ret *
- [0-9a-f]+:	90[ 	]+nop *
- [0-9a-f]+:	90[ 	]+nop *
+ [0-9a-f]+:	66 90[ 	]+xchg   %ax,%ax
 
 [0-9a-f]+ <_start>:
  [0-9a-f]+:	55[ 	]+push   %ebp
diff --git a/ld/testsuite/ld-i386/tlsnopic.dd b/ld/testsuite/ld-i386/tlsnopic.dd
index 995cdaa..d6a16d0 100644
--- a/ld/testsuite/ld-i386/tlsnopic.dd
+++ b/ld/testsuite/ld-i386/tlsnopic.dd
@@ -156,6 +156,4 @@ Disassembly of section .text:
     10ec:	8b 5d fc[ 	]+mov    -0x4\(%ebp\),%ebx
     10ef:	c9[ 	]+leave *
     10f0:	c3[ 	]+ret *
-    10f1:	90[ 	]+nop *
-    10f2:	90[ 	]+nop *
-    10f3:	90[ 	]+nop *
+    10f1:	0f 1f 00[ 	]+nopl   \(%eax\)
diff --git a/ld/testsuite/ld-i386/tlspic.dd b/ld/testsuite/ld-i386/tlspic.dd
index b0c046d..d85b385 100644
--- a/ld/testsuite/ld-i386/tlspic.dd
+++ b/ld/testsuite/ld-i386/tlspic.dd
@@ -406,6 +406,4 @@ Disassembly of section .text:
  [0-9a-f]+:	8b 5d fc[ 	]+mov    -0x4\(%ebp\),%ebx
  [0-9a-f]+:	c9[ 	]+leave *
  [0-9a-f]+:	c3[ 	]+ret *
- [0-9a-f]+:	90[ 	]+nop *
- [0-9a-f]+:	90[ 	]+nop *
- [0-9a-f]+:	90[ 	]+nop *
+ [0-9a-f]+:	0f 1f 00[ 	]+nopl   \(%eax\)
diff --git a/ld/testsuite/ld-x86-64/tlsbin.dd b/ld/testsuite/ld-x86-64/tlsbin.dd
index 5bb5979..e028753 100644
--- a/ld/testsuite/ld-x86-64/tlsbin.dd
+++ b/ld/testsuite/ld-x86-64/tlsbin.dd
@@ -174,9 +174,7 @@ Disassembly of section .text:
   401136:	90[ 	]+nop *
   401137:	c9[ 	]+leaveq *
   401138:	c3[ 	]+retq *
-  401139:	90[ 	]+nop *
-  40113a:	90[ 	]+nop *
-  40113b:	90[ 	]+nop *
+  401139:	0f 1f 00[ 	]+nopl   \(%rax\)
 
 0+40113c <_start>:
   40113c:	55[ 	]+push   %rbp
diff --git a/ld/testsuite/ld-x86-64/tlsbindesc.dd b/ld/testsuite/ld-x86-64/tlsbindesc.dd
index b1cfacb..03f0169 100644
--- a/ld/testsuite/ld-x86-64/tlsbindesc.dd
+++ b/ld/testsuite/ld-x86-64/tlsbindesc.dd
@@ -165,9 +165,7 @@ Disassembly of section .text:
   [0-9a-f]+:	90[ 	]+nop *
   [0-9a-f]+:	c9[ 	]+leaveq *
   [0-9a-f]+:	c3[ 	]+retq *
-  [0-9a-f]+:	90[ 	]+nop *
-  [0-9a-f]+:	90[ 	]+nop *
-  [0-9a-f]+:	90[ 	]+nop *
+  [0-9a-f]+:	0f 1f 00[ 	]+nopl   \(%rax\)
 
 [0-9a-f]+ <_start>:
   [0-9a-f]+:	55[ 	]+push   %rbp
diff --git a/ld/testsuite/ld-x86-64/tlspic.dd b/ld/testsuite/ld-x86-64/tlspic.dd
index 6f55456..0c474a9 100644
--- a/ld/testsuite/ld-x86-64/tlspic.dd
+++ b/ld/testsuite/ld-x86-64/tlspic.dd
@@ -226,5 +226,4 @@ Disassembly of section .text:
  +11a7:	90[ 	]+nop *
  +11a8:	c9[ 	]+leaveq *
  +11a9:	c3[ 	]+retq *
- +11aa:	90[ 	]+nop *
- +11ab:	90[ 	]+nop *
+ +11aa:	66 90[ 	]+xchg   %ax,%ax


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