public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Question about an elf.c change
@ 2002-01-16 12:45 Steve Ellcey
  2002-01-16 17:08 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Ellcey @ 2002-01-16 12:45 UTC (permalink / raw)
  To: amodra, binutils


I would like to have a change checked in to bfd/elf.c to fix a
regression (for my HP-UX IA64 platform) that was introduced with version
1.112 of elf.c made by amodra.

For my HP-UX IA64 vector I have a special version of
elf_backend_section_from_bfd_section that returns SHN_IA_64_ANSI_COMMON
instead of SHN_COMMON if bfd_is_com_section() is true.  This used to
work because in elf.c (_bfd_elf_section_from_bfd_section) we called the
special version of the elf_backend_section_from_bfd_section routine
before doing:

  if (bfd_is_com_section (asect))
    return SHN_COMMON;

Now, we do this test before calling the platform specific
elf_backend_section_from_bfd_section function and I get SHN_COMMON
instead of the SHN_IA_64_ANSI_COMMON that I want.

Is the following patch (move the abs/com/undef tests later in the
routine) considered acceptable in order to fix this.  I am not sure
what, if any, complications there may be in doing the various checks in
_bfd_elf_section_from_bfd_section in any particular order.

Steve Ellcey
sje@cup.hp.com


2002-01-16  Steve Ellcey  <sje@cup.hp.com>

        * elf.c (_bfd_elf_section_from_bfd_section): Do platform
	specific section checks before generic ones.

--- elf.c.orig	Wed Jan 16 10:42:17 2002
+++ elf.c	Wed Jan 16 10:45:35 2002
@@ -4044,13 +4044,6 @@ _bfd_elf_section_from_bfd_section (abfd,
       && elf_section_data (asect)->this_idx != 0)
     return elf_section_data (asect)->this_idx;
 
-  if (bfd_is_abs_section (asect))
-    return SHN_ABS;
-  if (bfd_is_com_section (asect))
-    return SHN_COMMON;
-  if (bfd_is_und_section (asect))
-    return SHN_UNDEF;
-
   for (index = 1; index < maxindex; index++)
     {
       hdr = i_shdrp[index];
@@ -4074,6 +4067,13 @@ _bfd_elf_section_from_bfd_section (abfd,
 	    return retval;
 	}
     }
+
+  if (bfd_is_abs_section (asect))
+    return SHN_ABS;
+  if (bfd_is_com_section (asect))
+    return SHN_COMMON;
+  if (bfd_is_und_section (asect))
+    return SHN_UNDEF;
 
   bfd_set_error (bfd_error_nonrepresentable_section);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-17 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-16 12:45 Question about an elf.c change Steve Ellcey
2002-01-16 17:08 ` Alan Modra
2002-01-17  8:03   ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).