This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
small elflink.c tidy
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Mon, 12 Feb 2007 21:42:49 +1030
- Subject: small elflink.c tidy
Saves calling bfd_get_section_by_name unnecessarily.
* elflink.c (bfd_elf_discard_info): Tidy setting of "eh".
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.247
diff -u -p -r1.247 elflink.c
--- bfd/elflink.c 5 Feb 2007 23:15:38 -0000 1.247
+++ bfd/elflink.c 12 Feb 2007 10:58:11 -0000
@@ -10938,12 +10938,15 @@ bfd_elf_discard_info (bfd *output_bfd, s
if ((abfd->flags & DYNAMIC) != 0)
continue;
- eh = bfd_get_section_by_name (abfd, ".eh_frame");
- if (info->relocatable
- || (eh != NULL
+ eh = NULL;
+ if (!info->relocatable)
+ {
+ eh = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh != NULL
&& (eh->size == 0
- || bfd_is_abs_section (eh->output_section))))
- eh = NULL;
+ || bfd_is_abs_section (eh->output_section)))
+ eh = NULL;
+ }
stab = bfd_get_section_by_name (abfd, ".stab");
if (stab != NULL
--
Alan Modra
IBM OzLabs - Linux Technology Centre