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: [RFC] Providing init_fini_syms earlier?


Hi,

On Fri, 5 Aug 2005, Michael Matz wrote:

> > bfd/
> > 	* bfd-in.h (_bfd_elf_fix_excluded_sec_syms): Declare.
> > 	(_bfd_elf_provide_section_bound_symbols): Remove param name.
> > 	Formatting.
> > 	* bfd-in2.h: Regenerate.
> > 	* elflink.c (bfd_elf_gc_sections): Don't call generic function.
> > 	(_bfd_elf_provide_symbol): Formatting.
> > 	(_bfd_elf_provide_section_bound_symbols): Remove all hacks, just
> > 	create section relative syms.
> > 	(fix_syms, _bfd_elf_fix_excluded_sec_syms): New functions.
> 
> How I wish having more time following the binutils@ list.  Then I would 
> have noticed this earlier, so sorry.  This patch which in one or the other 
> form seems now to be in binutils breaks alpha again.  The problem is, that 

I must admit that I initially noticed the problem with HJs 2.16.91.0.2 
binutils, but I now reproduced it with clean CVS binutils.  I saw (in 
passing) some later messages also dealing with these issues, so none of 
these other patches fixed the problem.  I used the below change to 
work-around the issue.


Ciao,
Michael.
-- 
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.186
diff -u -p -r1.186 elflink.c
--- elflink.c	4 Aug 2005 01:19:03 -0000	1.186
+++ elflink.c	5 Aug 2005 07:46:48 -0000
@@ -9884,6 +9884,18 @@ _bfd_elf_provide_section_bound_symbols (
 					const char *end)
 {
   bfd_vma val = 0;
+  if (!sec)
+    {
+      /* We have to choose those values very carefully.  Some targets,
+         like alpha, may have relocation overflow with 0. "__bss_start"
+         should be defined in all cases.  */
+      struct elf_link_hash_entry *h
+        = elf_link_hash_lookup (elf_hash_table (info), "__bss_start",
+                                FALSE, FALSE, FALSE);
+      if (h != NULL && h->root.type == bfd_link_hash_defined)
+        val = h->root.u.def.value;
+    }
+
   _bfd_elf_provide_symbol (info, start, val, sec);
   if (sec != NULL)
     val = sec->size;


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