1 "gcc -g -feliminate-dwarf2-dups" may generate symbols relative to debug
2 section. When "ld -s" removes debug section, it changes those symbols
3 to absolute. The resulting shared library may not be usable. strip is
4 even worse. When .debug_info section is removed, section index of
5 debug symbol is totally wrong.
7 This patch will hide debug symbols.
9 2006-09-29 H.J. Lu <hongjiu.lu@intel.com>
12 * elfcode.h (elf_slurp_symbol_table): Mark a debug symbol if it
13 is in a debug section.
15 * elflink.c (elf_link_add_object_symbols): Hide debug symbols.
17 --- bfd/elfcode.h.debug 2006-09-23 16:37:33.000000000 -0700
18 +++ bfd/elfcode.h 2006-09-29 17:15:14.000000000 -0700
19 @@ -1184,6 +1184,12 @@ elf_slurp_symbol_table (bfd *abfd, asymb
20 although it is wrong. FIXME. */
21 sym->symbol.section = bfd_abs_section_ptr;
23 + else if ((sym->symbol.section->flags & SEC_DEBUGGING))
25 + /* If this symbol is in a debug section, it must be a
27 + sym->symbol.flags |= BSF_DEBUGGING;
30 else if (isym->st_shndx == SHN_ABS)
32 --- bfd/elflink.c.debug 2006-09-29 09:00:21.000000000 -0700
33 +++ bfd/elflink.c 2006-09-29 17:13:25.000000000 -0700
34 @@ -4137,6 +4137,13 @@ elf_link_add_object_symbols (bfd *abfd,
38 + if ((sec->flags & SEC_DEBUGGING))
40 + /* We don't want to make debug symbol dynamic. */
41 + (*bed->elf_backend_hide_symbol) (info, h, TRUE);
45 /* Check to see if we need to add an indirect symbol for
47 if (definition || h->root.type == bfd_link_hash_common)