]> git.pld-linux.org Git - packages/binutils.git/blob - binutils-pr3290.patch
- fix PR ld/3290, release 2.1.
[packages/binutils.git] / binutils-pr3290.patch
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.
6
7 This patch will hide debug symbols.
8
9 2006-09-29  H.J. Lu  <hongjiu.lu@intel.com>
10
11         PR ld/3290
12         * elfcode.h (elf_slurp_symbol_table): Mark a debug symbol if it
13         is in a debug section.
14
15         * elflink.c (elf_link_add_object_symbols): Hide debug symbols.
16
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;
22                 }
23 +             else if ((sym->symbol.section->flags & SEC_DEBUGGING))
24 +               {
25 +                 /* If this symbol is in a debug section, it must be a
26 +                    debug symbol.  */
27 +                 sym->symbol.flags |= BSF_DEBUGGING;
28 +               }
29             }
30           else if (isym->st_shndx == SHN_ABS)
31             {
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, 
35                 dynsym = TRUE;
36             }
37  
38 +         if ((sec->flags & SEC_DEBUGGING))
39 +           {
40 +             /* We don't want to make debug symbol dynamic.  */
41 +             (*bed->elf_backend_hide_symbol) (info, h, TRUE);
42 +             dynsym = FALSE;
43 +           }
44 +
45           /* Check to see if we need to add an indirect symbol for
46              the default name.  */
47           if (definition || h->root.type == bfd_link_hash_common)
This page took 0.054171 seconds and 3 git commands to generate.