.dynsym pain
Richard Henderson
rth@cygnus.com
Tue Jul 13 19:12:00 GMT 1999
Mark,
I just noticed that my patch breaks mips. Your mips_elf_sort_hash_table
stuff gets called before I completely renumber the symbols. What do you
think of the following fix?
r~
* elf32-mips.c (mips_elf_sort_hash_table): Add output_bfd argument.
Set the base dynindx based on the number of output sections.
(_bfd_mips_elf_final_link): Call it.
Index: elf32-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-mips.c,v
retrieving revision 1.21
diff -c -p -d -r1.21 elf32-mips.c
*** elf32-mips.c 1999/07/13 18:21:19 1.21
--- elf32-mips.c 1999/07/14 02:10:47
*************** static boolean mips_elf_assign_gp PARAMS
*** 176,182 ****
static boolean mips_elf_sort_hash_table_f
PARAMS ((struct mips_elf_link_hash_entry *, PTR));
static boolean mips_elf_sort_hash_table
! PARAMS ((struct bfd_link_info *));
static asection * mips_elf_got_section PARAMS ((bfd *));
static struct mips_got_info *mips_elf_got_info
PARAMS ((bfd *, asection **));
--- 176,182 ----
static boolean mips_elf_sort_hash_table_f
PARAMS ((struct mips_elf_link_hash_entry *, PTR));
static boolean mips_elf_sort_hash_table
! PARAMS ((bfd *, struct bfd_link_info *));
static asection * mips_elf_got_section PARAMS ((bfd *));
static struct mips_got_info *mips_elf_got_info
PARAMS ((bfd *, asection **));
*************** _bfd_mips_elf_final_link (abfd, info)
*** 4319,4324 ****
--- 4319,4331 ----
elf_elfheader (abfd)->e_flags |= EF_MIPS_CPIC;
}
+ /* ??? We'd carefully arranged the dynamic symbol indices, and then the
+ generic size_dynamic_sections renumbered them out from under us.
+ Rather than trying somehow to prevent the renumbering, just do
+ the sort again. */
+ if (!mips_elf_sort_hash_table (abfd, info))
+ return false;
+
/* On IRIX5, we omit the .options section. On IRIX6, however, we
include it, even though we don't process it quite right. (Some
entries are supposed to be merged.) Empirically, we seem to be
*************** mips_elf_sort_hash_table_f (h, data)
*** 5307,5313 ****
required. */
static boolean
! mips_elf_sort_hash_table (info)
struct bfd_link_info *info;
{
struct mips_elf_hash_sort_data hsd;
--- 5314,5321 ----
required. */
static boolean
! mips_elf_sort_hash_table (output_bfd, info)
! bfd *output_bfd;
struct bfd_link_info *info;
{
struct mips_elf_hash_sort_data hsd;
*************** mips_elf_sort_hash_table (info)
*** 5318,5324 ****
hsd.low = NULL;
hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
! hsd.max_non_got_dynindx = 1;
mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
elf_hash_table (info)),
mips_elf_sort_hash_table_f,
--- 5326,5332 ----
hsd.low = NULL;
hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
! hsd.max_non_got_dynindx = bfd_count_sections (output_bfd) + 1;
mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
elf_hash_table (info)),
mips_elf_sort_hash_table_f,
*************** _bfd_mips_elf_size_dynamic_sections (out
*** 7530,7536 ****
higher. Therefore, it make sense to put those symbols
that need GOT entries at the end of the symbol table. We
do that here. */
! if (!mips_elf_sort_hash_table (info))
return false;
i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
--- 7538,7544 ----
higher. Therefore, it make sense to put those symbols
that need GOT entries at the end of the symbol table. We
do that here. */
! if (!mips_elf_sort_hash_table (output_bfd, info))
return false;
i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
More information about the Binutils
mailing list