This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about an elf.c change



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);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]