diff options
author | Nick Clifton <nickc@redhat.com> | 2013-04-24 13:19:27 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2013-04-24 13:19:27 +0000 |
commit | 544008aaf7f992ad762049cbd4d6c4216d006857 (patch) | |
tree | 6518ec626b5c93f40a369f833583b7900d04a0e1 /bfd/elflink.c | |
parent | 901d9a916042f252777b454573dd650f6a367fb5 (diff) | |
download | gdb-544008aaf7f992ad762049cbd4d6c4216d006857.zip gdb-544008aaf7f992ad762049cbd4d6c4216d006857.tar.gz gdb-544008aaf7f992ad762049cbd4d6c4216d006857.tar.bz2 |
* ecoff.c: casting the return value of BFD_ALIGN to int
* elf32-tic6x.c: removing unused variables
* elf32-v850.c: redefine the type of a variable (int -> bfd_vma)
* vms-alpha.c: initialize a variable
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 99a1ddf..138c18e 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1,7 +1,5 @@ /* ELF linking support for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 - Free Software Foundation, Inc. + Copyright 1995-2013 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -11844,6 +11842,44 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info, && ((isec->flags & SEC_DEBUGGING) != 0 || (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)) isec->gc_mark = 1; + /* Look for CODE sections which are going to be discarded. */ + for (isec = ibfd->sections; isec != NULL; isec = isec->next) + if ((isec->flags & SEC_CODE) != 0 + && isec->gc_mark == 0) + { + unsigned int ilen; + asection *dsec; + + ilen = strlen (isec->name); + + /* Determine if there are any debug sections associated + with this code section. If so, remove their mark + (which may have been set above) so that they can be + garbage collected as well. + + Association is determined by the name of the debug section + containing the name of the code section as a suffix. For + example .debug_line.text.foo is a debug section associated + with .text.foo. */ + for (dsec = ibfd->sections; dsec != NULL; dsec = dsec->next) + { + unsigned int dlen; + + if (dsec->gc_mark == 0 + || (dsec->flags & SEC_DEBUGGING) == 0) + continue; + + dlen = strlen (dsec->name); + + if (dlen > ilen + && strncmp (dsec->name + (dlen - ilen), + isec->name, ilen) == 0) + { + dsec->gc_mark = 0; + break; + } + } + } } return TRUE; } |