aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-09-28 12:59:25 +0000
committerNick Clifton <nickc@redhat.com>2006-09-28 12:59:25 +0000
commitea9986ff0085095cd23ec95dc0e42177c062e117 (patch)
tree82db9fd23cc38c85fa029aaf30bbf5196b9ed5e1 /bfd/elflink.c
parent2642de2a6c63f6a5710395e0ab502d6929d2ffd6 (diff)
downloadgdb-ea9986ff0085095cd23ec95dc0e42177c062e117.zip
gdb-ea9986ff0085095cd23ec95dc0e42177c062e117.tar.gz
gdb-ea9986ff0085095cd23ec95dc0e42177c062e117.tar.bz2
* bfd-in.h (CONST_STRNCPY) : Delete.
(LITSTRCPY) : New. (LITMEMCPY) : New. * bfd-in2.h : Regenerate. * elflink.c (bfd_elf_gc_sections) : Use LITMEMCPY. Don't manually calculate string lengths. * nlmcode.h (nlm_swap_auxiliary_headers_in) : Use LITMEMCPY. * nlmconv.c (main) : Use LITMEMCPY. * prdbg.c (tg_class_static_member) : Use LITSTRCPY.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 9b45578..afff7aa 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -9691,21 +9691,24 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
easily due to needing special relocs to handle the
difference of two symbols in separate sections.
Don't keep code sections referenced by .eh_frame. */
+#define TEXT_PREFIX ".text."
+#define GCC_EXCEPT_TABLE_PREFIX ".gcc_except_table."
for (o = sub->sections; o != NULL; o = o->next)
if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0)
{
- if (CONST_STRNEQ (o->name, ".gcc_except_table."))
+ if (CONST_STRNEQ (o->name, GCC_EXCEPT_TABLE_PREFIX))
{
- unsigned long len;
char *fn_name;
+ const char *sec_name;
asection *fn_text;
+ unsigned o_name_prefix_len = strlen (GCC_EXCEPT_TABLE_PREFIX);
+ unsigned fn_name_prefix_len = strlen (TEXT_PREFIX);
- len = strlen (o->name + 18) + 1;
- fn_name = bfd_malloc (len + 6);
+ sec_name = o->name + o_name_prefix_len;
+ fn_name = bfd_malloc (strlen (sec_name) + fn_name_prefix_len + 1);
if (fn_name == NULL)
return FALSE;
- memcpy (fn_name, STRING_COMMA_LEN (".text."));
- memcpy (fn_name + 6, o->name + 18, len);
+ sprintf (fn_name, "%s%s", TEXT_PREFIX, sec_name);
fn_text = bfd_get_section_by_name (sub, fn_name);
free (fn_name);
if (fn_text == NULL || !fn_text->gc_mark)