This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
pass link_info to modify_segment_map
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 27 Nov 2003 14:42:41 -0200
- Subject: pass link_info to modify_segment_map
- Organization: GCC Team, Red Hat
I needed access to the link hash table from within modify_segment_map
on a port I'm working on. This patch was approved by Nick Clifton, so
I'm checking it in. Tested with --enable-targets=all, no warning
regressions, on i686-pc-linux-gnu.
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* elf-bfd.h (elf_backend_data::elf_backend_modify_segment_map):
Add link info argument.
* elf32-i370.c (elf_backend_modify_segment_map): Likewise.
* elf32-ppc.c (ppc_elf_modify_segment_map): Likewise.
* elf32-xtensa.c (elf_xtensa_modify_segment_map): Likewise.
* elf64-hppa.c (elf64_hppa_modify_segment_map): Likewise.
* elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
* elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
* elfxx-mips.h (_bfd_mips_elf_modify_segment_map): Likewise.
* elf.c (assign_file_positions_except_relocs,
assign_file_positions_for_segments): Likewise. Adjust calls.
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.120
diff -u -p -r1.120 elf-bfd.h
--- bfd/elf-bfd.h 22 Nov 2003 10:45:44 -0000 1.120
+++ bfd/elf-bfd.h 27 Nov 2003 16:36:09 -0000
@@ -760,7 +760,7 @@ struct elf_backend_data
/* This function is called to modify an existing segment map in a
backend specific fashion. */
bfd_boolean (*elf_backend_modify_segment_map)
- (bfd *);
+ (bfd *, struct bfd_link_info *);
/* This function is called during section gc to discover the section a
particular relocation refers to. */
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.211
diff -u -p -r1.211 elf.c
--- bfd/elf.c 27 Nov 2003 12:28:35 -0000 1.211
+++ bfd/elf.c 27 Nov 2003 16:36:14 -0000
@@ -41,7 +41,7 @@
#include "libiberty.h"
static int elf_sort_sections (const void *, const void *);
-static bfd_boolean assign_file_positions_except_relocs (bfd *);
+static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *);
static bfd_boolean prep_headers (bfd *);
static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ;
static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ;
@@ -3103,7 +3103,7 @@ _bfd_elf_compute_section_file_positions
/* sh_offset is set in assign_file_positions_except_relocs. */
shstrtab_hdr->sh_addralign = 1;
- if (!assign_file_positions_except_relocs (abfd))
+ if (!assign_file_positions_except_relocs (abfd, link_info))
return FALSE;
if (link_info == NULL && bfd_get_symcount (abfd) > 0)
@@ -3576,7 +3576,7 @@ elf_sort_sections (const void *arg1, con
the file header, and writes out the program headers. */
static bfd_boolean
-assign_file_positions_for_segments (bfd *abfd)
+assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int count;
@@ -3628,7 +3628,7 @@ assign_file_positions_for_segments (bfd
if (bed->elf_backend_modify_segment_map)
{
- if (! (*bed->elf_backend_modify_segment_map) (abfd))
+ if (! (*bed->elf_backend_modify_segment_map) (abfd, link_info))
return FALSE;
}
@@ -4136,7 +4136,8 @@ get_program_header_size (bfd *abfd)
We also don't set the positions of the .symtab and .strtab here. */
static bfd_boolean
-assign_file_positions_except_relocs (bfd *abfd)
+assign_file_positions_except_relocs (bfd *abfd,
+ struct bfd_link_info *link_info)
{
struct elf_obj_tdata * const tdata = elf_tdata (abfd);
Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd);
@@ -4187,7 +4188,7 @@ assign_file_positions_except_relocs (bfd
/* Assign file positions for the loaded sections based on the
assignment of sections to segments. */
- if (! assign_file_positions_for_segments (abfd))
+ if (! assign_file_positions_for_segments (abfd, link_info))
return FALSE;
/* Assign file positions for the other sections. */
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.30
diff -u -p -r1.30 elf32-i370.c
--- bfd/elf32-i370.c 11 Nov 2003 13:32:37 -0000 1.30
+++ bfd/elf32-i370.c 27 Nov 2003 16:36:15 -0000
@@ -1555,6 +1555,6 @@ static int i370_noop ()
#define elf_backend_additional_program_headers \
(int (*) PARAMS ((bfd *))) i370_noop
#define elf_backend_modify_segment_map \
- (bfd_boolean (*) PARAMS ((bfd *))) i370_noop
+ (bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) i370_noop
#include "elf32-target.h"
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.107
diff -u -p -r1.107 elf32-ppc.c
--- bfd/elf32-ppc.c 17 Nov 2003 21:31:10 -0000 1.107
+++ bfd/elf32-ppc.c 27 Nov 2003 16:36:18 -0000
@@ -2739,7 +2739,8 @@ ppc_elf_additional_program_headers (bfd
/* Modify the segment map if needed. */
static bfd_boolean
-ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED)
+ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
return TRUE;
}
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.18
diff -u -p -r1.18 elf32-xtensa.c
--- bfd/elf32-xtensa.c 17 Nov 2003 21:31:11 -0000 1.18
+++ bfd/elf32-xtensa.c 27 Nov 2003 16:36:21 -0000
@@ -60,7 +60,7 @@ static bfd_boolean elf_xtensa_adjust_dyn
static bfd_boolean elf_xtensa_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elf_xtensa_modify_segment_map
- PARAMS ((bfd *));
+ PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elf_xtensa_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -1415,8 +1415,9 @@ elf_xtensa_size_dynamic_sections (output
this and it probably ought to be moved into elf.c as well. */
static bfd_boolean
-elf_xtensa_modify_segment_map (abfd)
+elf_xtensa_modify_segment_map (abfd, info)
bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
struct elf_segment_map **m_p;
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf64-hppa.c
--- bfd/elf64-hppa.c 11 Nov 2003 13:32:38 -0000 1.41
+++ bfd/elf64-hppa.c 27 Nov 2003 16:36:23 -0000
@@ -213,7 +213,7 @@ static int elf64_hppa_additional_program
PARAMS ((bfd *));
static bfd_boolean elf64_hppa_modify_segment_map
- PARAMS ((bfd *));
+ PARAMS ((bfd *, struct bfd_link_info *));
static enum elf_reloc_type_class elf64_hppa_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
@@ -2609,8 +2609,9 @@ elf64_hppa_additional_program_headers (a
existence of a .interp section. */
static bfd_boolean
-elf64_hppa_modify_segment_map (abfd)
+elf64_hppa_modify_segment_map (abfd, info)
bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
struct elf_segment_map *m;
asection *s;
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.110
diff -u -p -r1.110 elfxx-ia64.c
--- bfd/elfxx-ia64.c 19 Nov 2003 01:06:10 -0000 1.110
+++ bfd/elfxx-ia64.c 27 Nov 2003 16:36:25 -0000
@@ -194,7 +194,7 @@ static bfd_boolean elfNN_ia64_add_symbol
static int elfNN_ia64_additional_program_headers
PARAMS ((bfd *abfd));
static bfd_boolean elfNN_ia64_modify_segment_map
- PARAMS ((bfd *));
+ PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elfNN_ia64_is_local_label_name
PARAMS ((bfd *abfd, const char *name));
static bfd_boolean elfNN_ia64_dynamic_symbol_p
@@ -1405,8 +1405,9 @@ elfNN_ia64_additional_program_headers (a
}
static bfd_boolean
-elfNN_ia64_modify_segment_map (abfd)
+elfNN_ia64_modify_segment_map (abfd, info)
bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.83
diff -u -p -r1.83 elfxx-mips.c
--- bfd/elfxx-mips.c 26 Nov 2003 20:58:45 -0000 1.83
+++ bfd/elfxx-mips.c 27 Nov 2003 16:36:31 -0000
@@ -7308,8 +7308,9 @@ _bfd_mips_elf_additional_program_headers
/* Modify the segment map for an IRIX5 executable. */
bfd_boolean
-_bfd_mips_elf_modify_segment_map (abfd)
+_bfd_mips_elf_modify_segment_map (abfd, info)
bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
{
asection *s;
struct elf_segment_map *m, **pm;
Index: bfd/elfxx-mips.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.h,v
retrieving revision 1.13
diff -u -p -r1.13 elfxx-mips.h
--- bfd/elfxx-mips.h 4 Nov 2003 10:41:51 -0000 1.13
+++ bfd/elfxx-mips.h 27 Nov 2003 16:36:31 -0000
@@ -62,7 +62,7 @@ extern void _bfd_mips_elf_final_write_pr
extern int _bfd_mips_elf_additional_program_headers
PARAMS ((bfd *));
extern bfd_boolean _bfd_mips_elf_modify_segment_map
- PARAMS ((bfd *));
+ PARAMS ((bfd *, struct bfd_link_info *));
extern asection * _bfd_mips_elf_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer