* elf.c (_bfd_elf_make_section_from_shdr): Only check debug
	section if SEC_ALLOC isn't set.
This commit is contained in:
H.J. Lu
2005-05-11 02:15:46 +00:00
parent 75919f948c
commit 3d2b39cfde
2 changed files with 43 additions and 18 deletions

View File

@@ -1,3 +1,8 @@
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.
2005-05-09 Kelley Cook <kcook@gcc.gnu.org> 2005-05-09 Kelley Cook <kcook@gcc.gnu.org>
* configure.in: Replace AC_COMPILE_CHECK_SIZEOF with AC_CHECK_SIZEOF. * configure.in: Replace AC_COMPILE_CHECK_SIZEOF with AC_CHECK_SIZEOF.

View File

@@ -750,25 +750,45 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
if ((hdr->sh_flags & SHF_TLS) != 0) if ((hdr->sh_flags & SHF_TLS) != 0)
flags |= SEC_THREAD_LOCAL; flags |= SEC_THREAD_LOCAL;
/* The debugging sections appear to be recognized only by name, not if ((flags & SEC_ALLOC) == 0)
any sort of flag. */
{
static const char *debug_sec_names [] =
{ {
".debug", /* The debugging sections appear to be recognized only by name,
".gnu.linkonce.wi.", not any sort of flag. Their SEC_ALLOC bits are cleared. */
".line", static const struct
".stab" {
}; const char *name;
int i; int len;
} debug_sections [] =
for (i = ARRAY_SIZE (debug_sec_names); i--;) {
if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0) { "debug", 5 }, /* 'd' */
break; { NULL, 0 }, /* 'e' */
{ NULL, 0 }, /* 'f' */
if (i >= 0) { "gnu.linkonce.wi.", 17 }, /* 'g' */
flags |= SEC_DEBUGGING; { 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 /* 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 only link a single copy of the section. This is used to support