PATCH: ld/3290: "ld -s" leaves absolute symbol in DSO

H. J. Lu hjl@lucon.org
Sun Oct 1 14:14:00 GMT 2006


On Fri, Sep 29, 2006 at 05:20:11PM -0700, H. J. Lu wrote:
> "gcc -g -feliminate-dwarf2-dups" may generate symbols relative to debug
> section. When "ld -s" removes debug section, it changes those symbols
> to absolute. The resulting shared library may not be usable. strip is
> even worse. When .debug_info section is removed, section index of
> debug symbol is totally wrong.
> 
> This patch will hide debug symbols.
> 
> 

Here is the updated patch to hide only definitions in debug sections.


H.J.
---
2006-09-29  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3290
	* elflink.c (elf_link_add_object_symbols): Hide definitions in
	debug sections.

--- bfd/elflink.c.debug	2006-09-29 09:00:21.000000000 -0700
+++ bfd/elflink.c	2006-09-30 18:30:40.000000000 -0700
@@ -4137,6 +4137,13 @@ elf_link_add_object_symbols (bfd *abfd, 
 		dynsym = TRUE;
 	    }
 
+	  if (definition && (sec->flags & SEC_DEBUGGING))
+	    {
+	      /* We don't want to make debug symbol dynamic.  */
+	      (*bed->elf_backend_hide_symbol) (info, h, TRUE);
+	      dynsym = FALSE;
+	    }
+
 	  /* Check to see if we need to add an indirect symbol for
 	     the default name.  */
 	  if (definition || h->root.type == bfd_link_hash_common)



More information about the Binutils mailing list