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]

Re: [PATCH] Avoid R_IA64_NONE relocations when relaxing


"H. J. Lu" <hjl@lucon.org> writes:

> On Sat, Aug 06, 2005 at 02:57:00AM +0200, Andreas Schwab wrote:
>> "H. J. Lu" <hjl@lucon.org> writes:
>> 
>> > The problem is when you reduced the size of .rela.got, gp became too
>> > high for relaxed R_IA64_LTOFF22X.
>> 
>> I have a patch ready that just needs some testing.  Stay tuned.
>> 
>
> This patch seems to work for my testcase.

This an alternative patch that fixes the problem as explained in the
comment of elfNN_ia64_relax_section.  It is tested with a glibc and gcc
build.

Andreas.

bfd/:
	* bfd.c (bfd_after_relax_pass): Define.
	* reloc.c (bfd_generic_after_relax_pass): Define.
	* targets.c (BFD_JUMP_TABLE_LINK): Add
	NAME##_bfd_after_relax_pass.
	(_bfd_after_relax_pass): Define.
	* libbfd-in.h (_bfd_nolink_bfd_after_relax_pass): Define.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Regenerated.
	* aout-adobe.c (aout_32_bfd_after_relax_pass): Define.
	* aout-target.h (MY_bfd_after_relax_pass): Define.
	* aout-tic30.c (MY_bfd_after_relax_pass): Define.
	* binary.c (binary_bfd_after_relax_pass): Define.
	* bout.c (b_out_bfd_after_relax_pass): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_after_relax_pass): Define.
	* coff-mips.c (_bfd_ecoff_bfd_after_relax_pass): Define.
	* coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add
	bfd_generic_after_relax_pass.
	* coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add
	bfd_generic_after_relax_pass.
	* coffcode.h (coff_bfd_after_relax_pass): Define.
	* elfxx-target.h (bfd_elfNN_bfd_after_relax_pass): Define.
	* i386msdos.c (msdos_bfd_after_relax_pass): Define.
	* i386os9k.c (os9k_bfd_after_relax_pass): Define.
	* ieee.c (ieee_bfd_after_relax_pass): Define.
	* ihex.c (ihex_bfd_after_relax_pass): Define.
	* mach-o.c (bfd_mach_o_bfd_after_relax_pass): Define.
	* mmo.c (mmo_bfd_after_relax_pass): Define.
	* nlm-target.h (nlm_bfd_after_relax_pass): Define.
	* oasys.c (oasys_bfd_after_relax_pass): Define.
	* pef.c (bfd_pef_bfd_after_relax_pass): Define.
	* ppcboot.c (ppcboot_bfd_after_relax_pass): Define.
	* srec.c (srec_bfd_after_relax_pass): Define.
	* tekhex.c (tekhex_bfd_after_relax_pass): Define.
	* versados.c (versados_bfd_after_relax_pass): Define.
	* vms.c (vms_bfd_after_relax_pass): Define.
	* xcoff-target.h (_bfd_xcoff_bfd_after_relax_pass): Define.
	* xsym.c (bfd_sym_bfd_after_relax_pass): Define.

ld/:
	* ldlang.c (lang_process): Call bfd_after_relax_pass after each
	relaxing pass.

Index: bfd/aout-adobe.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-adobe.c,v
retrieving revision 1.24
diff -u -a -p -r1.24 aout-adobe.c
--- bfd/aout-adobe.c	4 May 2005 15:52:59 -0000	1.24
+++ bfd/aout-adobe.c	6 Aug 2005 00:01:42 -0000
@@ -459,6 +459,7 @@ aout_adobe_sizeof_headers (bfd *ignore_a
 #define aout_32_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define aout_32_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
 #define aout_32_bfd_relax_section                   bfd_generic_relax_section
+#define aout_32_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define aout_32_bfd_gc_sections                     bfd_generic_gc_sections
 #define aout_32_bfd_merge_sections	            bfd_generic_merge_sections
 #define aout_32_bfd_is_group_section	            bfd_generic_is_group_section
Index: bfd/aout-target.h
===================================================================
RCS file: /cvs/src/src/bfd/aout-target.h,v
retrieving revision 1.33
diff -u -a -p -r1.33 aout-target.h
--- bfd/aout-target.h	23 May 2005 17:44:51 -0000	1.33
+++ bfd/aout-target.h	6 Aug 2005 00:01:43 -0000
@@ -475,6 +475,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd
 #ifndef MY_bfd_relax_section
 #define MY_bfd_relax_section bfd_generic_relax_section
 #endif
+#ifndef MY_bfd_after_relax_pass
+#define MY_bfd_after_relax_pass bfd_generic_after_relax_pass
+#endif
 #ifndef MY_bfd_gc_sections
 #define MY_bfd_gc_sections bfd_generic_gc_sections
 #endif
Index: bfd/aout-tic30.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-tic30.c,v
retrieving revision 1.31
diff -u -a -p -r1.31 aout-tic30.c
--- bfd/aout-tic30.c	23 May 2005 17:44:51 -0000	1.31
+++ bfd/aout-tic30.c	6 Aug 2005 00:01:44 -0000
@@ -917,6 +917,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_bfd_relax_section
 #define MY_bfd_relax_section bfd_generic_relax_section
 #endif
+#ifndef MY_bfd_after_relax_pass
+#define MY_bfd_after_relax_pass bfd_generic_after_relax_pass
+#endif
 #ifndef MY_bfd_gc_sections
 #define MY_bfd_gc_sections bfd_generic_gc_sections
 #endif
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.361
diff -u -a -p -r1.361 bfd-in2.h
--- bfd/bfd-in2.h	5 Aug 2005 13:52:11 -0000	1.361
+++ bfd/bfd-in2.h	6 Aug 2005 00:01:51 -0000
@@ -4408,11 +4408,14 @@ bfd_boolean bfd_set_private_flags (bfd *
        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
 
 #define bfd_set_arch_mach(abfd, arch, mach)\
-       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+       BFD_SEND (abfd, _bfd_set_arch_mach, (abfd, arch, mach))
 
 #define bfd_relax_section(abfd, section, link_info, again) \
        BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
 
+#define bfd_after_relax_pass(abfd, link_info) \
+       BFD_SEND (abfd, _bfd_after_relax_pass, (abfd, link_info))
+
 #define bfd_gc_sections(abfd, link_info) \
        BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 
@@ -4802,6 +4805,7 @@ typedef struct bfd_target
   NAME##_sizeof_headers, \
   NAME##_bfd_get_relocated_section_contents, \
   NAME##_bfd_relax_section, \
+  NAME##_bfd_after_relax_pass, \
   NAME##_bfd_link_hash_table_create, \
   NAME##_bfd_link_hash_table_free, \
   NAME##_bfd_link_add_symbols, \
@@ -4822,6 +4826,9 @@ typedef struct bfd_target
   bfd_boolean (*_bfd_relax_section)
     (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
 
+  /* Called after each relaxing pass.  */
+  void         (*_bfd_after_relax_pass) (bfd *, struct bfd_link_info *);
+
   /* Create a hash table for the linker.  Different backends store
      different information in this table.  */
   struct bfd_link_hash_table *
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.77
diff -u -a -p -r1.77 bfd.c
--- bfd/bfd.c	5 Aug 2005 13:52:11 -0000	1.77
+++ bfd/bfd.c	6 Aug 2005 00:01:59 -0000
@@ -1185,11 +1185,14 @@ DESCRIPTION
 .       BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
 .
 .#define bfd_set_arch_mach(abfd, arch, mach)\
-.       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+.       BFD_SEND (abfd, _bfd_set_arch_mach, (abfd, arch, mach))
 .
 .#define bfd_relax_section(abfd, section, link_info, again) \
 .       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
 .
+.#define bfd_after_relax_pass(abfd, link_info) \
+.       BFD_SEND (abfd, _bfd_after_relax_pass, (abfd, link_info))
+.
 .#define bfd_gc_sections(abfd, link_info) \
 .	BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
 .
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.28
diff -u -a -p -r1.28 binary.c
--- bfd/binary.c	23 May 2005 17:44:52 -0000	1.28
+++ bfd/binary.c	6 Aug 2005 00:02:07 -0000
@@ -312,6 +312,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBU
 
 #define binary_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define binary_bfd_relax_section                   bfd_generic_relax_section
+#define binary_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define binary_bfd_gc_sections                     bfd_generic_gc_sections
 #define binary_bfd_merge_sections                  bfd_generic_merge_sections
 #define binary_bfd_is_group_section                bfd_generic_is_group_section
Index: bfd/bout.c
===================================================================
RCS file: /cvs/src/src/bfd/bout.c,v
retrieving revision 1.27
diff -u -a -p -r1.27 bout.c
--- bfd/bout.c	4 May 2005 15:53:01 -0000	1.27
+++ bfd/bout.c	6 Aug 2005 00:02:07 -0000
@@ -1367,6 +1367,7 @@ b_out_bfd_get_relocated_section_contents
 #define b_out_bfd_link_just_syms               _bfd_generic_link_just_syms
 #define b_out_bfd_final_link                   _bfd_generic_final_link
 #define b_out_bfd_link_split_section           _bfd_generic_link_split_section
+#define b_out_bfd_after_relax_pass             bfd_generic_after_relax_pass
 #define b_out_bfd_gc_sections                  bfd_generic_gc_sections
 #define b_out_bfd_merge_sections               bfd_generic_merge_sections
 #define b_out_bfd_is_group_section             bfd_generic_is_group_section
Index: bfd/coff-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-alpha.c,v
retrieving revision 1.33
diff -u -a -p -r1.33 coff-alpha.c
--- bfd/coff-alpha.c	14 Jul 2005 07:48:28 -0000	1.33
+++ bfd/coff-alpha.c	6 Aug 2005 00:02:07 -0000
@@ -2372,6 +2372,7 @@ static const struct ecoff_backend_data a
 
 /* Relaxing sections is generic.  */
 #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
+#define _bfd_ecoff_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
 #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
 #define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/coff-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mips.c,v
retrieving revision 1.30
diff -u -a -p -r1.30 coff-mips.c
--- bfd/coff-mips.c	4 May 2005 15:53:02 -0000	1.30
+++ bfd/coff-mips.c	6 Aug 2005 00:02:07 -0000
@@ -1386,6 +1386,7 @@ static const struct ecoff_backend_data m
 
 /* Relaxing sections is MIPS specific.  */
 #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
+#define _bfd_ecoff_bfd_after_relax_pass bfd_generic_after_relax_pass
 
 /* GC of sections is not done.  */
 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
Index: bfd/coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.72
diff -u -a -p -r1.72 coff-rs6000.c
--- bfd/coff-rs6000.c	5 Jul 2005 09:45:53 -0000	1.72
+++ bfd/coff-rs6000.c	6 Aug 2005 00:02:11 -0000
@@ -4187,6 +4187,7 @@ const bfd_target rs6000coff_vec =
     _bfd_xcoff_sizeof_headers,
     bfd_generic_get_relocated_section_contents,
     bfd_generic_relax_section,
+    bfd_generic_after_relax_pass,
     _bfd_xcoff_bfd_link_hash_table_create,
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
@@ -4436,6 +4437,7 @@ const bfd_target pmac_xcoff_vec =
     _bfd_xcoff_sizeof_headers,
     bfd_generic_get_relocated_section_contents,
     bfd_generic_relax_section,
+    bfd_generic_after_relax_pass,
     _bfd_xcoff_bfd_link_hash_table_create,
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
Index: bfd/coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.63
diff -u -a -p -r1.63 coff64-rs6000.c
--- bfd/coff64-rs6000.c	5 Jul 2005 09:45:54 -0000	1.63
+++ bfd/coff64-rs6000.c	6 Aug 2005 00:02:15 -0000
@@ -2734,6 +2734,7 @@ const bfd_target rs6000coff64_vec =
     xcoff64_sizeof_headers,
     bfd_generic_get_relocated_section_contents,
     bfd_generic_relax_section,
+    bfd_generic_after_relax_pass,
     _bfd_xcoff_bfd_link_hash_table_create,
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
@@ -2984,6 +2985,7 @@ const bfd_target aix5coff64_vec =
     xcoff64_sizeof_headers,
     bfd_generic_get_relocated_section_contents,
     bfd_generic_relax_section,
+    bfd_generic_after_relax_pass,
     _bfd_xcoff_bfd_link_hash_table_create,
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.128
diff -u -a -p -r1.128 coffcode.h
--- bfd/coffcode.h	17 Jun 2005 13:39:56 -0000	1.128
+++ bfd/coffcode.h	6 Aug 2005 00:02:25 -0000
@@ -5317,6 +5317,10 @@ static const bfd_coff_backend_data ticof
 #define coff_bfd_relax_section		    bfd_generic_relax_section
 #endif
 
+#ifndef coff_bfd_after_relax_pass
+#define coff_bfd_after_relax_pass	    bfd_generic_after_relax_pass
+#endif
+
 #ifndef coff_bfd_gc_sections
 #define coff_bfd_gc_sections		    bfd_generic_gc_sections
 #endif
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.171
diff -u -a -p -r1.171 elfxx-ia64.c
--- bfd/elfxx-ia64.c	4 Aug 2005 00:39:02 -0000	1.171
+++ bfd/elfxx-ia64.c	6 Aug 2005 00:02:43 -0000
@@ -1281,10 +1281,11 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	}
     }
 
-  /* ??? If we created fixups, this may push the code segment large
+  /* If we created fixups, this may push the code segment large
      enough that the data segment moves, which will change the GP.
      Reset the GP so that we re-calculate next round.  We need to
-     do this at the _beginning_ of the next round; now will not do.  */
+     do this at the _beginning_ of the next round; now will not do.
+     See elfNN_after_relax_pass.  */
 
   /* Clean up and go home.  */
   while (fixups)
@@ -1370,6 +1371,14 @@ elfNN_ia64_relax_section (abfd, sec, lin
   return FALSE;
 }
 
+/* Reset GP value after each relaxing pass.  */
+static void
+elfNN_ia64_after_relax_pass (bfd *abfd,
+			     struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+{
+  _bfd_set_gp_value (abfd, 0);
+}
+
 static void
 elfNN_ia64_relax_ldxmov (contents, off)
      bfd_byte *contents;
@@ -5250,6 +5259,8 @@ elfNN_hpux_backend_symbol_processing (bf
 	elfNN_ia64_is_local_label_name
 #define bfd_elfNN_bfd_relax_section \
 	elfNN_ia64_relax_section
+#define bfd_elfNN_bfd_after_relax_pass \
+	elfNN_ia64_after_relax_pass
 
 #define elf_backend_object_p \
 	elfNN_ia64_object_p
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.88
diff -u -a -p -r1.88 elfxx-target.h
--- bfd/elfxx-target.h	29 Jul 2005 02:46:04 -0000	1.88
+++ bfd/elfxx-target.h	6 Aug 2005 00:02:45 -0000
@@ -114,6 +114,10 @@
 #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
 #endif
 
+#ifndef bfd_elfNN_bfd_after_relax_pass
+#define bfd_elfNN_bfd_after_relax_pass bfd_generic_after_relax_pass
+#endif
+
 #ifndef elf_backend_can_gc_sections
 #define elf_backend_can_gc_sections 0
 #endif
Index: bfd/i386msdos.c
===================================================================
RCS file: /cvs/src/src/bfd/i386msdos.c,v
retrieving revision 1.23
diff -u -a -p -r1.23 i386msdos.c
--- bfd/i386msdos.c	23 May 2005 17:44:54 -0000	1.23
+++ bfd/i386msdos.c	6 Aug 2005 00:02:45 -0000
@@ -150,6 +150,7 @@ msdos_set_section_contents (abfd, sectio
 #define msdos_bfd_get_relocated_section_contents \
   bfd_generic_get_relocated_section_contents
 #define msdos_bfd_relax_section bfd_generic_relax_section
+#define msdos_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define msdos_bfd_gc_sections bfd_generic_gc_sections
 #define msdos_bfd_merge_sections bfd_generic_merge_sections
 #define msdos_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/i386os9k.c
===================================================================
RCS file: /cvs/src/src/bfd/i386os9k.c,v
retrieving revision 1.19
diff -u -a -p -r1.19 i386os9k.c
--- bfd/i386os9k.c	4 May 2005 15:53:32 -0000	1.19
+++ bfd/i386os9k.c	6 Aug 2005 00:02:45 -0000
@@ -178,6 +178,7 @@ os9k_sizeof_headers (ignore_abfd, ignore
 #define os9k_bfd_get_relocated_section_contents \
   bfd_generic_get_relocated_section_contents
 #define os9k_bfd_relax_section bfd_generic_relax_section
+#define os9k_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define os9k_bfd_gc_sections bfd_generic_gc_sections
 #define os9k_bfd_merge_sections bfd_generic_merge_sections
 #define os9k_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.49
diff -u -a -p -r1.49 ieee.c
--- bfd/ieee.c	23 May 2005 17:44:54 -0000	1.49
+++ bfd/ieee.c	6 Aug 2005 00:02:49 -0000
@@ -3745,6 +3745,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE
 #define ieee_bfd_get_relocated_section_contents \
   bfd_generic_get_relocated_section_contents
 #define ieee_bfd_relax_section bfd_generic_relax_section
+#define ieee_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define ieee_bfd_gc_sections bfd_generic_gc_sections
 #define ieee_bfd_merge_sections bfd_generic_merge_sections
 #define ieee_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.30
diff -u -a -p -r1.30 ihex.c
--- bfd/ihex.c	23 May 2005 17:44:54 -0000	1.30
+++ bfd/ihex.c	6 Aug 2005 00:02:49 -0000
@@ -929,6 +929,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE
 #define ihex_bfd_reloc_type_lookup                _bfd_norelocs_bfd_reloc_type_lookup
 #define ihex_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define ihex_bfd_relax_section                    bfd_generic_relax_section
+#define ihex_bfd_after_relax_pass                 bfd_generic_after_relax_pass
 #define ihex_bfd_gc_sections                      bfd_generic_gc_sections
 #define ihex_bfd_merge_sections                   bfd_generic_merge_sections
 #define ihex_bfd_is_group_section                 bfd_generic_is_group_section
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.55
diff -u -a -p -r1.55 libbfd-in.h
--- bfd/libbfd-in.h	5 Jul 2005 09:45:54 -0000	1.55
+++ bfd/libbfd-in.h	6 Aug 2005 00:02:50 -0000
@@ -373,6 +373,8 @@ extern bfd_boolean _bfd_generic_set_sect
   ((bfd_boolean (*) \
     (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
    bfd_false)
+#define _bfd_nolink_bfd_after_relax_pass \
+  ((void (*) (bfd *, struct bfd_link_info *)) bfd_void)
 #define _bfd_nolink_bfd_gc_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.154
diff -u -a -p -r1.154 libbfd.h
--- bfd/libbfd.h	29 Jul 2005 17:39:31 -0000	1.154
+++ bfd/libbfd.h	6 Aug 2005 00:02:52 -0000
@@ -378,6 +378,8 @@ extern bfd_boolean _bfd_generic_set_sect
   ((bfd_boolean (*) \
     (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
    bfd_false)
+#define _bfd_nolink_bfd_after_relax_pass \
+  ((void (*) (bfd *, struct bfd_link_info *)) bfd_void)
 #define _bfd_nolink_bfd_gc_sections \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
    bfd_false)
@@ -1803,6 +1805,9 @@ bfd_boolean bfd_generic_relax_section
     struct bfd_link_info *,
     bfd_boolean *);
 
+void bfd_generic_after_relax_pass
+   (bfd *abfd, struct bfd_link_info *);
+
 bfd_boolean bfd_generic_gc_sections
    (bfd *, struct bfd_link_info *);
 
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.19
diff -u -a -p -r1.19 mach-o.c
--- bfd/mach-o.c	23 May 2005 17:44:55 -0000	1.19
+++ bfd/mach-o.c	6 Aug 2005 00:02:54 -0000
@@ -57,6 +57,7 @@
 #define bfd_mach_o_bfd_reloc_type_lookup              _bfd_norelocs_bfd_reloc_type_lookup
 #define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
 #define bfd_mach_o_bfd_relax_section                  bfd_generic_relax_section
+#define bfd_mach_o_bfd_after_relax_pass               bfd_generic_after_relax_pass
 #define bfd_mach_o_bfd_link_hash_table_create         _bfd_generic_link_hash_table_create
 #define bfd_mach_o_bfd_link_hash_table_free           _bfd_generic_link_hash_table_free
 #define bfd_mach_o_bfd_link_add_symbols               _bfd_generic_link_add_symbols
Index: bfd/mmo.c
===================================================================
RCS file: /cvs/src/src/bfd/mmo.c,v
retrieving revision 1.28
diff -u -a -p -r1.28 mmo.c
--- bfd/mmo.c	23 May 2005 17:44:55 -0000	1.28
+++ bfd/mmo.c	6 Aug 2005 00:02:58 -0000
@@ -3224,6 +3224,7 @@ mmo_canonicalize_reloc (bfd *abfd ATTRIB
    stop anybody from shooting themselves in the foot.  */
 #define mmo_set_arch_mach bfd_default_set_arch_mach
 #define mmo_bfd_relax_section bfd_generic_relax_section
+#define mmo_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define mmo_bfd_merge_sections bfd_generic_merge_sections
 #define mmo_bfd_is_group_section bfd_generic_is_group_section
 #define mmo_bfd_discard_group bfd_generic_discard_group
Index: bfd/nlm-target.h
===================================================================
RCS file: /cvs/src/src/bfd/nlm-target.h,v
retrieving revision 1.17
diff -u -a -p -r1.17 nlm-target.h
--- bfd/nlm-target.h	23 May 2005 17:44:55 -0000	1.17
+++ bfd/nlm-target.h	6 Aug 2005 00:03:02 -0000
@@ -42,6 +42,7 @@
 #define nlm_sizeof_headers                      _bfd_nolink_sizeof_headers
 #define nlm_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define nlm_bfd_relax_section                   bfd_generic_relax_section
+#define nlm_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define nlm_bfd_gc_sections                     bfd_generic_gc_sections
 #define nlm_bfd_merge_sections                  bfd_generic_merge_sections
 #define nlm_bfd_is_group_section                bfd_generic_is_group_section
Index: bfd/oasys.c
===================================================================
RCS file: /cvs/src/src/bfd/oasys.c,v
retrieving revision 1.32
diff -u -a -p -r1.32 oasys.c
--- bfd/oasys.c	23 May 2005 17:44:55 -0000	1.32
+++ bfd/oasys.c	6 Aug 2005 00:03:05 -0000
@@ -1184,6 +1184,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUT
 #define oasys_get_section_contents_in_window       _bfd_generic_get_section_contents_in_window
 #define oasys_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define oasys_bfd_relax_section                    bfd_generic_relax_section
+#define oasys_bfd_after_relax_pass                 bfd_generic_after_relax_pass
 #define oasys_bfd_gc_sections                      bfd_generic_gc_sections
 #define oasys_bfd_merge_sections                   bfd_generic_merge_sections
 #define oasys_bfd_is_group_section                 bfd_generic_is_group_section
Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.17
diff -u -a -p -r1.17 pef.c
--- bfd/pef.c	23 May 2005 17:44:55 -0000	1.17
+++ bfd/pef.c	6 Aug 2005 00:03:05 -0000
@@ -49,6 +49,7 @@
 #define bfd_pef_set_section_contents                _bfd_generic_set_section_contents
 #define bfd_pef_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define bfd_pef_bfd_relax_section                   bfd_generic_relax_section
+#define bfd_pef_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define bfd_pef_bfd_gc_sections                     bfd_generic_gc_sections
 #define bfd_pef_bfd_merge_sections                  bfd_generic_merge_sections
 #define bfd_pef_bfd_is_group_section		    bfd_generic_is_group_section
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.24
diff -u -a -p -r1.24 ppcboot.c
--- bfd/ppcboot.c	23 May 2005 17:44:55 -0000	1.24
+++ bfd/ppcboot.c	6 Aug 2005 00:03:05 -0000
@@ -1,5 +1,5 @@
 /* BFD back-end for PPCbug boot records.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
    Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
 
@@ -470,6 +470,7 @@ ppcboot_bfd_print_private_bfd_data (abfd
 #define ppcboot_bfd_get_relocated_section_contents \
   bfd_generic_get_relocated_section_contents
 #define ppcboot_bfd_relax_section bfd_generic_relax_section
+#define ppcboot_bfd_after_relax_pass bfd_generic_after_relax_pass
 #define ppcboot_bfd_gc_sections bfd_generic_gc_sections
 #define ppcboot_bfd_merge_sections bfd_generic_merge_sections
 #define ppcboot_bfd_is_group_section bfd_generic_is_group_section
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.135
diff -u -a -p -r1.135 reloc.c
--- bfd/reloc.c	29 Jul 2005 17:39:32 -0000	1.135
+++ bfd/reloc.c	6 Aug 2005 00:03:10 -0000
@@ -4552,6 +4552,25 @@ bfd_generic_relax_section (bfd *abfd ATT
 
 /*
 INTERNAL_FUNCTION
+	bfd_generic_after_relax_pass
+
+SYNOPSIS
+	void bfd_generic_after_relax_pass
+	  (bfd *abfd, struct bfd_link_info *);
+
+DESCRIPTION
+	Provides default handling for back ends which don't need
+	to do anything special after each relaxing pass.
+*/
+
+void
+bfd_generic_after_relax_pass (bfd *abfd ATTRIBUTE_UNUSED,
+			      struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+{
+}
+
+/*
+INTERNAL_FUNCTION
 	bfd_generic_gc_sections
 
 SYNOPSIS
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.37
diff -u -a -p -r1.37 srec.c
--- bfd/srec.c	23 May 2005 17:44:55 -0000	1.37
+++ bfd/srec.c	6 Aug 2005 00:03:11 -0000
@@ -1199,6 +1199,7 @@ srec_print_symbol (bfd *abfd,
 #define srec_get_section_contents_in_window       _bfd_generic_get_section_contents_in_window
 #define srec_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define srec_bfd_relax_section                    bfd_generic_relax_section
+#define srec_bfd_after_relax_pass                 bfd_generic_after_relax_pass
 #define srec_bfd_gc_sections                      bfd_generic_gc_sections
 #define srec_bfd_merge_sections                   bfd_generic_merge_sections
 #define srec_bfd_is_group_section                 bfd_generic_is_group_section
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.134
diff -u -a -p -r1.134 targets.c
--- bfd/targets.c	21 Jul 2005 13:23:32 -0000	1.134
+++ bfd/targets.c	6 Aug 2005 00:03:12 -0000
@@ -419,6 +419,7 @@ BFD_JUMP_TABLE macros.
 .  NAME##_sizeof_headers, \
 .  NAME##_bfd_get_relocated_section_contents, \
 .  NAME##_bfd_relax_section, \
+.  NAME##_bfd_after_relax_pass, \
 .  NAME##_bfd_link_hash_table_create, \
 .  NAME##_bfd_link_hash_table_free, \
 .  NAME##_bfd_link_add_symbols, \
@@ -439,6 +440,9 @@ BFD_JUMP_TABLE macros.
 .  bfd_boolean (*_bfd_relax_section)
 .    (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
 .
+.  {* Called after each relaxing pass.  *}
+.  void		(*_bfd_after_relax_pass) (bfd *, struct bfd_link_info *);
+.
 .  {* Create a hash table for the linker.  Different backends store
 .     different information in this table.  *}
 .  struct bfd_link_hash_table *
Index: bfd/tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.26
diff -u -a -p -r1.26 tekhex.c
--- bfd/tekhex.c	23 May 2005 17:44:55 -0000	1.26
+++ bfd/tekhex.c	6 Aug 2005 00:03:15 -0000
@@ -1,6 +1,6 @@
 /* BFD backend for Extended Tektronix Hex Format  objects.
    Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -901,6 +901,7 @@ tekhex_print_symbol (bfd *abfd,
 #define tekhex_minisymbol_to_symbol                 _bfd_generic_minisymbol_to_symbol
 #define tekhex_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define tekhex_bfd_relax_section                    bfd_generic_relax_section
+#define tekhex_bfd_after_relax_pass                 bfd_generic_after_relax_pass
 #define tekhex_bfd_gc_sections                      bfd_generic_gc_sections
 #define tekhex_bfd_merge_sections                   bfd_generic_merge_sections
 #define tekhex_bfd_is_group_section                 bfd_generic_is_group_section
Index: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.30
diff -u -a -p -r1.30 versados.c
--- bfd/versados.c	23 May 2005 17:44:55 -0000	1.30
+++ bfd/versados.c	6 Aug 2005 00:03:15 -0000
@@ -801,6 +801,7 @@ versados_canonicalize_reloc (bfd *abfd,
 #define versados_set_arch_mach                        bfd_default_set_arch_mach
 #define versados_bfd_get_relocated_section_contents   bfd_generic_get_relocated_section_contents
 #define versados_bfd_relax_section                    bfd_generic_relax_section
+#define versados_bfd_after_relax_pass                 bfd_generic_after_relax_pass
 #define versados_bfd_gc_sections                      bfd_generic_gc_sections
 #define versados_bfd_merge_sections                   bfd_generic_merge_sections
 #define versados_bfd_is_group_section                 bfd_generic_is_group_section
Index: bfd/vms.c
===================================================================
RCS file: /cvs/src/src/bfd/vms.c,v
retrieving revision 1.37
diff -u -a -p -r1.37 vms.c
--- bfd/vms.c	23 May 2005 17:44:55 -0000	1.37
+++ bfd/vms.c	6 Aug 2005 00:03:17 -0000
@@ -1442,6 +1442,15 @@ vms_bfd_relax_section (bfd * abfd ATTRIB
   return TRUE;
 }
 
+static void
+vms_bfd_after_relax_pass (bfd *abfd ATTRIBUTE_UNUSED,
+			  struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+{
+#if VMS_DEBUG
+  vms_debug (1, "vms_bfd_after_relax_pass (%p, %p)\n", abfd, link_info);
+#endif
+}
+
 static bfd_boolean
 vms_bfd_gc_sections (bfd * abfd ATTRIBUTE_UNUSED,
 		     struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
Index: bfd/xcoff-target.h
===================================================================
RCS file: /cvs/src/src/bfd/xcoff-target.h,v
retrieving revision 1.15
diff -u -a -p -r1.15 xcoff-target.h
--- bfd/xcoff-target.h	4 May 2005 15:53:41 -0000	1.15
+++ bfd/xcoff-target.h	6 Aug 2005 00:03:17 -0000
@@ -51,6 +51,7 @@
 #define coff_core_file_matches_executable_p            _bfd_nocore_core_file_matches_executable_p
 #define _bfd_xcoff_bfd_get_relocated_section_contents  coff_bfd_get_relocated_section_contents
 #define _bfd_xcoff_bfd_relax_section                   coff_bfd_relax_section
+#define _bfd_xcoff_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define _bfd_xcoff_bfd_gc_sections                     coff_bfd_gc_sections
 #define _bfd_xcoff_bfd_merge_sections                  coff_bfd_merge_sections
 #define _bfd_xcoff_bfd_discard_group                   bfd_generic_discard_group
Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.16
diff -u -a -p -r1.16 xsym.c
--- bfd/xsym.c	23 May 2005 17:44:55 -0000	1.16
+++ bfd/xsym.c	6 Aug 2005 00:03:18 -0000
@@ -42,6 +42,7 @@
 #define bfd_sym_set_section_contents                _bfd_generic_set_section_contents
 #define bfd_sym_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define bfd_sym_bfd_relax_section                   bfd_generic_relax_section
+#define bfd_sym_bfd_after_relax_pass                bfd_generic_after_relax_pass
 #define bfd_sym_bfd_gc_sections                     bfd_generic_gc_sections
 #define bfd_sym_bfd_merge_sections                  bfd_generic_merge_sections
 #define bfd_sym_bfd_is_group_section                bfd_generic_is_group_section
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.195
diff -u -a -p -r1.195 ldlang.c
--- ld/ldlang.c	4 Aug 2005 06:22:12 -0000	1.195
+++ ld/ldlang.c	6 Aug 2005 12:21:25 -0000
@@ -5386,6 +5386,8 @@ lang_process (void)
 	      link_info.need_relax_finalize = FALSE;
 	      relax_again = TRUE;
 	    }
+
+	  bfd_after_relax_pass (output_bfd, &link_info);
 	}
       while (relax_again);
 

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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