diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-05-11 02:15:46 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-05-11 02:15:46 +0000 |
commit | 3d2b39cfded1df61fe5217e7d091a80f933e234d (patch) | |
tree | b5172c2f85a4fc780aec6a4b5b8f05e5db2660e1 /bfd/elf.c | |
parent | 75919f948cc0c27405b7d50342b974ac537421d8 (diff) | |
download | gdb-3d2b39cfded1df61fe5217e7d091a80f933e234d.zip gdb-3d2b39cfded1df61fe5217e7d091a80f933e234d.tar.gz gdb-3d2b39cfded1df61fe5217e7d091a80f933e234d.tar.bz2 |
2005-05-10 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (_bfd_elf_make_section_from_shdr): Only check debug
section if SEC_ALLOC isn't set.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 56 |
1 files changed, 38 insertions, 18 deletions
@@ -750,25 +750,45 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, if ((hdr->sh_flags & SHF_TLS) != 0) flags |= SEC_THREAD_LOCAL; - /* The debugging sections appear to be recognized only by name, not - any sort of flag. */ - { - static const char *debug_sec_names [] = + if ((flags & SEC_ALLOC) == 0) { - ".debug", - ".gnu.linkonce.wi.", - ".line", - ".stab" - }; - int i; - - for (i = ARRAY_SIZE (debug_sec_names); i--;) - if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0) - break; - - if (i >= 0) - flags |= SEC_DEBUGGING; - } + /* The debugging sections appear to be recognized only by name, + not any sort of flag. Their SEC_ALLOC bits are cleared. */ + static const struct + { + const char *name; + int len; + } debug_sections [] = + { + { "debug", 5 }, /* 'd' */ + { NULL, 0 }, /* 'e' */ + { NULL, 0 }, /* 'f' */ + { "gnu.linkonce.wi.", 17 }, /* 'g' */ + { NULL, 0 }, /* 'h' */ + { NULL, 0 }, /* 'i' */ + { NULL, 0 }, /* 'j' */ + { NULL, 0 }, /* 'k' */ + { "line", 4 }, /* 'l' */ + { NULL, 0 }, /* 'm' */ + { NULL, 0 }, /* 'n' */ + { NULL, 0 }, /* 'o' */ + { NULL, 0 }, /* 'p' */ + { NULL, 0 }, /* 'q' */ + { NULL, 0 }, /* 'r' */ + { "stab", 4 } /* 's' */ + }; + + if (name [0] == '.') + { + int i = name [1] - 'd'; + if (i >= 0 + && i < (int) ARRAY_SIZE (debug_sections) + && debug_sections [i].name != NULL + && strncmp (&name [1], debug_sections [i].name, + debug_sections [i].len) == 0) + flags |= SEC_DEBUGGING; + } + } /* As a GNU extension, if the name begins with .gnu.linkonce, we only link a single copy of the section. This is used to support |