This is the mail archive of the binutils@sources.redhat.com 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: ppc64 without dot syms and linux kernel interaction


On Tue, Aug 17, 2004 at 10:04:39PM +0200, Jakub Jelinek wrote:
> On Tue, Aug 17, 2004 at 09:50:14PM +0200, Arjan van de Ven wrote:
> > it breaks the kernel too...
[snip]
>         .llong  .sys_foobar
[snip]

	* elf64-ppc.c (func_desc_adjust): Give undefined dot-symbols a value
	if we can look up their function descriptor in a regular file.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.163
diff -u -p -r1.163 elf64-ppc.c
--- bfd/elf64-ppc.c	17 Aug 2004 09:07:35 -0000	1.163
+++ bfd/elf64-ppc.c	18 Aug 2004 06:49:40 -0000
@@ -5061,6 +5061,24 @@ func_desc_adjust (struct elf_link_hash_e
   info = inf;
   htab = ppc_hash_table (info);
 
+  /* Resolve undefined references to dot-symbols as the value
+     in the function descriptor, if we have one in a regular object.
+     This is to satisfy cases like ".quad .foo".  Calls to functions
+     in dynamic objects are handled elsewhere.  */
+  if (fh->elf.root.type == bfd_link_hash_undefweak
+      && fh->was_undefined
+      && (fh->oh->elf.root.type == bfd_link_hash_defined
+	  || fh->oh->elf.root.type == bfd_link_hash_defweak)
+      && get_opd_info (fh->oh->elf.root.u.def.section) != NULL
+      && opd_entry_value (fh->oh->elf.root.u.def.section,
+			  fh->oh->elf.root.u.def.value,
+			  &fh->elf.root.u.def.section,
+			  &fh->elf.root.u.def.value) != (bfd_vma) -1)
+    {
+      fh->elf.root.type = fh->oh->elf.root.type;
+      fh->elf.elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+    }
+
   /* If this is a function code symbol, transfer dynamic linking
      information to the function descriptor symbol.  */
   if (!fh->is_func)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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