Constify struct bfd_link_order args

Alan Modra amodra@gmail.com
Fri Aug 21 06:17:42 GMT 2026


get_relocated_section_contents doesn't modify its link_order arg, nor
does coff_reloc16_extra_cases.   _bfd_generic_reloc_link_order,
_bfd_default_link_order and _bfd_count_link_order_relocs also don't
modify their link_order args.  Make all of them const.

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 8d12ddf6723..073d45a6858 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2828,8 +2828,8 @@ bool bfd_set_private_flags (bfd *abfd, flagword flags);
        BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
 
 bfd_byte *bfd_get_relocated_section_contents
-   (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
-    bool, asymbol **);
+   (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
+    bfd_byte *, bool, asymbol **);
 
 bool bfd_record_phdr
    (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
@@ -7709,7 +7709,7 @@ typedef struct bfd_target
   bfd_byte *
        (*_bfd_get_relocated_section_contents) (bfd *,
 					       struct bfd_link_info *,
-					       struct bfd_link_order *,
+					       const struct bfd_link_order *,
 					       bfd_byte *, bool,
 					       struct bfd_symbol **);
 
diff --git a/bfd/bfd.c b/bfd/bfd.c
index cbeaeb6f269..59f15d2dd44 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2736,8 +2736,8 @@ FUNCTION
 
 SYNOPSIS
 	bfd_byte *bfd_get_relocated_section_contents
-	  (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
-	   bool, asymbol **);
+	  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
+	   bfd_byte *, bool, asymbol **);
 
 DESCRIPTION
 	Read and relocate the indirect link_order section, into DATA
@@ -2748,13 +2748,13 @@ DESCRIPTION
 bfd_byte *
 bfd_get_relocated_section_contents (bfd *abfd,
 				    struct bfd_link_info *link_info,
-				    struct bfd_link_order *link_order,
+				    const struct bfd_link_order *link_order,
 				    bfd_byte *data,
 				    bool relocatable,
 				    asymbol **symbols)
 {
   bfd *abfd2;
-  bfd_byte *(*fn) (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  bfd_byte *(*fn) (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
 		   bfd_byte *, bool, asymbol **);
 
   if (link_order->type == bfd_indirect_link_order)
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index dd1208ab064..77859269512 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -771,12 +771,13 @@ write_bit_field (bfd *abfd, asection *sec,
    assembler is going to handle this.  */
 
 static bfd_byte *
-alpha_ecoff_get_relocated_section_contents (bfd *abfd,
-					    struct bfd_link_info *link_info,
-					    struct bfd_link_order *link_order,
-					    bfd_byte *data,
-					    bool relocatable,
-					    asymbol **symbols)
+alpha_ecoff_get_relocated_section_contents
+  (bfd *abfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   bfd *input_bfd = link_order->u.indirect.section->owner;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index d736bce87c4..fc7b7733366 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -2895,7 +2895,7 @@ sh_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 static bfd_byte *
 sh_coff_get_relocated_section_contents (bfd *output_bfd,
 					struct bfd_link_info *link_info,
-					struct bfd_link_order *link_order,
+					const struct bfd_link_order *link_order,
 					bfd_byte *data,
 					bool relocatable,
 					asymbol **symbols)
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index 9b11564ca91..81085c4e18a 100644
--- a/bfd/coff-z80.c
+++ b/bfd/coff-z80.c
@@ -333,7 +333,7 @@ reloc_processing (arelent *relent,
 static bool
 extra_case (bfd *in_abfd,
 	    struct bfd_link_info *link_info,
-	    struct bfd_link_order *link_order,
+	    const struct bfd_link_order *link_order,
 	    arelent *reloc,
 	    bfd_byte *data,
 	    size_t *src_ptr,
diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c
index 1703c42796c..f575b70edd8 100644
--- a/bfd/coff-z8k.c
+++ b/bfd/coff-z8k.c
@@ -196,7 +196,7 @@ reloc_processing (arelent *relent,
 static bool
 extra_case (bfd *in_abfd,
 	    struct bfd_link_info *link_info,
-	    struct bfd_link_order *link_order,
+	    const struct bfd_link_order *link_order,
 	    arelent *reloc,
 	    bfd_byte *data,
 	    size_t *src_ptr,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 964d2c3e173..fc429c73b61 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1505,7 +1505,7 @@ CODE_FRAGMENT
 .     combined_entry_type *, unsigned int);
 .
 .  bool (*_bfd_coff_reloc16_extra_cases)
-.    (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+.    (bfd *, struct bfd_link_info *, const struct bfd_link_order *, arelent *,
 .     bfd_byte *, size_t *, size_t *);
 .
 .  int (*_bfd_coff_reloc16_estimate)
@@ -5475,13 +5475,14 @@ dummy_reloc16_estimate (bfd *abfd ATTRIBUTE_UNUSED,
 #define coff_reloc16_extra_cases dummy_reloc16_extra_cases
 
 static bool
-dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED,
-			   struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
-			   struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
-			   arelent *reloc ATTRIBUTE_UNUSED,
-			   bfd_byte *data ATTRIBUTE_UNUSED,
-			   size_t *src_ptr ATTRIBUTE_UNUSED,
-			   size_t *dst_ptr ATTRIBUTE_UNUSED)
+dummy_reloc16_extra_cases
+  (bfd *abfd ATTRIBUTE_UNUSED,
+   struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
+   const struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
+   arelent *reloc ATTRIBUTE_UNUSED,
+   bfd_byte *data ATTRIBUTE_UNUSED,
+   size_t *src_ptr ATTRIBUTE_UNUSED,
+   size_t *dst_ptr ATTRIBUTE_UNUSED)
 {
   return false;
 }
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index e8b3b5178ca..6aacb0da703 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -1266,12 +1266,13 @@ mn10200_elf_symbol_address_p (bfd *abfd,
    which uses mn10200_elf_relocate_section.  */
 
 static bfd_byte *
-mn10200_elf_get_relocated_section_contents (bfd *output_bfd,
-					    struct bfd_link_info *link_info,
-					    struct bfd_link_order *link_order,
-					    bfd_byte *data,
-					    bool relocatable,
-					    asymbol **symbols)
+mn10200_elf_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 2aef1ddddf7..05f2a9811e3 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -4407,12 +4407,13 @@ mn10300_elf_relax_section (bfd *abfd,
    which uses mn10300_elf_relocate_section.  */
 
 static bfd_byte *
-mn10300_elf_get_relocated_section_contents (bfd *output_bfd,
-					    struct bfd_link_info *link_info,
-					    struct bfd_link_order *link_order,
-					    bfd_byte *data,
-					    bool relocatable,
-					    asymbol **symbols)
+mn10300_elf_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 1d0298d57c3..e8831578038 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -3084,11 +3084,12 @@ elf32_avr_relax_section (bfd *abfd,  asection *sec,
    seems to be important.  */
 
 static bfd_byte *
-elf32_avr_get_relocated_section_contents (bfd *output_bfd,
-					  struct bfd_link_info *link_info,
-					  struct bfd_link_order *link_order,
-					  bfd_byte *data, bool relocatable,
-					  asymbol **symbols)
+elf32_avr_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data, bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 91ddbefb841..8e827afe3a3 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -1460,12 +1460,13 @@ elf32_cr16_relocate_section (struct bfd_link_info *info,
    which uses elf32_cr16_relocate_section.  */
 
 static bfd_byte *
-elf32_cr16_get_relocated_section_contents (bfd *output_bfd,
-					   struct bfd_link_info *link_info,
-					   struct bfd_link_order *link_order,
-					   bfd_byte *data,
-					   bool relocatable,
-					   asymbol **symbols)
+elf32_cr16_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c
index 3e5184307a2..549486ccb2c 100644
--- a/bfd/elf32-crx.c
+++ b/bfd/elf32-crx.c
@@ -42,7 +42,7 @@ static int elf32_crx_relocate_section
 static bool elf32_crx_relax_section
   (bfd *, asection *, struct bfd_link_info *, bool *);
 static bfd_byte * elf32_crx_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **);
 
 /* crx_reloc_map array maps BFD relocation enum into a CRGAS relocation type.  */
@@ -717,12 +717,13 @@ elf32_crx_relax_delete_bytes (struct bfd_link_info *link_info, bfd *abfd,
    which uses elf32_crx_relocate_section.  */
 
 static bfd_byte *
-elf32_crx_get_relocated_section_contents (bfd *output_bfd,
-					  struct bfd_link_info *link_info,
-					  struct bfd_link_order *link_order,
-					  bfd_byte *data,
-					  bool relocatable,
-					  asymbol **symbols)
+elf32_crx_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 2ebeada9f52..d667243a387 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -41,7 +41,7 @@ static bool elf32_h8_relax_delete_bytes
   (bfd *, asection *, bfd_vma, int);
 static bool elf32_h8_symbol_address_p (bfd *, asection *, bfd_vma);
 static bfd_byte *elf32_h8_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **);
 static bfd_reloc_status_type elf32_h8_final_link_relocate
   (unsigned long, bfd *, bfd *, asection *,
@@ -1596,12 +1596,13 @@ elf32_h8_symbol_address_p (bfd *abfd, asection *sec, bfd_vma addr)
    which uses elf32_h8_relocate_section.  */
 
 static bfd_byte *
-elf32_h8_get_relocated_section_contents (bfd *output_bfd,
-					 struct bfd_link_info *link_info,
-					 struct bfd_link_order *link_order,
-					 bfd_byte *data,
-					 bool relocatable,
-					 asymbol **symbols)
+elf32_h8_get_relocated_section_contents
+  (bfd *output_bfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   Elf_Internal_Shdr *symtab_hdr;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index daad1deb85d..cd18911bed5 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -13154,12 +13154,13 @@ nds32_fag_remove_unused_fpbase (bfd *abfd, asection *sec,
    The variety only modify function call for reading in the section.  */
 
 static bfd_byte *
-nds32_elf_get_relocated_section_contents (bfd *abfd,
-					  struct bfd_link_info *link_info,
-					  struct bfd_link_order *link_order,
-					  bfd_byte *data,
-					  bool relocatable,
-					  asymbol **symbols)
+nds32_elf_get_relocated_section_contents
+  (bfd *abfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   bfd *input_bfd = link_order->u.indirect.section->owner;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 827f617a057..1b111f3611b 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -5062,7 +5062,7 @@ sh_elf_relocate_section (struct bfd_link_info *info,
 static bfd_byte *
 sh_elf_get_relocated_section_contents (bfd *output_bfd,
 				       struct bfd_link_info *link_info,
-				       struct bfd_link_order *link_order,
+				       const struct bfd_link_order *link_order,
 				       bfd_byte *data,
 				       bool relocatable,
 				       asymbol **symbols)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 1f7da4fdcf6..5f3eb3463f1 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -13503,7 +13503,7 @@ bfd_byte *
 _bfd_elf_mips_get_relocated_section_contents
   (bfd *abfd,
    struct bfd_link_info *link_info,
-   struct bfd_link_order *link_order,
+   const struct bfd_link_order *link_order,
    bfd_byte *data,
    bool relocatable,
    asymbol **symbols)
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index b624d0df112..1b9abed451e 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -116,7 +116,7 @@ extern bool _bfd_mips_elf_find_inliner_info
 extern bool _bfd_mips_elf_set_section_contents
   (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
 extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
 extern bool _bfd_mips_elf_relax_section
   (bfd *abfd, asection *sec, struct bfd_link_info *link_info,
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index e7ec6bfa9a0..fddcae44bc0 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -495,7 +495,7 @@ extern bool _bfd_generic_set_section_contents
 extern int _bfd_nolink_sizeof_headers
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern bfd_byte *_bfd_nolink_bfd_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
 extern bool _bfd_nolink_bfd_relax_section
   (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN;
@@ -675,17 +675,17 @@ extern bool _bfd_generic_section_already_linked
 
 /* Generic reloc_link_order processing routine.  */
 extern bool _bfd_generic_reloc_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *)
   ATTRIBUTE_HIDDEN;
 
 /* Default link order processing routine.  */
 extern bool _bfd_default_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *)
   ATTRIBUTE_HIDDEN;
 
 /* Count the number of reloc entries in a link order list.  */
 extern unsigned int _bfd_count_link_order_relocs
-  (struct bfd_link_order *) ATTRIBUTE_HIDDEN;
+  (const struct bfd_link_order *) ATTRIBUTE_HIDDEN;
 
 /* Final link relocation routine.  */
 extern bfd_reloc_status_type _bfd_final_link_relocate
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index ed5d7cf382a..bc0d62f94dc 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -501,7 +501,7 @@ extern bool _bfd_generic_set_section_contents
 extern int _bfd_nolink_sizeof_headers
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern bfd_byte *_bfd_nolink_bfd_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
 extern bool _bfd_nolink_bfd_relax_section
   (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN;
@@ -681,17 +681,17 @@ extern bool _bfd_generic_section_already_linked
 
 /* Generic reloc_link_order processing routine.  */
 extern bool _bfd_generic_reloc_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *)
   ATTRIBUTE_HIDDEN;
 
 /* Default link order processing routine.  */
 extern bool _bfd_default_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *)
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *)
   ATTRIBUTE_HIDDEN;
 
 /* Count the number of reloc entries in a link order list.  */
 extern unsigned int _bfd_count_link_order_relocs
-  (struct bfd_link_order *) ATTRIBUTE_HIDDEN;
+  (const struct bfd_link_order *) ATTRIBUTE_HIDDEN;
 
 /* Final link relocation routine.  */
 extern bfd_reloc_status_type _bfd_final_link_relocate
@@ -3475,7 +3475,7 @@ bool bfd_generic_lookup_section_flags
 bfd_byte *bfd_generic_get_relocated_section_contents
    (bfd *abfd,
     struct bfd_link_info *link_info,
-    struct bfd_link_order *link_order,
+    const struct bfd_link_order *link_order,
     bfd_byte *data,
     bool relocatable,
     asymbol **symbols) ATTRIBUTE_HIDDEN;
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index b8a99de91e8..e4d04cd76eb 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -418,7 +418,7 @@ extern int coff_sizeof_headers
 extern bool bfd_coff_reloc16_relax_section
   (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN;
 extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
 extern bfd_vma bfd_coff_reloc16_get_value
   (arelent *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN;
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 8d918ba3e7c..5671afce840 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -422,7 +422,7 @@ extern int coff_sizeof_headers
 extern bool bfd_coff_reloc16_relax_section
   (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN;
 extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
-  (bfd *, struct bfd_link_info *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, const struct bfd_link_order *,
    bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN;
 extern bfd_vma bfd_coff_reloc16_get_value
   (arelent *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN;
@@ -846,7 +846,7 @@ typedef struct
      combined_entry_type *, unsigned int);
 
   bool (*_bfd_coff_reloc16_extra_cases)
-    (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+    (bfd *, struct bfd_link_info *, const struct bfd_link_order *, arelent *,
      bfd_byte *, size_t *, size_t *);
 
   int (*_bfd_coff_reloc16_estimate)
diff --git a/bfd/linker.c b/bfd/linker.c
index b579737fdda..c3dbe667cc9 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -424,9 +424,9 @@ static bool generic_link_add_symbol_list
 static bool generic_add_output_symbol
   (bfd *, size_t *psymalloc, asymbol *);
 static bool default_data_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *);
 static bool default_indirect_link_order
-  (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *,
+  (bfd *, struct bfd_link_info *, asection *, const struct bfd_link_order *,
    bool);
 static bool _bfd_generic_link_output_symbols
   (bfd *, bfd *, struct bfd_link_info *, size_t *);
@@ -1924,7 +1924,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
 {
   bfd *sub;
   asection *o;
-  struct bfd_link_order *p;
+  const struct bfd_link_order *p;
   size_t outsymalloc;
   struct generic_write_global_symbol_info wginfo;
 
@@ -2439,7 +2439,7 @@ bool
 _bfd_generic_reloc_link_order (bfd *abfd,
 			       struct bfd_link_info *info,
 			       asection *sec,
-			       struct bfd_link_order *link_order)
+			       const struct bfd_link_order *link_order)
 {
   arelent *r;
 
@@ -2564,7 +2564,7 @@ bool
 _bfd_default_link_order (bfd *abfd,
 			 struct bfd_link_info *info,
 			 asection *sec,
-			 struct bfd_link_order *link_order)
+			 const struct bfd_link_order *link_order)
 {
   switch (link_order->type)
     {
@@ -2587,7 +2587,7 @@ static bool
 default_data_link_order (bfd *abfd,
 			 struct bfd_link_info *info,
 			 asection *sec,
-			 struct bfd_link_order *link_order)
+			 const struct bfd_link_order *link_order)
 {
   bfd_size_type size;
   size_t fill_size;
@@ -2648,7 +2648,7 @@ static bool
 default_indirect_link_order (bfd *output_bfd,
 			     struct bfd_link_info *info,
 			     asection *output_section,
-			     struct bfd_link_order *link_order,
+			     const struct bfd_link_order *link_order,
 			     bool generic_linker)
 {
   asection *input_section;
@@ -2796,10 +2796,10 @@ default_indirect_link_order (bfd *output_bfd,
    list.  */
 
 unsigned int
-_bfd_count_link_order_relocs (struct bfd_link_order *link_order)
+_bfd_count_link_order_relocs (const struct bfd_link_order *link_order)
 {
-  register unsigned int c;
-  register struct bfd_link_order *l;
+  unsigned int c;
+  const struct bfd_link_order *l;
 
   c = 0;
   for (l = link_order; l != NULL; l = l->next)
@@ -3506,7 +3506,7 @@ bfd_byte *
 _bfd_nolink_bfd_get_relocated_section_contents
     (bfd *abfd,
      struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
-     struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
+     const struct bfd_link_order *link_order ATTRIBUTE_UNUSED,
      bfd_byte *data ATTRIBUTE_UNUSED,
      bool relocatable ATTRIBUTE_UNUSED,
      asymbol **symbols ATTRIBUTE_UNUSED)
diff --git a/bfd/reloc.c b/bfd/reloc.c
index e06ec4d4fa1..d0bcb30b97e 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8049,7 +8049,7 @@ SYNOPSIS
 	bfd_byte *bfd_generic_get_relocated_section_contents
 	  (bfd *abfd,
 	   struct bfd_link_info *link_info,
-	   struct bfd_link_order *link_order,
+	   const struct bfd_link_order *link_order,
 	   bfd_byte *data,
 	   bool relocatable,
 	   asymbol **symbols);
@@ -8060,12 +8060,13 @@ DESCRIPTION
 */
 
 bfd_byte *
-bfd_generic_get_relocated_section_contents (bfd *abfd,
-					    struct bfd_link_info *link_info,
-					    struct bfd_link_order *link_order,
-					    bfd_byte *data,
-					    bool relocatable,
-					    asymbol **symbols)
+bfd_generic_get_relocated_section_contents
+  (bfd *abfd,
+   struct bfd_link_info *link_info,
+   const struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bool relocatable,
+   asymbol **symbols)
 {
   bfd *input_bfd = link_order->u.indirect.section->owner;
   asection *input_section = link_order->u.indirect.section;
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index dfd09bdcb16..99daa11f4ff 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -243,7 +243,7 @@ bfd_byte *
 bfd_coff_reloc16_get_relocated_section_contents
   (bfd *in_abfd,
    struct bfd_link_info *link_info,
-   struct bfd_link_order *link_order,
+   const struct bfd_link_order *link_order,
    bfd_byte *data,
    bool relocatable,
    asymbol **symbols)
diff --git a/bfd/targets.c b/bfd/targets.c
index fcf650410dc..bc359a35b41 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -482,7 +482,7 @@ BFD_JUMP_TABLE macros.
 .  bfd_byte *
 .	(*_bfd_get_relocated_section_contents) (bfd *,
 .					        struct bfd_link_info *,
-.					        struct bfd_link_order *,
+.					        const struct bfd_link_order *,
 .					        bfd_byte *, bool,
 .					        struct bfd_symbol **);
 .

-- 
Alan Modra


More information about the Binutils mailing list