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: [PATCH/RFA] Merge non visibility STO attribute


"H. J. Lu" <hjl@lucon.org> wrote:
>> The second problem is that elf_link_add_object_symbols doesn't merge
>> any STO attributes of the symbol from a dynamic object. The attached
>> patch fixes these and adds the above new test.  I've tested the patch
>> on i686-pc-linux-gnu and sh64-elf and there are no new regressions.
>> OK to the trunk?
>> 
> 
> Since gABI only defines visibility, I don't think elf_link_add_object_symbols
> should touch other parts of STO. I think we should have a target
> specific way to merge informaton from symbol table entry.

How about this?

Regards,
	kaz
--
2003-10-13  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* elf-bfd.h (struct elf_backend_data): New function pointer member
	elf_backend_merge_symbol_attribute.
	* elflink.h (elf_link_add_object_symbols): Adjust call to
	elf_backend_merge_symbol_attribute if the backend defined it.
        * elfxx-target.h (elf_backend_merge_symbol_attribute): New macro.
        (elfNN_bed): Add that to the initializer.

diff -u3prN ORIG/src/bfd/elf-bfd.h LOCAL/src/bfd/elf-bfd.h
--- ORIG/src/bfd/elf-bfd.h	Wed Sep 24 14:48:15 2003
+++ LOCAL/src/bfd/elf-bfd.h	Tue Oct 14 07:09:09 2003
@@ -813,6 +813,11 @@ struct elf_backend_data
   void (*elf_backend_hide_symbol)
     (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
 
+  /* Merge the backend specific symbol attribute.  */
+  void (*elf_backend_merge_symbol_attribute)
+    (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
+     bfd_boolean);
+
   /* Emit relocations.  Overrides default routine for emitting relocs,
      except during a relocatable link, or if all relocs are being emitted.  */
   bfd_boolean (*elf_backend_emit_relocs)
diff -u3prN ORIG/src/bfd/elflink.h LOCAL/src/bfd/elflink.h
--- ORIG/src/bfd/elflink.h	Sat Oct 11 11:57:08 2003
+++ LOCAL/src/bfd/elflink.h	Tue Oct 14 07:33:19 2003
@@ -1259,9 +1259,13 @@ elf_link_add_object_symbols (bfd *abfd, 
 	    }
 
 	  /* If st_other has a processor-specific meaning, specific
-	     code might be needed here. We never merge the visibility
+	     code is needed here. If the backend doesn't define a hook,
+	     we fallback to the minimal one. We never merge the visibility
 	     attribute with the one from a dynamic object.  */
-	  if (isym->st_other != 0 && !dynamic)
+	  if (bed->elf_backend_merge_symbol_attribute)
+	    (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
+							dynamic);
+	  else if (isym->st_other != 0 && !dynamic)
 	    {
 	      unsigned char hvis, symvis, other, nvis;
 
diff -u3prN ORIG/src/bfd/elfxx-target.h LOCAL/src/bfd/elfxx-target.h
--- ORIG/src/bfd/elfxx-target.h	Fri Aug  8 10:52:29 2003
+++ LOCAL/src/bfd/elfxx-target.h	Tue Oct 14 07:09:44 2003
@@ -361,6 +361,9 @@
 #ifndef elf_backend_hide_symbol
 #define elf_backend_hide_symbol		_bfd_elf_link_hash_hide_symbol
 #endif
+#ifndef elf_backend_merge_symbol_attribute
+#define elf_backend_merge_symbol_attribute	NULL
+#endif
 #ifndef elf_backend_emit_relocs
 #define elf_backend_emit_relocs			NULL
 #endif
@@ -483,6 +486,7 @@ static const struct elf_backend_data elf
   elf_backend_output_arch_syms,
   elf_backend_copy_indirect_symbol,
   elf_backend_hide_symbol,
+  elf_backend_merge_symbol_attribute,
   elf_backend_emit_relocs,
   elf_backend_count_relocs,
   elf_backend_grok_prstatus,


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